Use true font names and automatically register font names on native platforms

This commit is contained in:
Joshua Granick
2014-11-01 09:44:59 -07:00
parent facc1a20c1
commit fe17a43f72
7 changed files with 169 additions and 83 deletions

View File

@@ -297,7 +297,7 @@ class FlashHelper {
var src = name;
//var font_name = Path.withoutExtension (name);
var face = new Font (src);
var face = Font.fromFile (src);
var font = face.decompose ();
var font_name = font.family_name;

View File

@@ -20,7 +20,9 @@ import sys.io.File;
#if lime
import helpers.FileHelper;
import helpers.ProcessHelper;
import lime.graphics.Font;
import sys.io.Process;
@:access(lime.graphics.Font)
#end
@@ -904,6 +906,20 @@ class HXProject {
}
embeddedAsset.type = Std.string (asset.type).toLowerCase ();
#if lime
if (asset.type == FONT) {
try {
var font = Font.fromFile (asset.sourcePath);
embeddedAsset.fontName = font.fontName;
} catch (e:Dynamic) {}
}
#end
context.assets.push (embeddedAsset);
}