Author Topic: Selecting a font depending on the character set of a string?  (Read 2960 times)

mcarriere

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 25
    • View Profile
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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Selecting a font depending on the character set of a string?
« Reply #1 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;