Spectraljump
Spectraljump

Reputation: 4637

Embedding fonts: "Font with plain weight and style was not found at..."

I am trying to embed a font in my Flash Builder 4.6 project, so far unsuccessful. I searched around and found this fix, adding "-managers flash.fonts.AFEFontManager" to the Compiler, doesn't work. I've embedded tons of images to the same project, but I'm not sure what's going on with the embedding of fonts.

I get this error:

Multiple markers at this line:

-unable to build font 'Chinese Rocks Rg'

-exception during transcoding: Font for alias 'Chinese Rocks Rg' with plain weight and style was not found at: file:/E:/StarlingIntro - >Finished/src/../assets/textures/chinese_rocks_rg.otf

-Unable to transcode ../assets/textures/chinese_rocks_rg.otf.

For the following code:

    [Embed(source="../assets/textures/chinese_rocks_rg.otf", fontName="Chinese Rocks Rg", fontWeight="normal", advancedAntiAliasing="true", embedAsCFF=false, mimeType = "application/x-font")] 
    public var ChineseRocks_FontClass:Class;
    public var chineseRocks_textFromat:TextFormat = new TextFormat("Chinese Rocks Rg");

What do they mean was not found? It's the same path as everything else I've embedded. Does it mean that it's expecting a certain "style" from the .otf file? Wut?

Thanks for any info on this!

PS: it gives the same error for other fonts as well, for example MyriadWebPro.ttf.

[EDIT]

Okay, here's what's going on. I am using this embed code right now:

[Embed(source="chinese_rocks_rg.otf", //yes, it's in my src folder because I'm paranoid 
            fontName = "myChineseRocks", 
            mimeType = "application/x-font", 
            fontWeight="normal", 
            fontStyle="normal", 
            unicodeRange="englishRange", 
            advancedAntiAliasing="true" 

    )]//embedAsCFF="false"

I have commented out the embedAsCFF, because I tried it with the -managers=flash.fonts.AFEFontManager compiler parameter. None of the two work.

This is in Flash Builder 4.6, using Flex SDK 4.6.0. Now, if I switch to Flex SDK 3.6.0, the error seems to go away, but I can't use 3.6.0 since I'm using the Starling Stage3D framework.

Is it possible that stuff changed from 4.0 to 4.6, and now your article, Divillysausages, (which really illuminated me btw) doesn't apply to it?

[EDIT2]

I solved it! With the help of Divillysausages and his patience :).

Basically, I was completely stupid. I had a "#" and 2x" ` "s in the actual path to my project. I KNEW having those dumb folder names would screw my stuff up some day! And sure enough it did -with Java, but I moved Eclipse out of there a long time ago and forgot about it.

Anyway, I moved the flash project to a more friendly directory and included the embedAsCFF="false" and it worked. Also, having -managers=flash.fonts.AFEFontManager in your compiler arguments or not, seems to not matter.

Upvotes: 3

Views: 6432

Answers (3)

Deyan Vitanov
Deyan Vitanov

Reputation: 784

I had the same issue embeding .otf font to starling project. Resolved it by converting the otf file to ttf

Good luck

Upvotes: 0

Thomas
Thomas

Reputation: 251

Be sure you are not overwriting the default flex config file. If you need some config property append them in Additionnal compiler arguments : -load-config+=configFile.xml rather than -load-config configFile.xml It solve our trouble

Upvotes: 0

divillysausages
divillysausages

Reputation: 8033

fontWeight="regular", doesn't exist. You're probably looking for fontWeight="normal" (or "bold", or "heavy")

Basically what your error is telling you that in the font you're trying to load, it couldn't find the weight "regular", so it can't be embedded.

I wrote this a while ago to explain font embedding, it might help: http://divillysausages.com/blog/as3_font_embedding_masterclass

Upvotes: 4

Related Questions