summaryrefslogtreecommitdiff
path: root/src/graphics/font.rs
diff options
context:
space:
mode:
authorTengu712 <genreihoutengu@gmail.com>2026-10-07 00:57:01 +0900
committerTengu712 <genreihoutengu@gmail.com>2026-10-07 00:57:01 +0900
commit3bbe5ebcdb2a5aa6810dd05576c6ec031efdc1c7 (patch)
tree844e4ba5efc755dabf091a51178937a93e1d47ed /src/graphics/font.rs
parent503486e2ce889858aac619985516374bddeb7a8f (diff)
render imageHEADmain
Diffstat (limited to 'src/graphics/font.rs')
-rw-r--r--src/graphics/font.rs10
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);
}