awayfl / playerglobal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic text not rendering for single lines when using bold or italic fonts

rob-bateman opened this issue · comments

Description
When setting up a single line dynamic textfield or input field, setting the font type to bold, italic or bold italic causes the text to disappear

Platform
All

Steps to reproduce the issue
Steps to reproduce the behavior:

  1. Create an swf with a single line text field on the stage and write some text into the field
  2. Set the type of text to dynamic or input
  3. Set the style to bold, italic or bold italic and ensure the font chosen is embedded
  4. Run in AwayFL

Expected outcome
The textfield with its containing text appears

Actual outcome
No text is displayed

i think what happens is this:

for some reason, some textfields get stroed in swf as html-enabled textfields even when they are not set to html in the Animate IDE.

This allows swf to store the textformat-properties as part of the html-string. <p font="someFont" fontSize="12>sometext

`

Now when we try to set text dynamically via myTextField.text="someNewText" it no longer has the correct TextFormat information that was provided by the html-string.

The fix will probably be to process the html on aprsing time, and extract the textformat for later use.

This is also a bit more compilcated than anticipated.

Needs a refactor of Font in order to get this solved.

In AwayJS we store a Font with a list of Font-styles.

In FP, a Font does not have a list of FontStyles. each FontStyle comes as a sepperate Font-object.

This makes for differences in how Fonts can be accessed via name.

I will need to refactor this, so that our approach matches the FP appraoch more closly, but i am still unsure how to handle switching between fontstyles of the same font when fontstyles are not grouped by font.

btw: the description of the issue isnt very accurate.

Its not the singleline vs multiline thats causing the fonts to disappear. it is rather dynamically changing of the textfield.text which causes issues with some fonts / fontstyles.