• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Italic and Bold fonts don't work if loaded dynamically

Engaged ,
Nov 25, 2017 Nov 25, 2017

Copy link to clipboard

Copied

Hi,

Until now, I was using embedded fonts, and sucessfully used the <b> and <i> html tags. Indeed, while embedding the fonts, I was able to set the font style, while still using the same font name. Like this:

[Embed(source="../EmbeddedAssets/BKANT.ttf", fontName="Book Antiqua", mimeType="application/x-font-truetype", embedAsCFF="false")]

public var Font1:Class;

     

[Embed(source="../EmbeddedAssets/ANTQUAB.ttf", fontName="Book Antiqua", fontWeight = "bold", mimeType="application/x-font-truetype", embedAsCFF="false")]

public var Font2:Class;

     

[Embed(source="../EmbeddedAssets/ANTQUABI.ttf", fontName="Book Antiqua", fontStyle = "italic", mimeType="application/x-font-truetype", embedAsCFF="false")]

public var Font3:Class;

But now I need to load those fonts dynamically instead. The fonts are embedded in a SWF file. I can get their class and register them successfully, but when I enumerate them, I get:

Book Antiqua

Book Antiqua Bold

Book Antiqua Italic

As you can see, when loaded dynamically, each font has its own unique name, so the regular <b> or <i> html tags don't work any longer. I could specify the exact font face in the html code, like "<font face='Book Antiqua Bold'>" (and it works), but I'd rather use the standard <i> or <b> tags for versatilty. Is there a way to fix this and be able to use those tags with a dynamically loaded font?

Thank you!

TOPICS
Development

Views

694

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Nov 27, 2017 Nov 27, 2017

Copy link to clipboard

Copied

Which platform are you talking about? Used <b> and <i> with what kind of class? You are leaving out all the information needed to help you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 27, 2017 Nov 27, 2017

Copy link to clipboard

Copied

Hmm, indeed, I forgot some important elements, sorry.

What I mean is that I display an HTML text using a TextField. If all the font variants (regular, bold and italic) are imbedded via code, like described in my first post, <b> and <i> html tags work correctly in the TextField. But if, instead of embedding the fonts, I load an external SWF file containing them, then RegisterFont() those font classes, the Italic and Bold variants have their distinctive names, and the <i> and <b> tags don't work any longer (only the standard font is found by AIR and used).

If think it is due to the fact that in the embed code solution, you can specify the same font name for all variants. On the other hand, when you load the fonts from an external SWF, each variant gets a different name, and AIR can't know they belong to the same font family.

AIR versions 27 and 28 beta do the same thing.

I hope it is clearer now. Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Dec 01, 2017 Dec 01, 2017

Copy link to clipboard

Copied

Hi,

Could you please help us with a sample application with which we can reproduce this issue at our end.

You can email me directly at prakaskuATadobeDOTcom

Thanks

Prakash Kumar

Adobe AIR Team

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 01, 2017 Dec 01, 2017

Copy link to clipboard

Copied

LATEST

Thank you Prakash, I just sent you some samples that illustrate that issue clearly. Please tell me if you didn't receive it.

Thank you for your support!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines