Skip to content
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

FONS_GLYPH_BITMAP_OPTIONAL doesn't inhibit FT_LOAD in fons__tt_buildGlyphBitmap #643

Open
mulle-nat opened this issue Aug 4, 2022 · 0 comments

Comments

@mulle-nat
Copy link
Contributor

nanovg uses the FONS_GLYPH_BITMAP_OPTIONAL flag in various places to avoid the creation of superflous font atlas entries for glyphs. The actual glyph information is queried by fons__tt_buildGlyphBitmap , which always uses FT_LOAD_RENDER to render a (then unneeded) bitmap though. This is probably expensive and could be avoided, by passing an extra parameter to fons__tt_buildGlyphBitmap, telling FreeType not to.

fontstash.h:

	ftError = FT_Load_Glyph(font->font, glyph, FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_LIGHT);
	if (ftError) return 0;

The same should be done for stb_truetype (or could be harmlessly ignored, if not supported there).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant