diff options
Diffstat (limited to 'graphics/src')
-rw-r--r-- | graphics/src/text.rs | 5 | ||||
-rw-r--r-- | graphics/src/text/paragraph.rs | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/graphics/src/text.rs b/graphics/src/text.rs index ca3fc6fc..7694ff1f 100644 --- a/graphics/src/text.rs +++ b/graphics/src/text.rs @@ -14,10 +14,9 @@ use crate::core::font::{self, Font}; use crate::core::text::{Shaping, Wrapping}; use crate::core::{Color, Pixels, Point, Rectangle, Size, Transformation}; -use once_cell::sync::OnceCell; use std::borrow::Cow; use std::collections::HashSet; -use std::sync::{Arc, RwLock, Weak}; +use std::sync::{Arc, OnceLock, RwLock, Weak}; /// A text primitive. #[derive(Debug, Clone, PartialEq)] @@ -157,7 +156,7 @@ pub const FIRA_SANS_REGULAR: &[u8] = /// Returns the global [`FontSystem`]. pub fn font_system() -> &'static RwLock<FontSystem> { - static FONT_SYSTEM: OnceCell<RwLock<FontSystem>> = OnceCell::new(); + static FONT_SYSTEM: OnceLock<RwLock<FontSystem>> = OnceLock::new(); FONT_SYSTEM.get_or_init(|| { RwLock::new(FontSystem { diff --git a/graphics/src/text/paragraph.rs b/graphics/src/text/paragraph.rs index 07ddbb82..48c8e9e6 100644 --- a/graphics/src/text/paragraph.rs +++ b/graphics/src/text/paragraph.rs @@ -80,6 +80,8 @@ impl core::text::Paragraph for Paragraph { Some(text.bounds.height), ); + buffer.set_wrap(font_system.raw(), text::to_wrap(text.wrapping)); + buffer.set_text( font_system.raw(), text.content, @@ -122,6 +124,8 @@ impl core::text::Paragraph for Paragraph { Some(text.bounds.height), ); + buffer.set_wrap(font_system.raw(), text::to_wrap(text.wrapping)); + buffer.set_rich_text( font_system.raw(), text.content.iter().enumerate().map(|(i, span)| { |