Warn when glyphs cannot fit the atlas

This commit is contained in:
iris committed 2026-09-13 03:28:10 -04:00
1 parent 2026e5d088
commit 80b28fff1a
4 files changed
+14 -1

No files matched your search

Generated
+1
View File
@@ -1189,6 +1189,7 @@ dependencies = [
"bytemuck", "bytemuck",
"fxhash", "fxhash",
"image", "image",
"log",
"parley", "parley",
"swash", "swash",
"wgpu", "wgpu",
+1
View File
@@ -35,6 +35,7 @@ image = "0.25.6"
parley = "0.11.1" parley = "0.11.1"
swash = "0.2.10" swash = "0.2.10"
fxhash = "0.2.1" fxhash = "0.2.1"
log = "0.4.29"
arboard = "3.6.1" arboard = "3.6.1"
iris-core = { path = "core" } iris-core = { path = "core" }
iris-macro = { path = "macro" } iris-macro = { path = "macro" }
+1
View File
@@ -10,3 +10,4 @@ image = { workspace = true }
parley = { workspace = true } parley = { workspace = true }
swash = { workspace = true } swash = { workspace = true }
fxhash = { workspace = true } fxhash = { workspace = true }
log = { workspace = true }
+11 -1
View File
@@ -76,10 +76,20 @@ impl GlyphAtlas {
let w = image.placement.width; let w = image.placement.width;
let h = image.placement.height; let h = image.placement.height;
if w == 0 || h == 0 { if w == 0 || h == 0 {
log::warn!(
"glyph {} in font {} rasterized at {w}x{h}; skipping it",
key.glyph,
key.font,
);
self.entries.insert(key, None); self.entries.insert(key, None);
return None; return None;
} }
if w + PAD * 2 > PAGE || h + PAD * 2 > PAGE { if w > PAGE - PAD * 2 || h > PAGE - PAD * 2 {
log::warn!(
"glyph {} in font {} rasterized at {w}x{h}, too large for the {PAGE}x{PAGE} atlas; skipping it",
key.glyph,
key.font,
);
self.entries.insert(key, None); self.entries.insert(key, None);
return None; return None;
} }