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




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…”
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.
@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. :-)
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.
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.
thank you! It helped a lot on my project.
Thank you for the solution. I totally see why this is happening now – not that it should!!!
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
@Erik, I’m very happy this helped.
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!!!!
@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.
Thank you, so much.
<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>