fallback fonts
foen opened this issue · comments
easy way to set multiple fonts as fallback for missing characters. or is this already possible but missing something ?
I'm also interested in this. It appears that it isn't possible.
However, I think it could be made possible. FC_Font could have a pointer added to another FC_Font* to be used in the case that a codepoint cannot be found in the font. If it is found in that font then use that glyph, else keep going down the linked list until you hit NULL.
@grimfang4 do you think this is possible/wise, and are you happy for me to take a crack at this?
I think it's certainly possible and wouldn't harm the interface at all, while providing some functionality that would need a significant workaround otherwise. I'd say go for it and we'll work it in.
I've gotten something working. A major problem is that TTF_GlyphIsProvided takes a Uint16 as an arg, slicing up the top 16 bits of a code point. A workaround to that is to use FT_Get_Char_Index() - which SDL_TTF calls internally and accepts a 32 bit codepoint. However this is causing linking issues on my end
If we can find a "is_codepoint_in_this_font(uint32 codepoint)" then this will be good to go
Another update: I posted on the SDL forums, in the next SDL_TTF patch it'll have 32 bit codepoint support:
Thread:
https://discourse.libsdl.org/t/sdl-tff-utf8-codepoint-checking/26751/2
Relevent Code:
https://hg.libsdl.org/SDL_ttf/rev/ae83a705f5ab