Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: mcarriere on June 14, 2013, 12:56:02 PM

Title: Selecting a font depending on the character set of a string?
Post by: mcarriere on June 14, 2013, 12:56:02 PM
Searched around and could not find something for this.

I have a font that supports most languages, but doesn't have support for kanji, arabic, and a few other languages. Is there a way to detect whether or not a font supports a certain set of characters? I want to generally keep our main font in the game for aesthetics, and only switch out to other dynamic fonts for labels when it's required.
Title: Re: Selecting a font depending on the character set of a string?
Post by: ArenMook on June 14, 2013, 05:02:33 PM
Automatically? Nope. You have to add support for that by modifying UIFont. Every time you see mDynamicFont.GetCharacterInfo, instead of just 'continue' write your own code.

That's for dynamic fonts. For bitmap fonts you'd modify this part instead:
  1. BMGlyph glyph = mFont.GetGlyph(c);
  2. if (glyph == null) continue;