0

So - I have this weird problem.

I have a major project, no details needed except that it is split to many SWFs, and so - I would like to use a Shared Library to embed the fonts. Done - sl_fonts.swf loaded, fonts - checked and working, the rest of the SWFs are loaded AFTER (checked by a preloader).

Now - again, I traced the result of the request to the font, it is all like

DEBUG: REQUEST ArialBlack RETURN [class EMArialBlack] (main.swf)
DEBUG: GOT [class EMArialBlack] (loaded.swf)

The loaded SWF file requested for ArialBlack and it seems that it got an answer - EMArialBlack, which is the embedded font's class.

The weird thing is that when I put this return to a TextFormat's .font, it does not really work. I even traced the TextFormat.font after setting it to the return. It actually traced [class EMArialBlack]. BUT when I set this TextFormat to a TextField it does not work? If embedFonts is off, it has no result (it keeps the old _sans placeholder font). If it is on, no text is shown at all.

Any ideas why this is happening?

Aurel Bílý
  • 7,068
  • 1
  • 21
  • 34

1 Answers1

0

.font = string value (font name)

var format1:TextFormat = new TextFormat();
format1.font="Arial";
format1.size=12;
var result:TextField = new TextField();
result.embedFonts=true;
result.antiAliasType=AntiAliasType.ADVANCED;
result.text="This text uses a gridFitType of " + tl;
result.setTextFormat(fm);

alt text

tomato
  • 96
  • 2
  • 13
  • Oh, I haven't noticed that it its a string. Thanks... But then there is another problem. I need to get a String ID of my font class. Unfortunately, the string ID was not "EMArialBlack" as I would expect... So I looped through the available fonts using Font.enumerateDeviceFonts(false) which basically tells me the IDs of embedded fonts, because they don't need to be registered. I found that it is registered under "Arial Black" - and changing anything in the Font Embedding menu could not change it. I tried to use "EMArialBlack", "ArialBlack", "Arial Black" - but none of those worked... Ideas? – Aurel Bílý Sep 01 '10 at 11:31
  • the name is the name you write in the library in the flash ide. right click->properties – tomato Sep 01 '10 at 11:47
  • It is set to EMArialBlack, the name as well as the ActionScript class. But it does not work - I tried "EMArialBlack", "ArialBlack" and "Arial Black" as the .font parameter, but still does not work. I tried WITH and WITHOUT .embedFonts set to true. – Aurel Bílý Sep 01 '10 at 12:03
  • you can see at the picture the name is in font properties and you should use .fontembed – tomato Sep 06 '10 at 10:45
  • Spent a day trying to fix a font problem in a project - forgot to do myTextField.embedFonts = true; why isn't that set to true by default? – Olin Kirkland Jan 29 '16 at 14:53