-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
Add font fallback support, just like what windows does. #182
Comments
That would be useful. Things to take into account: a) It could be part of the font baking itself, that would be the simplest. Bake glyphs for XXX.ttf, use fallback from YYY.ttf b) It could be a initialisation pass of creating fall-back glyphs across fonts in a same atlas. I'll have to think about it. What sort of use case are you thinking of? (in term of desired symbols/languages) |
Actually I want this function is because TTF font is blurred and builtin font is clear,so I want use TTF font to render Chinese and builtin font to render English. I's like to add some methods like |
I think don't change the api,you can dynamicly add item to IndexLookup vector when some glyph not be found in current font. |
Will do that at some point, but it's not a high priority. |
The AA branch now support this with the new ImFontConfig* settings. Merge three fonts: io.Fonts->AddFontDefault();
// Add character ranges and merge into main font
ImWchar ranges[] = { 0xf000, 0xf3ff, 0 };
ImFontConfig config;
config.MergeMode = true;
io.Fonts->AddFontFromFileTTF("fontawesome-webfont.ttf", 16.0f, &config, ranges);
io.Fonts->AddFontFromFileTTF("myfontfile.ttf", 15.0f, &config, io.Fonts->GetGlyphRangesJapanese()); |
This is now merged in master along with the entire new AA-branch. Note that it is a rather big update and you'll need to update your render function to use indexed vertex rendering. |
Very thanks for your great work. |
When rendering text, if a glyph is not found in current font, try the other fonts.
The text was updated successfully, but these errors were encountered: