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

+1
View File
@@ -10,3 +10,4 @@ image = { workspace = true }
parley = { workspace = true }
swash = { workspace = true }
fxhash = { workspace = true }
log = { workspace = true }
+11 -1
View File
@@ -76,10 +76,20 @@ impl GlyphAtlas {
let w = image.placement.width;
let h = image.placement.height;
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);
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);
return None;
}