0 Replies Latest reply on Mar 22, 2010 1:29 PM by arithma

    Embed OTF Font as CFF in Pure Actionscript Project using Flex SDK 4.0

    arithma

      I want to apply the method explained here: http://www.insideria.com/2009/03/flash-text-engine.html using only the Flex SDK 4 (not using FlashBuilder)

      Specifically:

      Embedding fonts can be tricky. In Flex, embed the font and store it using DefineFont4 and font subsetting currently only supported by Gumbo. A future version of Flash will support it but in the meantime, a Gumbo SWC with the embedded font must be created then adding to your Flash CS4 project.

       

      The following is the method I am using to embed the fonts.

      public class Main extends Sprite {
           [Embed(source="../assets/GE Thameen DemiBold.otf",
                                    fontFamily = "GE Thameen",
                                    fontWeight = "bold",
                                    mimeType = "application/x-font",
                                    embedAsCFF = "true"
                                    )]
           private const GEThameen:Class;
      ....
      

       


      The following command line was assimilated after solving the output error messages using google and a little looking into how FlashDevelop works..

      mxmlc Main.as -load-config config.xml -managers flash.fonts.AFEFontManager
      

       

      The output SWF is not working as supposed, and the file size (20KB) does not seem to account for the embedded font. PS: When the font embedding is bypassed, and a device font is used for the text engine classes, the file works perfectly.

       

      The contents of config.xml are as the following:

      <?xml version="1.0" encoding="utf-8"?>
      <!--This Adobe Flex compiler configuration file was generated by a tool.-->
      <!--Any modifications you make may be lost.-->
      <flex-config>
        <target-player>10.0.0</target-player>
        <compiler>
          <source-path append="true">
            <path-element>E:\actionscript</path-element>
          </source-path>
          <external-library-path>
              <path-element>C:\bin\flex_sdk_4\frameworks\libs\player\10.0\playerglobal.swc</path-element>
              <path-element>C:\bin\flex_sdk_4\frameworks\libs\flex.swc</path-element>
          </external-library-path>
        </compiler>
        <file-specs>
        </file-specs>
        <default-background-color>#FFFFFF</default-background-color>
        <default-frame-rate>30</default-frame-rate>
        <default-size>
          <width>800</width>
          <height>600</height>
        </default-size>
      </flex-config>