Font Embedding Woes

d4rklit3's Avatar


30 Sep, 2011 06:43 PM

I have built a rather handy framework on top of RL to make facebook apps and stuff like that. I have recently overhauled the way I embed text from a swc to loading a swf at runtime that embeds a .ttf through a meta tag.

The run down of how the text gets made is as follows:
model is created and parses out text nodes from xml into a TextVO class. the TextVO class is passed into a static Text class that builds a the textfield and textformat from the values in the textvo and returns a TextField or Sprite.

The Problem:
Here is a screen shot with what is happening to my text

what appears to be happening here is that the text is moving up past the top margin of the text field.

Why I think RL has something to do with this:
I have unit tested this exact code in a different project and it was fine. using the exact same loading methods. I am kind of at a loss here. Maybe some1 else has experienced this?

  1. Support Staff 1 Posted by Stray on 30 Sep, 2011 08:18 PM

    Stray's Avatar

    I'm afraid I don't have an answer, except that unit testing for fonts isn't really going to be robust - I tend to find that font problems show up as a result of N different things.

    It's almost impossible for this to relate in any way to Robotlegs - I know it looks as though Robotlegs does magic, but actually it just uses the describeType information for classes, normal stage events and some clever factories. There's no byte weaving or non-conventional programming going on.

    I've had numerous headaches with using fonts in this way - most frequently caused by having a code-generated dynamic TextField with the same font as a 'drawn on stage' TextField that embeds the font using the TextField properties. Some fonts can tolerate this, others can't. Why? I have no idea...

    We also find that loading swfs in parallel rather than in series allows us to use some fonts that otherwise corrupt when we load the same swfs in series. Why? I have no idea...

    So - I'd look elsewhere for the source of the problem, but if you do find it, please please share your answer because I've never actually diagnosed these issues properly, only found (by trial and error) specific workarounds that happen to fix them.

    But... if anyone else knows any different on RL and fonts, please do wade in!


  2. 2 Posted by d4rklit3 on 30 Sep, 2011 08:38 PM

    d4rklit3's Avatar

    I solved this issue and now i feel like a jerk for implying that RL was somehow responsible. As it turns out the problem was that i was trying to embed the fonts before the swf was loaded. But aside from that the text vo model works quite well.

  3. Ondina D.F. closed this discussion on 01 Nov, 2011 04:31 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac