Subscribe to RSS
get email updates
home | about | pixDif AIR app | video tutorials
polyGeek.com

Register for 360Flex in DC using the ad below and you will automatically be entered in a drawing for a free ticket. Read more.
place your ad here

Web Premium





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! :-)

If something here has proved valuable to you then feel free to drop a couple of bucks in the tip-jar.

Post to Twitter Post to Delicious Post to Facebook Post to Reddit Post to StumbleUpon


similar posts

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


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…”

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.


[...] 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 [...]

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. :-)

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.

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.

comment number 7 by: Dan L.

thank you! It helped a lot on my project.


[...] earlier today. It simply wasn’t working, even if i had the font embedded correctly. I happened upon this blog post, which shares… that for buttons you MUST have font weight set to normal. If the font [...]

comment number 9 by: David

Thank you for the solution. I totally see why this is happening now – not that it should!!!

comment number 10 by: Erik van der Neut

Dude!!! Thank you soooo much! I was going crazy on this one!!

Addeding "fontWeight: normal;" indeed fixed this, even though that line should not be necessary. I can't believe you figured this out….

THANK YOU!

Erik

comment number 11 by: polygeek

@Erik, I’m very happy this helped.

comment number 12 by: jsquared90

Dude. You are so right when you say that people such as yourself save peopl like myself from hours of hair pulling. You should be loudly commended for your efforts. If I was with you right now, I'd buy you a beer or 2, because you just lowered my stress level today with this find.

I would like to add that the same bug exists for other components like Panel Title Bar and VBox titles within the ACcordian component.

Thanks for this discovery!!!!

comment number 13 by: polygeek

@jsquared90, Damn, where’s that donate button when I need one?!?! :)

I’m so glad that I helped out. Many other bloggers have done the same for me. I’m glad I can pitch in a bit here and there.

comment number 14 by: Nathan Colgate

Thank you, so much.

comment number 15 by: Erik van der Neut

<FONT FACE=”Courier New” COLOR=”#0033CC” >Dude!!! Thank you soooo much! I was going crazy on this one!!</FONT>

<FONT FACE=”Courier New” COLOR=”#0033CC” ></FONT>

<FONT FACE=”Courier New” COLOR=”#0033CC” >Addeding "fontWeight: normal;" indeed fixed this, even though that line should not be necessary. I can't believe you figured this out….</FONT>

<FONT FACE=”Courier New” COLOR=”#0033CC” ></FONT>

<FONT FACE=”Courier New” COLOR=”#0033CC” >THANK YOU!</FONT>

<FONT FACE=”Courier New” COLOR=”#0033CC” ></FONT>

<FONT FACE=”Courier New” COLOR=”#0033CC” >Erik</FONT>

   Welcome back (Change)

Leave a Reply

comment feed RSS   subscribe to this comment thread

Recent Posts

   



polyGeek.com

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

Better Tag Cloud