Archive for the ‘fonts’ Category

Flash Flex Font Fudging

Tuesday, October 21st, 2008

Yesterday I spent quite a while trying to get some fonts to display correctly in a Flex Actionscript project. The method I normally use is the one I outlined in this post. This method is good because it allows you to embed only the characters you need and has always worked. Except yesterday.

The main difference as far as I could tell was that I was mixing Flex components and Actionscript text fields. The font was displaying in the Flex, but not the Actionscript. I had embedded the font using Flex’s CSS, so I thought maybe it wasn’t being passed over to the flash, so I embedded the font using the method above as well. Still no joy. I then removed the font completely from the Flex, in case it was screwing things up. Again, nothing. At this point I was getting pretty frustrated, as you could imagine. I went back over the Embedding Fonts technote and noticed that it said that only Truetype or bitmap fonts were supported. So I checked the font type. Sure enough, it was Truetype. About an hour later I decided to reinstall the font in case it was corrupted (it was showing fine in the Flex and in the Flash IDE, so I thought it unlikely). When I looked at the actual file in finder, it had the extension .dfont, which apparently is a datafork truetype font. Make no mistake, this is not supported by Actionscript.

So, in the end I installed a simple Truetype version and it worked straight off. No embedding needed in the Actionscript, just the CSS. I haven’t tried out the new font engine in Flex 4/Flash Player 10, but I really, really hope it doesn’t make you jump through quite so many hoops to display some text right.