Wednesday, July 13, 2011

Embedding fonts with Flash CS5


Let me start this little technical treat by first saying I hate the Flash IDE. If you are reading this article and you use the Flash IDE one very quick solution to all of your problems is to simply stop using it. Go and buy Flash Builder or for an even cheaper price get FDT. Both of those applications are built on Eclipse and are a much better more intuitive development environment.

That said I do realize that you are already too deep down the rabbit hole on your current project, or perhaps you work on a team that uses the Flash IDE or are picking up the broken pieces of another developers project.

Ok enough trash talk. In general adding a text field in Flash and clicking the embed fonts button associated with that text field is by far a great tried and true method of confidently embedding fonts. But that is not really all the powerful for developing anything more then a simple add banner or splash screen. The real power of Actionscript and text is dynamically generated content i.e. private var tf:TextField = new TextField();. For these types of text fields embedding fonts becomes a bit more involved.

The methods that Flash has historical used to embed fonts has changed a bit over the last several versions. With CS5 once again they have made additional “advancements”, which I assume are to help unleash the power of Flash’s text engine. I have sat at work for hours reading over users “best practices for embedding fonts with CS5”. Everyone seems to have a little something different they do. And even within those examples the end goal is very scattered. One might be for css, or textFormat, or to support html tags in xml. Either way its a big fact searching expedition with very mixed information. Well yesterday I went on this mission again for a team project I am working on where out of the blue several fonts for some magical reason stopped embedding. I stumbled across this blog post (http://www.dotstrosity.net/2010/05/10/flash-cs5-font-embedding-its-totally-different/) on the subject I and spotted a very interesting comment. One person noted that depending on what font management application you are using the font name that appears in the Font Embedding window may be completely wrong. At work I am on a Macbook Pro and use Suitcase Fusion 3 to manage my fonts. (I assume this little bit of misdirection is much more common on the mac.) This possibility had never occurred to me and got me thinking, “why don’t I just ask Flash what font it would like me to use”. So using traditional Flash “add text field” methods I used the ole tool bar, grabbed a text box and set that text field up with all the font features I wanted in my embed. Hold onto your seat because this is where the wonderment comes in. I added this code:

var objFormat:TextFormat = myTextField.getTextFormat();

trace(objFormat.font);

This trace will return the exact “real” name of the font that is being used regardless of whatever made up version your font management software is communicating to the IDE. Now all you have to do is copy that name and use it in your, xml, html, css, or textFormat.

Sunday, July 10, 2011

I like to draw letters


I like to draw letters. “How come you never seem to post any?” you ask. Well somewhere between putting pencil to paper and time spent on the computer they just never seem to make it. I am not an illustrator by trade so going through the arduous task of scanning paper into the computer and digitizing hand drawn type into vector is just too many steps for me. Somewhere between the sketch and computer the wind falls quite abruptly from my sails.

Well this year for my birthday I decided to treat myself with a new digital drawing tool, the Wacom Bamboo Pen to be exact. Nothing too crazy, rather just their most basic small digital sketch tool. While Wacom does make some pretty serious multi-hundred dollar illustration tools I really just wanted something to do very basic blue lines that I could go in later with a mouse and refine.

Multi-platform Installation? Absolutely, I am on a mac at work and pc’s at home and installation was pretty straightforward. Oddly for being a “creative” tool installation on the pc was a bit easier.

Transition? If you are thinking about adding this tool to your box I will say it takes some getting used to drawing with your hand and looking someplace completely different.

Final word? I have no idea, I just got it but so far I am very happy with the speed at which i can flush out an idea from rough to black line.

Stay tuned and with any luck and practice I can turn the “final word” into some letters!

(I am very tired after a long weekend of traveling so I really hope this article is readable)