HTML style tags with embedded fonts
lulu moriss Jul 1, 2009 2:20 AMHi,
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.



