Thursday, September 1, 2011

Font embedding Flex 4.5 (actionscript 3)


After working for a few hours on a brand new all customizable slideshow I'm developing for a website, I decided I wanted to embed some fonts into my code.
This is easy stuff, but my friends, there's a catch, reading around the internet I found there might be a bug with the transcoder.
The embedding code is the following
[Embed(source='assets/My Font.ttf',
fontName='myFont',
embedAsCFF='true'
)]
private var MyFont :Class;
Then you just have to use
textFormatter.font = myFont;
Last, but not least, in order for the transcoder to work nicely you will have to add the following lines into the flex-config under the compiler tag


<fonts>

  <managers>

     <manager-class>flash.fonts.AFEFontManager</manager-class>

     <manager-class>flash.fonts.BatikFontManager</manager-class>

     <manager-class>flash.fonts.JREFontManager</manager-class>

  </managers>

</fonts>


The actual font manager that's working is the AFEFontManager, so that's the one we want on the top. Though I read somewhere that some people managed to get it to work by changing the managers position on the list.

Don't forget to use


myTextField.embedFonts = true;

Another thing, I've seen that not all the fonts work, usually ttf will work but not always though. If anyone can explain me why is that it would be great.

Monday, August 29, 2011

I updated my profile (and some other stuff)

I haven't been blogging for a long time, and I don't actually know why am I starting again... I guess it's entertaining.
Anyhow I'm following a weird path of learning right now which consists on a mix of the Pythons Pyramid project and some AS3 developing I'm doing. Nothing good can come out of this. I'm gonna share soon some of my experience cos maybe someone is interested in following the ways of the voodoo maaaan.