feat: add fill_raw method and Raw associated type for text::Renderer

This commit is contained in:
pml68 2025-05-25 21:08:31 +02:00 committed by Héctor Ramón Jiménez
parent 6bbe189809
commit b26890f76e
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
7 changed files with 49 additions and 4 deletions

View file

@ -65,7 +65,7 @@ use crate::core::renderer;
use crate::core::{
Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation,
};
use crate::graphics::text::{Editor, Paragraph};
use crate::graphics::text::{Editor, Paragraph, Raw};
use crate::graphics::{Shell, Viewport};
/// A [`wgpu`] graphics renderer for [`iced`].
@ -717,6 +717,7 @@ impl core::text::Renderer for Renderer {
type Font = Font;
type Paragraph = Paragraph;
type Editor = Editor;
type Raw = Raw;
const ICON_FONT: Font = Font::with_name("Iced-Icons");
const CHECKMARK_ICON: char = '\u{f00c}';
@ -760,6 +761,11 @@ impl core::text::Renderer for Renderer {
layer.draw_editor(editor, position, color, clip_bounds, transformation);
}
fn fill_raw(&mut self, raw: Self::Raw) {
let (layer, transformation) = self.layers.current_mut();
layer.draw_raw(raw, transformation);
}
fn fill_text(
&mut self,
text: core::Text,