In the "Embed...Character Embedding" window in the Flash environment, you can select to embed Japanese Kanji. Does anyone know of a way to embed the same using a TextField
created with Actionscript?
views:
440answers:
3
+1
A:
You need to create a font symbol in your library and assign a linkage class (in this case "Font1"):
var myFont:Font = new Font1();
var myFormat:TextFormat = new TextFormat();
myFormat.font = myFont.fontName;
var myTextField:TextField = new TextField();
myTextField.defaultTextFormat = myFormat;
myTextField.embedFonts = true;
myTextField.text = "Hello World!";
addChild(myTextField);
See article on Embedding fonts
euge1979
2009-02-11 18:17:56
+1
A:
I usually use this with succes:
package
{
import flash.display.Sprite;
import flash.display.TextField;
import flash.display.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.text.AntiAliasType;
public class EmbedFontTest extends Sprite
{
[Embed(source="C:\WINDOWS\Fonts\ARIAL.TTF", fontFamily="Arial")]
private var _arial_str:String;
private var _arial_fmt:TextFormat;
private var _text_txt:TextField;
public function EmbedFontTest()
{
super();
this.initEmbedFontTest();
}
private function initEmbedFontTest():Void
{
this._arial_fmt = new TextFormat();
this._arial_fmt.font = "Arial";
this._arial_fmt.size = 40;
this._text_txt = new TextField();
this._text_txt.embedFonts = true;
this._text_txt.autoSize = TextFieldAutoSize.LEFT;
this._text_txt.defaultTextFormat = this._arial_fmt;
this._text_txt.text = "Test Arial Format";
this.addChild(this._text_txt);
}
}
}
monkee
2009-02-12 10:13:53
A:
Actually, I ended up finding out that the best way to support Kanji (in my case) was to not embed the font at all and just use the _sans option in the TextField.
Typeoneerror
2009-02-17 02:38:08