Issues with embeding fonts for Buttons in Flex

April 1st, 2008 . by polygeek

Sometimes I feel that I suffer so that the rest of you don’t have to. When I run across one of those maddening, “but this should work” issues I always try to blog about it so that you - the reader - won’t have to suffer as I have. And I have, suffered greatly today. :-)

View Source

Here to the right we have two nearly identical Flex projects. The only difference is that the one on bottom has one line commented out of the CSS: fontWeight: normal;

It turns out that if you want to embed the font for a <mx:Button> you need to set the fontWeight. Yeah, it took me about 2 hours of trial and error to fix it. What really got me was that the embedding worked fine for the <mx:TextArea> all along. Go figure.

That’s it. So why does the fontWeight have to be “normal” in order for the <mx:Button> to get it’s embeded font? In the immortal words of Kyle Reese, “I don’t know. I didn’t build the fucking thing!”

Seriously, why does there have to be a declaration that the fontWeight has to be normal? Isn’t that the default? And yes, changing it to bold breaks it.

Perhaps I’m missing something. Perhaps the Flex team isn’t out to confuse and confound me on a daily basis. If so please enlighten me in the comments. Until then I’m just going to assume that Deepa did this just to drive me mad. Mad I say. Mad, mad, MAD! :-)

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Digg
  • Facebook

6 Responses to “Issues with embeding fonts for Buttons in Flex”

  1. comment number 1 by: JesterXL

    http://jessewarden.com/2006/07/flex-chronicles-22-embedding-fonts-in-a-button.html

    Rashem malfup… “ge-ge-ge-get ya ass tu Mahrs… ge-ge-ge-get ya ass tu Mahrs…. ge-ge-ge-get ya ass tu Mahrs…”

  2. comment number 2 by: Dave G

    It’s probably because you didn’t embed a bold font, and the default fontWeight style of a Button is bold. So even though you specified “myDefaultFont” as the fontFamily, since you don’t have that in bold, it reverted to the default font in order to honor the default fontWeight style. For some reason the fontWeight style is given precedence over the fontFamily.


  3. writing the code for the previous post I ran into a problem: my browser kept crashing when I’d publish my Flex project. All that was …

  4. comment number 4 by: polygeek

    @JesterXL, damn you and your blog. If you’re blog had come up higher in the search results I might have saved myself a few hours pain! That’s it. You’re fired!

    Seriously, thanks - and you to Dave G - for the explanation. I just knew that it didn’t work. You guys know why it doesn’t work. That Is why I am grasshopper. :-)

  5. comment number 5 by: Raid

    Same issue with As2. If you want to use a bold embeded font you probably need to embed it :P

    As far as I know its the same for italic.

  6. comment number 6 by: Dominic

    Argh! I had the same problem! Thanks so much for publishing the solution. Had a heck of a time figuring out why this was, but at least being specific totally worked.

Leave a Reply

Name

Mail (never published)

Website

- Why ask? This confirms you are a human user!

   




© Copyright 2008 polyGeek.com / Dan Florio, All Rights Reserved Except Where Explicitly Stated
Web Developement Blogs - Blog Catalog Blog Directory
M2 Websites