Embedding fonts without the transcode error

Here’s one I struggled with for the better part of an afternoon and for an hour in the morning. I got things working though.

Point of order number one: the magic solution came from this page:

http://www.flexfreaks.com/forums/viewtopic.php?id=96

from which I quote:

go to your project properties (right-click on your project would be easiest), then go to “Flex Compiler”, then under “Additional compiler arguments:” add “-managers flash.fonts.AFEFontManager”.

Next, here’s my stylesheet. Notice that I created only one fontFamily, but pointed the different weights to different TTF files:

.standardLabelText
{
	embedFonts: true;
	fontSize:12px;
	fontFamily:embedDanna;
	fontWeight: normal;
}

Button, ComboBox
{
	embedFonts: true;
	fontSize: 10px;
	fontWeight: bold;
	fontFamily: embedDanna;
}

@font-face
{
    src: url("fonts/verdana.ttf");
    fontFamily: "embedDanna";
    fontWeight: normal;
    fontStyle: normal;
}

@font-face
{
    src: url("fonts/verdanab.ttf");
    fontFamily: "embedDanna";
    fontWeight: bold;
    fontStyle: normal;
}

I was then able to use states and transformations, and the labels on the HBox I was targeting no longer hung there grinning like Cheshire cats.

As an aside, let me ask you – why does it make sense to make a developer jump through hoops to learn how to accomplish this kind of thing? You’d kind of hope that Flex would be smart enough to send you an alert or error message or email or tweet that said “Hmmm, looks like you’re trying to transform a font that’s not embedded. I can help you with that.”

Leave a Reply

You must be logged in to post a comment.

handy stuff i’d like to remember