-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when character has an glyph index but the glyph cannot be loaded #15
Comments
Hi! Thank you! Nice catch! |
It looks like there a some bug in FreeType version < 2.11. I've updated github build actions and AppVeyor scripts to use a fresh FreeType version. The last release works good so far. |
Just tested it on my dev machine running Debian Bullseye and sadly it still crashes because the executable is dynamically linked to freetype (confirmed with I guess I'll use my patched version for now, but the question whether should we make a workaround (by using my patch or something other) or not is still open. What do you think? |
Sorry for late. I come back to this issue from time to time, but I can't figure out how to fix it better yet. I don't want to just hide the error (because users expect correct fonts in the output). Also, I'm not sure if we should use static linking of the fresh freetype lib. |
No worries, I've just examined it for a hobby project so there's no any time pressure at all. |
Greetings! First of all, thanks for making this wonderful tool. I'm experiencing a crash when trying to render a font with some characters that exist in the font but for some reason cannot be loaded.
The following font file reproduces the issue for me - Hack-Regular.ttf. A sample char range that leads to crashing is 8300-8400. The message is 'Load glyph error'.
Here's what happens - isGlyphProvided reports true, then renderGlyph throws an exception because of
FT_Load_Char
failure.For some reason shrinking the range towards the offending character sometimes fixes the issue, which makes me think that there could be a side effect from loading specific glyphs that affects the ones that are loaded afterwards. But it's just a speculation, I'm not very familiar with freetype internals so I may be way off. Since I'm using an autogenerated chars file shrinking the range is not an option for me (and there's no way of cleaning up the file without knowing which characters are offending).
TL;DR: Replacing
FT_Get_Char_Index
withFT_Load_Char
(like inrenderGlyph
) fixes the issue, skipping the offending character (having incomplete font is better than no font, right?). I'll send a PR with this solution soon.The text was updated successfully, but these errors were encountered: