Skip to main content
Participant
November 2, 2009
Question

Quick Embedded Fonts Question

  • November 2, 2009
  • 1 reply
  • 1265 views

For some reason I can't seem to get any embedded fonts to show up.  Can anyone explain why the following doesn't work?

Using the newest Flash Builder.

Thanks!

-Dave

<?xml version="1.0" encoding="utf-8"?>
<mx:Application initialize="init();" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" >
    <fx:Style>
         @11220649-face {
               src: url("assets/arial.ttf");
               fontFamily: "Arial";
               embedAsCFF: true;
             }               
    </fx:Style>
    <fx:Script>
      <![CDATA[
            import flashx.textLayout.container.ContainerController;
            import flashx.textLayout.conversion.TextConverter;
            import flashx.textLayout.elements.TextFlow;
            import flash.text.engine.FontLookup;
            import flash.text.engine.RenderingMode;
            import mx.core.UIComponent;
    
            private var textFlow:TextFlow;
             private var textHolder:UIComponent = new UIComponent();
            private var sprite:Sprite = new Sprite();
                                    
            private function init():void
            {   
                  var theText : String = '<TextFlow xmlns="http://ns.adobe.com/textLayout/2008" fontFamily="Arial" fontSize="100">Some Text Here</TextFlow>';
                  textFlow = TextConverter.importToFlow(theText, TextConverter.TEXT_LAYOUT_FORMAT);
                  textFlow.fontLookup = FontLookup.EMBEDDED_CFF;
                  textFlow.renderingMode = RenderingMode.CFF;
                  textFlow.flowComposer.addController(new ContainerController(sprite, 500,500));
                  textHolder.addChild(sprite);
                  addChild(textHolder);
                  textFlow.flowComposer.updateAllControllers();
             }
          ]]>
    </fx:Script>
</mx:Application>

This topic has been closed for replies.

1 reply

Inspiring
November 4, 2009

How do you know its not being embedded?  Is the text sans-serif?

d-pizzleAuthor
Participant
November 4, 2009

Yeah, doesnt matter the font, always shows default font.  Well I think I got it sorted.  The above code works fine if I select Framework Linkage: Merged Into Code under project properties.  No clue why this is, if someone can explain why it works this way, i'd love to know.

Thanks

-Dave

Inspiring
November 4, 2009

Wow...I posted hoping to help you out, and you actually helped me out on an issue I was having!

Thanks so much!