<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Runtime Font Loading and Static TextField Conflicts</title>
	<atom:link href="http://blog.nobien.net/2009/06/03/runtime-font-loading-and-static-textfield-conflicts/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nobien.net/2009/06/03/runtime-font-loading-and-static-textfield-conflicts/</link>
	<description>A nerd blog about nerdy things by ... nerdy guys?</description>
	<lastBuildDate>Tue, 20 Jul 2010 20:39:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Max</title>
		<link>http://blog.nobien.net/2009/06/03/runtime-font-loading-and-static-textfield-conflicts/comment-page-1/#comment-4434</link>
		<dc:creator>Max</dc:creator>
		<pubDate>Fri, 03 Jul 2009 08:05:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nobien.net/?p=150#comment-4434</guid>
		<description>Hi,
have the same problem, so frustrating.

So what is the best solution ?

Could you explain how you hyphenate the font name in TransType ?

Thank you.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
have the same problem, so frustrating.</p>
<p>So what is the best solution ?</p>
<p>Could you explain how you hyphenate the font name in TransType ?</p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ari</title>
		<link>http://blog.nobien.net/2009/06/03/runtime-font-loading-and-static-textfield-conflicts/comment-page-1/#comment-4349</link>
		<dc:creator>Ari</dc:creator>
		<pubDate>Mon, 08 Jun 2009 09:31:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nobien.net/?p=150#comment-4349</guid>
		<description>Happened to me too, and we figured it out.
This happens because when you assign the font to a static or dynamic text field, a class holding the font (holding only the characters you used in the text fields, or more if you embedded any in the dynamic ones) is generated and put into the application domain. You can not override classes with the same name already in the application domain, so when you load the font file, the font class in it is silently ignored (this applies to all classes you try to override).
The only workaround I could come up with is breaking (ctrl+b) all the static text fields until they&#039;re just shapes, and putting the font of the dynamic text fields to default system font, and then set the font to the loaded one dynamically on runtime after the font has been loaded.
Just make sure that the font is not already in use anywhere or it will not be loaded.</description>
		<content:encoded><![CDATA[<p>Happened to me too, and we figured it out.<br />
This happens because when you assign the font to a static or dynamic text field, a class holding the font (holding only the characters you used in the text fields, or more if you embedded any in the dynamic ones) is generated and put into the application domain. You can not override classes with the same name already in the application domain, so when you load the font file, the font class in it is silently ignored (this applies to all classes you try to override).<br />
The only workaround I could come up with is breaking (ctrl+b) all the static text fields until they&#8217;re just shapes, and putting the font of the dynamic text fields to default system font, and then set the font to the loaded one dynamically on runtime after the font has been loaded.<br />
Just make sure that the font is not already in use anywhere or it will not be loaded.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://blog.nobien.net/2009/06/03/runtime-font-loading-and-static-textfield-conflicts/comment-page-1/#comment-4345</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Fri, 05 Jun 2009 18:24:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nobien.net/?p=150#comment-4345</guid>
		<description>Thanks Elliot for the ideas. I&#039;ve actually tried tracing out the enumerated fonts as you say and there are no clues as to whats happening there. Additionally, setting TextFields to dynamic causes the same conflict. I did, however, settle on creating a copy of the font with a hyphenated name using TransType. The hyphenated names are used to load at runtime and the regular versions are used for any text placed at author-time. Really annoying, but seems to be only way around this issue.</description>
		<content:encoded><![CDATA[<p>Thanks Elliot for the ideas. I&#8217;ve actually tried tracing out the enumerated fonts as you say and there are no clues as to whats happening there. Additionally, setting TextFields to dynamic causes the same conflict. I did, however, settle on creating a copy of the font with a hyphenated name using TransType. The hyphenated names are used to load at runtime and the regular versions are used for any text placed at author-time. Really annoying, but seems to be only way around this issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elliot Chong</title>
		<link>http://blog.nobien.net/2009/06/03/runtime-font-loading-and-static-textfield-conflicts/comment-page-1/#comment-4344</link>
		<dc:creator>Elliot Chong</dc:creator>
		<pubDate>Fri, 05 Jun 2009 05:17:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nobien.net/?p=150#comment-4344</guid>
		<description>Try doing a

var array:Array = Font.enumerateFonts(true);
for each (var font:Font in array) { trace(font.fontName); }

with the static font present in your fla and before the loaded font is registered, then also execute that code after and see how the trace changes.  This may give you some insight into what is happening, namely I imagine that font is already registered when it is set to static in the fla and therefore when you try to register the loaded one they collide.

One workaround would be to rename the font that is being loaded at runtime to Archer Bold Embed and use that as a unique reference whenever you want the font.

Another idea that might be worth trying is to set the TextField to be dynamic rather than static and enter in your text as usual.  The textfield should retain the text you entered, and possibly (untested) use the runtime loaded font effectively giving you the best of both worlds.

Hope this helps!</description>
		<content:encoded><![CDATA[<p>Try doing a</p>
<p>var array:Array = Font.enumerateFonts(true);<br />
for each (var font:Font in array) { trace(font.fontName); }</p>
<p>with the static font present in your fla and before the loaded font is registered, then also execute that code after and see how the trace changes.  This may give you some insight into what is happening, namely I imagine that font is already registered when it is set to static in the fla and therefore when you try to register the loaded one they collide.</p>
<p>One workaround would be to rename the font that is being loaded at runtime to Archer Bold Embed and use that as a unique reference whenever you want the font.</p>
<p>Another idea that might be worth trying is to set the TextField to be dynamic rather than static and enter in your text as usual.  The textfield should retain the text you entered, and possibly (untested) use the runtime loaded font effectively giving you the best of both worlds.</p>
<p>Hope this helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://blog.nobien.net/2009/06/03/runtime-font-loading-and-static-textfield-conflicts/comment-page-1/#comment-4342</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Wed, 03 Jun 2009 22:26:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nobien.net/?p=150#comment-4342</guid>
		<description>@emma I did think of that! But gosh, what a pain it would be. Blah!</description>
		<content:encoded><![CDATA[<p>@emma I did think of that! But gosh, what a pain it would be. Blah!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://blog.nobien.net/2009/06/03/runtime-font-loading-and-static-textfield-conflicts/comment-page-1/#comment-4341</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Wed, 03 Jun 2009 22:25:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nobien.net/?p=150#comment-4341</guid>
		<description>@Rich Trust me, I&#039;d love to do that. Run time font loading gives me much more flexibility when adding another region/language in the future. Not every language needs certain fonts, and even some languages only use system fonts to render the characters (such as Chinese). So embedding fonts in the main SWF is out of the question. I&#039;d have to embed all sorts of fonts/characters to accommodate every language the site will be in.</description>
		<content:encoded><![CDATA[<p>@Rich Trust me, I&#8217;d love to do that. Run time font loading gives me much more flexibility when adding another region/language in the future. Not every language needs certain fonts, and even some languages only use system fonts to render the characters (such as Chinese). So embedding fonts in the main SWF is out of the question. I&#8217;d have to embed all sorts of fonts/characters to accommodate every language the site will be in.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
