Embedding Irregular Fonts in Flex 3

Often in programming, what seems to be a simple task can trip you up. Yesterday I was trying to embed the font Helvetic Neue LT Com Bold 77 in a css style sheet for a project of ours. After about 20 minutes of trying different methods to get the project to compile without any errors, I came across the following method:It turns out that with a font like the Bold 77, The typeface is already bold, so there is no need to put the fontStyle:Bold directive in the css declaration. In fact, since 77 bold already contains no bold style, and declaring it as such will throw an error. 

Font Book on mac is a great app. Using the app’s ability to intropect on the font, you can see all of the information in each font on your computer. The most important information you can get out of Font Book is the full font name attribute. The key here is to embed the full font name attribute in the flex application. Just like this:

@font-face
{
     src: url(‘path/to/embed.swf’);
     fontFamily:”Helvetic Neue LT Com Bold 77″;

The important thing here is that if you arre unsure of what font faces are included in any particular font, just use the full font name alone, and dont mess with anything else. 

For Flex Builder 3 apps, we like to use the Flash Embed method of getting the font transcoded into the Flex App. The resulting file size is much lower. Just be sure to embed only the characters that you are going to need, and not the entire set.

About Curious Minds
We are a web development firm in New York and Chicago, providing development resources and consulting for websites and mobile apps since 2004.