mooman219 / fontdue

The fastest font renderer in the world, written in pure rust.
Apache License 2.0
1.44k stars 72 forks source link

Newline showing up as missing character #117

Closed lunabunn closed 2 years ago

lunabunn commented 2 years ago

Using the layout API, newlines are showing up as missing characters with some fonts: unknown Is the user code expected to special-case \n when rendering?

A couple of fonts with this issue:

lunabunn commented 2 years ago

"Fixed" by checking CharacterData::rasterize() before rendering a given glyph. Is this the intended way to handle this?

mooman219 commented 2 years ago

Yes that's intentional. Layout produces the position of all characters you pass in, and it's up to you on if you want to render. I added CharacterData::rasterize() as an easier method to test if you want to render that glyph in the general case. Some fonts have glpyh data for whitespace like new lines and spaces that you may want to display.