diff options
Diffstat (limited to 'src/graphics/font.rs')
| -rw-r--r-- | src/graphics/font.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/graphics/font.rs b/src/graphics/font.rs index c20e691..88163cc 100644 --- a/src/graphics/font.rs +++ b/src/graphics/font.rs @@ -1,7 +1,7 @@ use super::texture::TextureWrapper; use ab_glyph::*; use etagere::{AllocId, AtlasAllocator}; -use glam::Vec4; +use glam::Vec2; use lru::LruCache; use std::sync::LazyLock; use ttf_parser::{ @@ -103,7 +103,8 @@ pub struct CharInfo { pub height: f32, pub x_offset: f32, pub y_offset: f32, - pub uv: Vec4, + pub uv_offset: Vec2, + pub uv_size: Vec2, } pub struct CharAtlas { @@ -236,12 +237,11 @@ impl CharAtlas { height: height / self.scale_factor, x_offset: rasterized.x_offset / self.scale_factor, y_offset: rasterized.y_offset / self.scale_factor, - uv: Vec4::new( + uv_offset: Vec2::new( (allocated.rectangle.min.x as f32 + MARGIN as f32) / self.width, (allocated.rectangle.min.y as f32 + MARGIN as f32) / self.height, - width / self.width, - height / self.height, ), + uv_size: Vec2::new(width / self.width, height / self.height), }; self.registereds.push((c, scale.to_bits()), info); } |
