Skip to main content
Participant
July 1, 2009
Question

HTML style tags with embedded fonts

  • July 1, 2009
  • 4 replies
  • 7160 views

Hi,

I've written the following class :

[Code]

public class Main extends Sprite

{

    [Embed(source="../bin/assets/fonts/Arial.ttf", fontName="fontArial", mimeType="application/x-font")]

    public var arial:Class;

    [Embed(source="../bin/assets/fonts/Arial Italic.ttf", fontName="fontArial", mimeType="application/x-font", fontStyle="italic")]

    public var arialItalic:Class;

    [Embed(source="../bin/assets/fonts/Arial Bold.ttf", fontName="fontArial", mimeType="application/x-font", fontWeight="bold")]

    public var arialBold:Class;

    [Embed(source="../bin/assets/fonts/Arial Bold Italic.ttf", fontName="fontArial", mimeType="application/x-font", fontWeight="bold", fontStyle="italic")]

    public var arialBoldItalic:Class;

    public function Main( )

    {

        stage.scaleMode = StageScaleMode.NO_SCALE;

        stage.align = StageAlign.TOP_LEFT;

       

        var markup:String = "<p>Pour une prise en charge plus rapide. La procedure de synchronisation des boites mails peut dans certains cas ne pas avoir fonctionne comme nous l'esperions. S'offrent a vous 2 methodes de synchronisation : l'une via un client IMAP evolue, votre ancien compte mail etant temporairement accessible en IMAP sur le serveur imap2-g25.free.fr. (Cf Tutoriel) <b>retenter la synchronisation via nos outils en cochant</b> <i> la case ci-dessous avant de valider</i> : (patientez ensuite quelques instants afin d'obtenir le resultat de la synchronisation. Vous beneficiez du remplacement ou de la remise en etat (aux normes Constructeur) des organes reconnus defectueux (main d’œuvre comprise) (1).</p><p>Le chef du gouvernement italien Silvio Berlusconi a annule sa visite prevue aujourd'hui au sommet de l'Union Africaine (UA) a Syrte en Libye, selon un communique de la presidence du Conseil. M. Berlusconi a hier soir au telephone avec le dirigeant</p>";

        var textFlow:TextFlow = TextFilter.importToFlow(markup, TextFilter.HTML_FORMAT);

        textFlow.fontSize = 11;

        textFlow.fontFamily = "fontArial";

        textFlow.fontLookup = FontLookup.EMBEDDED_CFF;

        textFlow.renderingMode = RenderingMode.CFF;

        var container1:Sprite = new Sprite( );

       var controller1:ContainerController = new ContainerController(container1, stage.stageWidth / 2 - 30, 150);

        textFlow.flowComposer.addController(controller1);

        addChild(container1);

        var container2:Sprite = new Sprite( );

        container2.y = 160;

        var controller2:ContainerController = new ContainerController(container2, stage.stageWidth, 100);

        var format2:TextLayoutFormat = new TextLayoutFormat();

        format2.columnCount = 2;

        controller2.format = format2;

        textFlow.flowComposer.addController(controller2);

        addChild(container2);

        textFlow.flowComposer.updateAllControllers();

    }

}[/Code]

It displays a textflow in two containers.

In the source text, I set a bold and an italic HTML tags.

With the system fonts, everything is ok but when I embed the arial font, the styles are not observed anymore.

Is anyone can help me ?

Thanks. lulu.

This topic has been closed for replies.

4 replies

Participating Frequently
July 24, 2009

Hi, I am using Flex 3.2 and textlayout_framework_p1_111808 in my project.

I migrated to textlayout_framework_455 to use external css using CSSFormatResolver but not

able to use embedded fonts in TLF. Please suggest.

Adobe Employee
July 24, 2009

What does your font embed code look like?

Participating Frequently
July 25, 2009

Actually I am not sure about embedding fonts in tlf using CSSFormatResolver

so I wanted to confirm if there is any way or I go for Flex 4.

Participating Frequently
July 3, 2009

Sorry, I used the old name for this transcoding parameter. 'cff' is now called 'embedAsCFF'.

Abhishek

Participant
July 3, 2009

Same error :

/Users/pierigp/Documents/untemps/WORK/textLayout/src/Main.as(39): col: 7: Error: transcoding parameter 'embedAsCFF' is not supported by 'flex2.compiler.media.FontTranscoder'

    [Embed(

      ^

Participating Frequently
July 3, 2009

Which Flex SDK build are you using? cff became embedAsCFF in build 7972.

Participant
July 3, 2009

Thank you for your reply.

I saw I have to set cff to true in my font declaration but I get the following error :

/Users/pierigp/Documents/untemps/WORK/textLayout/src/Main.as(18): col: 4: Error: transcoding parameter 'cff' is not supported by 'flex2.compiler.media.FontTranscoder'

[Embed(

   ^

Is it a sdk version issue ? Do I have to upgrade it ?

lulu.

July 1, 2009

bumpity bump, same issue - noobody has a solution, havent heard anything back from anyone from adobe. time is money, and I wasted a lot of time on this..a lot.

  Can't they just admit this is a bug and there is no solution so I can move on to other issues???

Adobe Employee
July 2, 2009

Hi,

Most folks, including me, are out of the office this on holiday this week.

Check out this blog post on font embedding and creating the new DefineFont4 font format.

http://blogs.adobe.com/tlf/2008/11/

Apologies for the delayed response.

Regards,

Richard

Participating Frequently
July 2, 2009

Lulu,

I noticed that your Embed declarations do not have cff='true'. Could you try with cff='true'?

Prabug,

From the messages you posted on various forums, it seems that you are using the classic TextField, not the new Text Layout Framework (TLF). As far as I know, the TextField supports font embedded using DefineFont3 whereas TLF uses DefineFont4, so I am not sure that your issue is the same as Lulu's. I hope someone on the other forums is able to address your issue; this forum only deals with TLF.

Abhishek

(Adobe Systems Inc.)