Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-34197

Text Layout Framework: change embedded fontFamily works in AIR doesn't work in FLEX(WEB)



      i have a sample code, if you run it as an AIR windowedApplication it works, if you run it as a web page (s:Application) it doesn't.
      I have AIR 3.8 and flex 4.6.0
      The problem is the embedded font: in desktop application i can see the text changes in the textarea using TLF, in web it falls in the default font, but the font is there, since the other textarea displays it, so the problem seems to be the TLF.... but i can't understand what is wrong in the code.

      the following is the code for AIR desktop application, to test the problem just create a web application for flashplayer and replace windowedApplication with Application in the code
      (you'll need also to have TopSecret.ttf, or another ttf font changing the referenced name accordingly in the code, in the main folder):

      <?xml version="1.0" encoding="utf-8"?>
      <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
      import flashx.textLayout.formats.TextLayoutFormat;
      import mx.events.FlexEvent;
      import spark.events.IndexChangeEvent;
      protected function fontDDL_changeHandler(event:IndexChangeEvent):void

      { var txtLayFmt:TextLayoutFormat = dynamicArea.getFormatOfRange(null, dynamicArea.selectionAnchorPosition, dynamicArea.selectionActivePosition); txtLayFmt.fontFamily = fontDDL.selectedItem; dynamicArea.setFormatOfRange(txtLayFmt, dynamicArea.selectionAnchorPosition, dynamicArea.selectionActivePosition); }

      @namespace s library://ns.adobe.com/flex/spark;
      @namespace mx library://ns.adobe.com/flex/mx;

      { src: url(TopSecret.ttf); fontFamily: TopSecret; embedAsCFF:true; }

      <s:TextArea text="this is a font Arial Text" fontFamily="Arial"/>
      <s:TextArea text="this is a font TopSecret" fontFamily="TopSecret"/>
      <s:TextArea id="dynamicArea" text="select this text and change font"/>
      <s:DropDownList id="fontDDL" width="150" change="fontDDL_changeHandler(event);">
      <s:ArrayList id="fontList" source="[TopSecret, Arial, Courier New, Times, Verdana]" />




            • Assignee:
              mamsellem Maurice Amsellem
              diblasid Dudda
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: