From a053dfa081ad966c95f43f8558aa276ee34b4094 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Mon, 1 Jun 2015 17:03:34 -0700 Subject: [PATCH] Fix for embedded fonts --- lime/text/Font.hx | 6 +++++- templates/haxe/DefaultAssetLibrary.hx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lime/text/Font.hx b/lime/text/Font.hx index e00e83fbd..76525a463 100644 --- a/lime/text/Font.hx +++ b/lime/text/Font.hx @@ -38,7 +38,11 @@ class Font { public function new (name:String = null) { - this.name = name; + if (name != null) { + + this.name = name; + + } if (__fontPath != null) { diff --git a/templates/haxe/DefaultAssetLibrary.hx b/templates/haxe/DefaultAssetLibrary.hx index 9a4bbeaa1..686c2d333 100644 --- a/templates/haxe/DefaultAssetLibrary.hx +++ b/templates/haxe/DefaultAssetLibrary.hx @@ -711,7 +711,7 @@ class DefaultAssetLibrary extends AssetLibrary { #end #if openfl -::if (assets != null)::::foreach assets::::if (type == "font")::@:keep #if display private #end class __ASSET__OPENFL__::flatName:: extends openfl.text.Font { public function new () { __fontPath = "::targetPath::"; name = "::fontName::"; super (); }} +::if (assets != null)::::foreach assets::::if (type == "font")::@:keep #if display private #end class __ASSET__OPENFL__::flatName:: extends openfl.text.Font { public function new () { ::if (embed)::var font = new __ASSET__::flatName:: (); src = font.src; name = font.name;::else::__fontPath = "::targetPath::"; name = "::fontName::";::end:: super (); }} ::end::::end::::end:: #end