more test stuff

This commit is contained in:
2025-08-28 01:52:00 -04:00
parent 28935e33e9
commit d7d67e4ed3
3 changed files with 17 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
use cosmic_text::{Attrs, Buffer, FontSystem, Metrics, Shaping, SwashCache};
use cosmic_text::{Attrs, Buffer, Family, FontSystem, Metrics, Shaping, SwashCache};
use image::{Rgba, RgbaImage};
use crate::{
@@ -25,6 +25,7 @@ pub struct TextAttrs {
pub color: UiColor,
pub size: f32,
pub line_height: f32,
pub family: Family<'static>,
}
pub type TextBuffer = Buffer;
@@ -36,12 +37,12 @@ impl Default for TextAttrs {
color: UiColor::WHITE,
size,
line_height: size * 1.2,
family: Family::SansSerif,
}
}
}
impl TextData {
/// returns (handle, offset from top left)
pub fn draw(
&mut self,
buffer: &mut TextBuffer,
@@ -56,7 +57,7 @@ impl TextData {
buffer.set_text(
&mut self.font_system,
content,
&Attrs::new(),
&Attrs::new().family(attrs.family),
Shaping::Advanced,
);
let mut pixels = HashMap::new();