Slaus
Slaus

Reputation: 2230

AS3: Using embedded font

I embed font like this (FlashDevelop):

[ Embed( source = "Ubuntu-R.ttf", embedAsCFF = "false", fontFamily = "Ubuntu" ) ]
private static const Ubuntu : Class;

Then try to use like this:

var textField : TextField = new TextField;
textField.embedFonts = true;
textField.defaultTextFormat = new TextFormat( "Ubuntu", 22 );
textField = "免費旋轉 ПРИВЕТ HELLO";
addChild( textField );

Only russian and english parts of the text visible, but not japanese (my PC is russian). If to comment textField.embedFonts = true; line, then the whole text will be visible, but some other (seems like Arial) font used.

Call to Font.enumerateFonts( false ); returns array with one font called "Ubuntu".

Call to Font.registerFont( Ubuntu ); at any place doesn't help.

Adding parameters fontName, unicodeRange = "U+0000-U+FFFF", mimeType = "application/x-font-truetype", fontWeight, advancedAntiAliasing to the font embed directive with different attributes do not change the behavior.

Seems like dead end, but please help.

Upvotes: 1

Views: 273

Answers (1)

Vesper
Vesper

Reputation: 18757

The font you use does not contain the required glyphs for Japanese. You might try another font, make sure though it has enough glyphs in there. A hint: if the font isn't as big as 1 megabyte, most likely it has neither japanese nor chinese glyphs, if it's bigger, then try embedding and check with hasGlyphs() if it has enough. Once you'll find the correct font, embed and enjoy. But, I'd say use a font that's widely distributed and has japanese glyphs by design, say Arial.

Upvotes: 1

Related Questions