Skip to main content
Participant
Nov 12, 2009 5:18 PM UTC
Question

How can I embed arabic Font in Flash?

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?

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

Participant
Dec 25, 2011 5:48 AM UTC

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

Message was edited by: arabicode

Translate
Participating Frequently
Dec 2, 2011 2:21 AM UTC

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.

Translate
JF Software
Inspiring
Dec 1, 2011 9:55 AM UTC

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.

Translate
Adobe Employee
Dec 1, 2011 10:02 AM UTC
JF Software
Inspiring
Dec 1, 2011 10:07 AM UTC

Doesn't help me at all, no.

Translate