0
votes

I am running into issues displaying Thai characters in Flex components that make use of the Flash Text Engine (FTE), specifically on Mac OSX 10.6.8 Snow Leopard.

Here's a blurb of my compiler font managers in flex-config.xml:

<flex-config>

    <target-player>10.2.0</target-player>

    <!-- Specifies the version of the compiled SWF -->
    <swf-version>11</swf-version>

    <compiler>
      <!-- Specifies the locales for internationalization. -->
      <locale>
          <locale-element>en_US</locale-element>
      </locale>

      <fonts>
          <!-- ... -->
          <!-- Compiler font manager classes, in policy resolution order-->
          <managers>
              <manager-class>flash.fonts.JREFontManager</manager-class>
              <manager-class>flash.fonts.BatikFontManager</manager-class>
              <manager-class>flash.fonts.AFEFontManager</manager-class>
              <manager-class>flash.fonts.CFFFontManager</manager-class>
          </managers>
      <!-- ... -->
        </fonts>
    </compiler>
</flex-config>

...and another from flash-unicode-table.xml:

<language-range>
    <lang>Thai</lang>
    <range>U+0E01-0E5B</range>
</language-range>

My flex application originally had the following defined in its stylesheet:

Application {
    fontSize: 12px;
    fontFamily: Arial;
    font-sharpness:0;
    font-anti-alias-type:advanced;
}

Thai characters render correctly in mx components such as TextField so far. However, FTE components such as TextLine show those crappy-looking boxes as a substitution. My initial guess was that somehow one of the compiler font managers declared in flex-config.xml was not finding the right system font to fallback to for Thai characters. So, I ensured the system font was installed by going to System Preferences > Language and Text > Edit List. Then I changed fontFamily to Arial, Ayuthaya. Still was seeing the boxes of evil.

Next I figured that perhaps the Arial font might be assigning a box for each unicode value corresponding to a Thai character. So it was effectively overriding the Ayuthaya system font. So I changed fontFamily once more to just Ayuthaya and this worked with one issue - Ayuthaya looks inherently different from Arial for non-thai characters.

Here's my question - is there a less invasive way to support Thai in FTE components such that the appearance of the text is closer to the Arial font? I would rather not embed a font because I'm constrained on SWF size.

1
I ended up setting this style dynamically based on locale settings in my flex app. I'm fine with the font not exactly matching Arial for a particular locale. Don't think this is a real answer though - I believe there should be a way to fall back to some other font that supports Thai glyphs if Arial cannot display them properly :P.P4ndaman

1 Answers

0
votes

Looks like choosing font based on locale is the correct approach according to Adobe. Here's a reply to my post on their forums:

"Legacy text field (mx component) use font fall back and just happened working fine for you before but wasn't necessarily as supported style like algorithmic fall back. FTE as professional text layout framework is more strict about font selection. In short you have to select appropriate font per your expected script's region. Arial is not simply right choice for Thai character. Please try something like Angsana or Jasmine or anythig supporting Thai script."

Works for me :P