Embedded fonts in flash with the same fontName property

I use an external swf containing several font classes to download and register fonts for my flash site at runtime. (exported to the Flash IDE library panel, then registered in the script frame)

In this particular case, swf contains several different weights of the same family. eg. roman font, italic font, font, heavy font, etc.

Fonts look fine, but when I try to use fonts, some fontName properties of these fonts are identical. Three appear as Roman, and two as light, and the light is bright. So I went looking for stupid coding errors, but to my horror, I did not find it. The correct font objects loaded in the correct order.

After a little testing, I checked the fonts folder (vista). When I opened the file for Heavy, the title in the font viewer shows Roman; the headers in the font viewer matched what I got in flash. This behavior seems unique to this font.

Since fontName is the only way I know how to assign a TextField font, I am stumped about how I can use this lovely heavy font for my dynamic headers!

This is a type 1 font.

Can anyone suggest a reason, solution, or workaround?

+1
flash fonts actionscript-3 embedding
source share
2 answers

Thank you, I think your right to do so.

However, I found a way to insert the font and set the name.

First of all, I used CrossFont to convert a PostScript Type 1 font to .otf

Using the [embed ()] function, which is now available in cs4, I was able to use the fontFamily attribute to set the fontName property of the embedded font.

In the code below, you can see that I set the name to "BlaaDeeBlaa" and TextFormat will accept it and display the inline font.

[Embed(source="assets/FontFileName.otf", fontFamily="BlaaDeeBlaa", mimeType="application/x-font")] var BlaaDeeBlaa:Class; var CH:Font = new BlaaDeeBlaa(); var testTxt:TextField = new TextField(); testTxt.defaultTextFormat = new TextFormat("BlaaDeeBlaa",28,0x000000,true); testTxt.embedFonts = true; testTxt.text = Font.enumerateFonts(false)[0].fontName; testTxt.autoSize = "left"; addChild(testTxt); 

nb With this method, you can only embed OpenType (.OTF) and Truetype (.TTF)

I was placed in this technique by Lee Brimlowes Tutorial in gotoandlearn

+3
source share

It seems that the font problem is more likely related to your software (Flash).

If this is a free font, it is possible that the author of the font family used one font as a base and edited copies of it for different face styles. Perhaps they just changed the file name and forgot to change the internal name.

You may be editing names in some way, but I'm not so sure.

0
source share

All Articles