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

How can I embed arabic Font in Flash?

New Here ,
Nov 12, 2009 Nov 12, 2009

Copy link to clipboard

Copied

I want to use various Arabic Fonts in Flash. I using AS3 and the textLayout.swc with the FDT in Eclipse. And compiling with the Flex SDK 4.0.0. The Compiler-Arguments are
-default-size 780 260 -default-frame-rate 31 -static-link-runtime-shared-libraries=true -managers=flash.fonts.AFEFontManager -default-background-color 0xFFFFFF -library-path {flexSDK}/frameworks/locale/en_US --target-player=10.0.32

I try this:

Embed the Arabic Font in a Font-Class
    [Embed(source='../../../../assets/fonts/AXTGIB__.TTF', fontName='AXtGIhaneBold', mimeType="application/x-font", embedAsCFF="true")]
    public var AXtGIhaneBold : Class;
 
public function Fonts() {
  Font.registerFont(AXtGIhaneBold);
}

Create a TextFlowElement and do this:


    textFlow = new TextFlow();
   
    layoutFmt = new TextLayoutFormat();
    layoutFmt.direction = Direction.RTL;
    layoutFmt.fontFamily = "AXtGIhaneBold";
    layoutFmt.renderingMode = RenderingMode.CFF;
    layoutFmt.fontLookup = FontLookup.EMBEDDED_CFF;
   
    textFlow.format = layoutFmt;

But it doesn't work. The Font in Flash don't change to AXtGIhaneBold.
Can anyone tell me what's wrong?

TOPICS
Text layout framework

Views

4.3K

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 ,
Dec 01, 2011 Dec 01, 2011

Copy link to clipboard

Copied

I have the same problem with a number of different Arabic fonts (including the one you're trying). A call to .hasGlyphs() returns false for any roman string.

Let me know if you stumble on an answer.

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 ,
Dec 01, 2011 Dec 01, 2011

Copy link to clipboard

Copied

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 ,
Dec 01, 2011 Dec 01, 2011

Copy link to clipboard

Copied

Doesn't help me at all, no.

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 ,
Dec 01, 2011 Dec 01, 2011

Copy link to clipboard

Copied

My flex-config <languages/> node is commented out, and looks like this:

<!-- Defines ranges that can be used across multiple font-face declarations. -->

          <!-- See flash-unicode-table.xml for more examples. -->

          <!-- not set -->

          <!--

          <languages>

              <language-range>

                  <lang>englishRange</lang>

                  <range>U+0020-007E</range>

              </language-range>

          </languages>

          -->

Does this node being commented out mean all characters are embedded, or is there a default range?

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 ,
Dec 01, 2011 Dec 01, 2011

Copy link to clipboard

Copied

hi frankie*,

Please try this, there are some difference with your code: 

http://actionscriptexamples.com/2008/11/24/embedding-fonts-in-flash-cs4-using-actionscript/ 

// ActionScript 3.0

[Embed(source="assets/ARIAL.TTF", fontFamily="ArialEmbedded")]

var ArialEmbedded:Class;

var arialEmbeddedFont:Font = new ArialEmbedded();  

var textFormat:TextFormat = new TextFormat();

textFormat.color = 0xFF0000;

textFormat.font = arialEmbeddedFont.fontName;

textFormat.size = 32; 


var textField:TextField = new TextField();

textField.autoSize = TextFieldAutoSize.LEFT;

textField.wordWrap = true;

textField.defaultTextFormat = textFormat;

textField.embedFonts = true;

textField.text = "The quick brown fox jumps over the lazy dog.";

textField.width = 500;

textField.x = 25;

textField.y = 25;

addChild(textField);


Hope it helps.

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 ,
Dec 24, 2011 Dec 24, 2011

Copy link to clipboard

Copied

LATEST

FlarabyAS3 is much simpler and lighter that TLF:  http://www.arabicode.com/flarabyas3/main

Message was edited by: arabicode

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