diff --git a/Cargo.lock b/Cargo.lock index bb8c683..fac8718 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1189,6 +1189,7 @@ dependencies = [ "bytemuck", "fxhash", "image", + "log", "parley", "swash", "wgpu", diff --git a/Cargo.toml b/Cargo.toml index ff8527e..313ed68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,7 @@ image = "0.25.6" parley = "0.11.1" swash = "0.2.10" fxhash = "0.2.1" +log = "0.4.29" arboard = "3.6.1" iris-core = { path = "core" } iris-macro = { path = "macro" } diff --git a/core/Cargo.toml b/core/Cargo.toml index 6002fd4..2e399ad 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -10,3 +10,4 @@ image = { workspace = true } parley = { workspace = true } swash = { workspace = true } fxhash = { workspace = true } +log = { workspace = true } diff --git a/core/src/render/atlas.rs b/core/src/render/atlas.rs index a193427..dc0d1de 100644 --- a/core/src/render/atlas.rs +++ b/core/src/render/atlas.rs @@ -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; }