Copy link to clipboard
Copied
Any idea why the old text class can render Devangari, but the FTE cannot, even when the font is embedded as follows?
package {
import flash.display.Sprite;
import flash.text.TextField;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import flash.text.Font;
import flash.text.TextField;
public class DevnagriScriptTest extends Sprite
{
[Embed(source='DevanagariMT.ttf',fontName='_HindiFont',cff='true')]
public static var _HindiFont:Class;
public const FONT_NAME:String = '_HindiFont';
public function DevnagriScriptTest()
{
flash.text.Font.registerFont(_HindiFont);
var textFlow:TextFlow = new TextFlow();
textFlow.paddingLeft="5";
textFlow.paddingRight = "5";
textFlow.paddingTop = "25";
var controller = new ContainerController(this, 300, 90);
textFlow.flowComposer.addController(controller);
var paragraph = new ParagraphElement();
paragraph.fontFamily = 'Arial';
paragraph.textAlign = 'center';
paragraph.paddingLeft='10';
paragraph.paddingTop ='30';
var _span= new SpanElement();
_span.color=0xFFFFFF;
_span.text = "This is the FTE Text Field? تعليق من قبل < aracbic | hindi > اुमने कुछ चीजें";
paragraph.addChild(_span);
textFlow.addChild(paragraph);
textFlow.flowComposer.updateAllControllers();
// Ofcourse this font works with the old TextField class.
var oldTextField:TextField = new TextField();
oldTextField.text = "This is an old text field. कुछ चीजें जैसे की बीं्स्वी सदी के क";
oldTextField.height = 90;
oldTextField.width = 390;
oldTextField.multiline=true;
oldTextField.x = 30;
oldTextField.y = 100;
addChild(oldTextField);
}
}
}
Copy link to clipboard
Copied
TLF (and the underlying flash.text.engine classes) support OpenType layout only. The font you are using, DevanagariMT is an AAT font.
Incidentally, while TextField seems to support DevanagariMT on Mac, it most certainly doesn't on Windows, and an embedding of DevanagariMT for TextField does not work on any platform.
You may want to try the Lohit fonts which are available at https://fedorahosted.org/lohit/ (they are under GPL). There are of course other OpenType Indic fonts out there, free or commercial.
Eric.
Copy link to clipboard
Copied
Hi Eric,
Thanks for your help. Forum users, for future refernce, this font works perfectly, and installs out of the box on OS X. It's called Chandas.ttf and it is OpenType
http://www.sanskritweb.net/cakram/
Peder