rename a bit

This commit is contained in:
2025-08-28 22:21:43 -04:00
parent 97f2f67dee
commit 3df76d926c
10 changed files with 34 additions and 31 deletions

View File

@@ -9,9 +9,9 @@ pub struct Text {
}
impl Text {
pub fn size(mut self, size: impl UiNum) -> Self {
self.attrs.size = size.to_f32();
self.attrs.line_height = self.attrs.size * 1.1;
pub fn font_size(mut self, size: impl UiNum) -> Self {
self.attrs.font_size = size.to_f32();
self.attrs.line_height = self.attrs.font_size * 1.1;
self
}
pub fn color(mut self, color: UiColor) -> Self {
@@ -41,7 +41,7 @@ impl Widget for Text {
// reuse TextureHandle
}
fn size(&mut self, ctx: &mut SizeCtx) -> Vec2 {
fn get_size(&mut self, ctx: &mut SizeCtx) -> Vec2 {
let (handle, offset) =
ctx.text
.draw(&mut self.buf, &self.content, &self.attrs, ctx.textures);
@@ -53,7 +53,7 @@ pub fn text(text: impl Into<String>) -> Text {
let attrs = TextAttrs::default();
Text {
content: text.into(),
buf: TextBuffer::new_empty(Metrics::new(attrs.size, attrs.line_height)),
buf: TextBuffer::new_empty(Metrics::new(attrs.font_size, attrs.line_height)),
attrs,
}
}