I have a string containing characters from different languages, for which I'd like to pick a single font (among the registered fonts) that has glyphs for all these characters. I would like to avoid a situation where different substrings in the string are printed using different fonts, if I already have one font that can display all these glyphs.
If there's no such single font, I would still like to pick a minimal set of fonts that covers
the characters in my string. I'm aware of
FontSelector, but it doesn't seem to try to find a minimal set of fonts for the given text.
I see two questions in one:
Is there a font that contains all characters for all languages?
Allow me to explain why this is impossible:
65,535 is much smaller that 1,114,112, which means that it is technically impossible to have a single font that contains all possible glyphs.
FontSelector doesn't find a minimal set of fonts!
FontSelector doesn't look for a minimal set of fonts.
You have to tell
FontSelector which fonts you want to use and in which order! Suppose that you have this code:
FontSelector selector = new FontSelector(); selector.addFont(font1); selector.addFont(font2); selector.addFont(font3);
In this case,
FontSelector will first look at
font1 for each specific glyph.
If it's not there, it will look at
font3 will have different glyphs for the same character in common.
For instance: a, a and a. Which glyph will be used depends on the order in which you added the font.
Select a wide range of fonts that cover all the glyphs you need and add them to a
Don't expect to find one single font that contains all the glyphs you need.