awayfl / playerglobal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AwayFL chooses the wrong font when there are multiple fonts with the same name and style

n0samu opened this issue · comments

commented

This problem affects multiple Flipline games, including Cupcakeria and the Papa Louie platformers.

  • For dynamic/HTML text fields: AwayFL uses the last copy of the specified font to render the characters. So if that font is missing characters, they will not appear in the text field.
  • For static text fields: AwayFL seems to calculate character indices using the specified font, but then take the glyphs at those indices from the last copy of the font. So the wrong characters can appear, or nothing can appear at all.

Here is an SWF that minimally reproduces the issue: fontTest.zip

Here is how it looks in Flash Player:
image

And here is how it looks in AwayFL:
image

Some details:

  • Fonts 1 and 3 are two different copies of the same font with the same name and style, but different sets of characters.
  • The text field in the top-left has character ID 2, which is between font 1 and font 3. It uses font 1 and appears correctly in AwayFL, since AwayFL hasn't processed font 3 yet.
  • Once AwayFL processes font 3, AwayFL starts using font 3 to register the rest of the text fields, even though they explicitly say to use font 1.
  • Text field 8, to the right of text field 2, is identical to text field 2, but since it's processed after font 3, AwayFL tries to render it using font 3. Yet it uses character indices generated from font 1 to choose the characters in font 3 to render with.
    • The original (correct) characters in the text field are !!! $ 012
    • Indexed into font 1 (excluding the spaces), that's 1,1,1, 4, 16,17,18
    • In font 3, those indices become !!! 0 DEF
  • The same thing happens with text field 5, except that the characters in EMPTY SLOT correspond to nonexistent indices in font 3, so nothing at all shows up.
  • Text fields 4 and 7 are HTML EditText, which seem to have a slightly different problem in AwayFL. Like with the static text fields, AwayFL uses font 3 to render them even though it specifies font 1. But this time AwayFL also indexes the characters using font 3, so it doesn't choose the wrong characters. Instead, any characters that don't exist in font 3 simply don't appear, while those that do appear correctly. So 0 Empty Slot becomes 0 E S because the lowercase letters don't exist in font 3.