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

HTML style tags with embedded fonts

New Here ,
Jul 01, 2009 Jul 01, 2009

Copy link to clipboard

Copied

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.

TOPICS
Text layout framework

Views

6.7K

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
Guest
Jul 01, 2009 Jul 01, 2009

Copy link to clipboard

Copied

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???

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 ,
Jul 01, 2009 Jul 01, 2009

Copy link to clipboard

Copied

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

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
Jul 02, 2009 Jul 02, 2009

Copy link to clipboard

Copied

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.)

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
New Here ,
Jul 03, 2009 Jul 03, 2009

Copy link to clipboard

Copied

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.

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
Jul 03, 2009 Jul 03, 2009

Copy link to clipboard

Copied

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

Abhishek

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
New Here ,
Jul 03, 2009 Jul 03, 2009

Copy link to clipboard

Copied

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(

      ^

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
Jul 03, 2009 Jul 03, 2009

Copy link to clipboard

Copied

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

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
New Here ,
Jul 03, 2009 Jul 03, 2009

Copy link to clipboard

Copied

Ok. I used sdk 3.2.

I don't know if I can upgrade the sdk version in my current project but thank you for solving the issue.

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
Explorer ,
Jul 17, 2009 Jul 17, 2009

Copy link to clipboard

Copied

You're saying the issue is solved, and it says at the top that the question is answered; but I don't see the solution... I have the same problem: I'm trying to use embedded fonts with TextFlow and controllers, and it's just not working. I'm using embedAsCFF: true, and the font does show up in spark controls, including RichText with the TextFlow. BUT, if I use TextFlow with ContainerController (similar to what you have, Lulu), it refuses to show up (always seems to use the Times New Roman font).

Anyone has a working example of TextFlow with controllers using embedded fonts? My example is similar to Lulu's, but it's just not working... I tried the today's (8654) build too. Please help!

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
Jul 20, 2009 Jul 20, 2009

Copy link to clipboard

Copied

Hi,

I've attached a simple example which works for me.

Abhishek

(Adobe Systems Inc.)

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
Jul 20, 2009 Jul 20, 2009

Copy link to clipboard

Copied

[Attach didn't work: copying here]

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()" >
    <mx:Script>
        <![CDATA[

            import flash.display.Sprite;
            import flashx.textLayout.elements.TextFlow;
            import flashx.textLayout.conversion.TextConverter;
            import flashx.textLayout.container.ContainerController;
               
            // may need to use embedAsCFF instead of cff depending upon your Flex Gumbo SKD version
            [Embed(source='C:/WINDOWS/Fonts/BirchStd.otf', cff='true', fontFamily='_BirchStdFull')]
            private const _birchStdFullFont:Class;

            static private const simpleText:String = "<TextFlow xmlns='http://ns.adobe.com/textLayout/2008' fontFamily='_BirchStdFull' fontLookup='embeddedCFF' fontSize='30'>Hello, World!</TextFlow>";
           
            private function init():void
            {
                _container = new Sprite();
                textArea.rawChildren.addChild(_container);

                _textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
                _textFlow.flowComposer.addController(new ContainerController(_container, textArea.width, textArea.height));                   
                _textFlow.flowComposer.updateAllControllers();
            }

            private var _textFlow:TextFlow = null;
            private var _container:Sprite = null;

        ]]>
    </mx:Script>
    <mx:VBox >
        <mx:Canvas id="textArea" width="100" height="100"/>
    </mx:VBox>
</mx:Application>

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
Explorer ,
Jul 20, 2009 Jul 20, 2009

Copy link to clipboard

Copied

Thanks Abhishek, but it has the same behavior that I'm seeing. I.e., regardless of what font you specify, it always shows what appears to be Times. Try with different fonts and check.

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
Jul 20, 2009 Jul 20, 2009

Copy link to clipboard

Copied

Ok, I tried build 8654 (I was previously on the Beta1 build) and font embedding doesn't work for me either. I'll check if this is a known regression. Thanks for reporting it.

Abhishek

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
Explorer ,
Jul 20, 2009 Jul 20, 2009

Copy link to clipboard

Copied

Thanks, I just tried beta1, and yes - embedding works! I guess that's a workaround for me for now. Had to change back to cff: true of course, but also use TextFilter instead of TextConverter. Is it going to be TextConverter, going forward?

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
Jul 21, 2009 Jul 21, 2009

Copy link to clipboard

Copied

The bug has been logged. See http://bugs.adobe.com/jira/browse/SDK-22325, which also outlines a workaround (not using RSLs).

Abhishek

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
Explorer ,
Jul 21, 2009 Jul 21, 2009

Copy link to clipboard

Copied

Thanks very much Abhishek for figuring this out and logging it. I think TLF is amazing and has enormous potential. FYI, I just created a blog (thanks for pointing out about Beta 1) on TextFlow, check it out at Flex 4: Threaded Text Using TextFlow.

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
New Here ,
Jul 24, 2009 Jul 24, 2009

Copy link to clipboard

Copied

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.

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 ,
Jul 24, 2009 Jul 24, 2009

Copy link to clipboard

Copied

What does your font embed code look like?

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
New Here ,
Jul 24, 2009 Jul 24, 2009

Copy link to clipboard

Copied

LATEST

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.

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