Introduce first-class text module in iced_native

This commit is contained in:
Héctor Ramón Jiménez 2021-10-31 16:13:03 +07:00
parent 0aafcde0ef
commit b3a01973c6
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
16 changed files with 87 additions and 88 deletions

View file

@ -1,7 +1,7 @@
//! Write a graphics backend.
use iced_native::text;
use iced_native::widget::image;
use iced_native::widget::svg;
use iced_native::widget::text;
use iced_native::{Font, Point, Size};
/// The graphics backend of a [`Renderer`].

View file

@ -2,6 +2,7 @@ use crate::backend::{self, Backend};
use crate::{Primitive, Vector};
use iced_native::layout;
use iced_native::renderer;
use iced_native::text::{self, Text};
use iced_native::{Element, Font, Point, Rectangle, Size};
pub use iced_native::renderer::Style;
@ -104,7 +105,7 @@ where
}
}
impl<B> renderer::Text for Renderer<B>
impl<B> text::Renderer for Renderer<B>
where
B: Backend + backend::Text,
{
@ -137,7 +138,7 @@ where
bounds: Size,
point: Point,
nearest_only: bool,
) -> Option<renderer::text::Hit> {
) -> Option<text::Hit> {
self.backend().hit_test(
content,
size,
@ -148,7 +149,7 @@ where
)
}
fn fill_text(&mut self, text: renderer::text::Section<'_, Self::Font>) {
fn fill_text(&mut self, text: Text<'_, Self::Font>) {
self.primitives.push(Primitive::Text {
content: text.content.to_string(),
bounds: text.bounds,