glyph-brush
glyph-brush copied to clipboard
Glyphs taller than font.ascent are clipped
https://github.com/alexheretic/ab-glyph/issues/50 font CooperHewitt-Book.otf glyphs clip outside of font ascender/descender vbounds. This means the top line (for default layout) glyphs may clip too.
This can be fixed by using the font line_gap
as top-padding for the first line, essentially shifting down the glyphs of all fonts with non-zero line_gap
values.
I'm unsure if this is the "correct" thing to do though. It's possible the font itself is wrong instead?
Looking at this font in gimp, it seems to "fix" the layout on the fly using the render bounds. That's not something glyph-brush-layout can do so easily as we calculate all glyph positions without outlining the glyphs.
https://user-images.githubusercontent.com/2331607/146226954-66613e65-9124-4799-9de4-e7b7b143bb0d.mp4
This does also suggest that using line_gap as top-padding isn't correct :disappointed:
A workaround is to give the sections with this font some extra margin at the top.
However, depending on the to_vertex
fn implementation, glyph bound clipping may need to also be disabled. (This is not specified by glyph-brush itself, though the opengl example does clip glyphs.