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?
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.
Copy link to clipboard
Copied
Hope the blog can help you. http://blogs.adobe.com/aharui/2010/03/flex_and_embedded_fonts.html
Copy link to clipboard
Copied
Doesn't help me at all, no.
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?
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.
Copy link to clipboard
Copied
FlarabyAS3 is much simpler and lighter that TLF: http://www.arabicode.com/flarabyas3/main
Message was edited by: arabicode