<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cameronyule.com &#187; superscript</title>
	<atom:link href="http://cameronyule.com/tags/superscript/feed" rel="self" type="application/rss+xml" />
	<link>http://cameronyule.com</link>
	<description>Glasgow based new media developer Cameron Yule.</description>
	<lastBuildDate>Fri, 22 Jan 2010 12:53:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Superscript and Subscript in Text Layout Framework</title>
		<link>http://cameronyule.com/2009/02/superscript-subscript-in-text-layout-framework</link>
		<comments>http://cameronyule.com/2009/02/superscript-subscript-in-text-layout-framework#comments</comments>
		<pubDate>Fri, 27 Feb 2009 11:17:39 +0000</pubDate>
		<dc:creator>Cameron</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[subscript]]></category>
		<category><![CDATA[superscript]]></category>
		<category><![CDATA[text layout framework]]></category>
		<category><![CDATA[typography]]></category>

		<guid isPermaLink="false">http://cameronyule.com/?p=541</guid>
		<description><![CDATA[On my last post on using embedded fonts with the Text Layout Framework, Anne Knoche left a comment asking how to mark up input text to use subscript and superscripts. Here’s a quick example showing exactly that; 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_typographytest_1142730922"
			class="flashmovie"
			width="400"
			height="100">
	<param name="movie" value="/wp-content/uploads/2009/02/typographytest.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/wp-content/uploads/2009/02/typographytest.swf"
			name="fm_typographytest_1142730922"
			width="400"
			height="100">
	<!--<![endif]-->
		 
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object> Here’s the AS3 I&#8217;ve used to implement this. For licensing [...]]]></description>
			<content:encoded><![CDATA[<p>On my last post on <a href="http://cameronyule.com/2009/02/embedded-fonts-and-the-text-layout-framework">using embedded fonts with the Text Layout Framework</a>, Anne Knoche left a <a href="http://cameronyule.com/2009/02/embedded-fonts-and-the-text-layout-framework#comment-324">comment</a> asking how to mark up input text to use subscript and superscripts.</p>
<p>Here’s a quick example showing exactly that;</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_typographytest_787760878"
			class="flashmovie"
			width="400"
			height="100">
	<param name="movie" value="/wp-content/uploads/2009/02/typographytest.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/wp-content/uploads/2009/02/typographytest.swf"
			name="fm_typographytest_787760878"
			width="400"
			height="100">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p></p>
<p>Here’s the AS3 I&#8217;ve used to implement this. For licensing reasons I can’t provide the font I’ve used, so simply substitute the <code>embed</code> for a font of your own choosing. There’s also a zip of the <a href="http://cameronyule.com/wp-content/uploads/2009/02/typographytest.zip">Flex Builder project</a> to save you copying/pasting the code.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package 
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #006600;">engine</span>.<span style="color: #006600;">Kerning</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> flashx.<span style="color: #006600;">textLayout</span>.<span style="color: #006600;">container</span>.<span style="color: #006600;">DisplayObjectContainerController</span>;
	<span style="color: #0066CC;">import</span> flashx.<span style="color: #006600;">textLayout</span>.<span style="color: #006600;">container</span>.<span style="color: #006600;">IContainerController</span>;
	<span style="color: #0066CC;">import</span> flashx.<span style="color: #006600;">textLayout</span>.<span style="color: #006600;">conversion</span>.<span style="color: #006600;">ImportExportConfiguration</span>;
	<span style="color: #0066CC;">import</span> flashx.<span style="color: #006600;">textLayout</span>.<span style="color: #006600;">conversion</span>.<span style="color: #006600;">TextFilter</span>;
	<span style="color: #0066CC;">import</span> flashx.<span style="color: #006600;">textLayout</span>.<span style="color: #006600;">elements</span>.<span style="color: #006600;">Configuration</span>;
	<span style="color: #0066CC;">import</span> flashx.<span style="color: #006600;">textLayout</span>.<span style="color: #006600;">elements</span>.<span style="color: #006600;">TextFlow</span>;
	<span style="color: #0066CC;">import</span> flashx.<span style="color: #006600;">textLayout</span>.<span style="color: #006600;">formats</span>.<span style="color: #006600;">CharacterFormat</span>;
	<span style="color: #0066CC;">import</span> flashx.<span style="color: #006600;">textLayout</span>.<span style="color: #006600;">formats</span>.<span style="color: #006600;">ParagraphFormat</span>;
&nbsp;
	<span style="color: #66cc66;">&#91;</span>SWF<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">'400'</span>, <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">'100'</span>, <span style="color: #0066CC;">backgroundColor</span>=<span style="color: #ff0000;">'#000000'</span>, frameRate=<span style="color: #ff0000;">'30'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TypographyTest <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">&quot;ASVCodarLTLight.ttf&quot;</span>, fontFamily=<span style="color: #ff0000;">&quot;ASVCodar LT&quot;</span>, cff=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _asv_codar_light:<span style="color: #0066CC;">String</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> TypographyTest<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">text</span>:<span style="color: #0066CC;">String</span> = <span style="color: #66cc66;">&lt;</span>TextFlow xmlns=<span style="color: #ff0000;">&quot;http://ns.adobe.com/textLayout/2008&quot;</span><span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>div<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>p<span style="color: #66cc66;">&gt;</span>
			<span style="color: #0066CC;">This</span> is a test showing <span style="color: #66cc66;">&lt;</span>span baselineShift=<span style="color: #ff0000;">&quot;superscript&quot;</span><span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&lt;/</span>span<span style="color: #66cc66;">&gt;</span> typographical<span style="color: #66cc66;">&lt;</span>span baselineShift=<span style="color: #ff0000;">&quot;subscript&quot;</span><span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&lt;/</span>span<span style="color: #66cc66;">&gt;</span> controls.
			<span style="color: #66cc66;">&lt;/</span>p<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;/</span>div<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;/</span>TextFlow<span style="color: #66cc66;">&gt;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> charFormat:CharacterFormat = <span style="color: #000000; font-weight: bold;">new</span> CharacterFormat<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			charFormat.<span style="color: #0066CC;">color</span> = 0xFFFFFF;
			charFormat.<span style="color: #006600;">fontFamily</span> = <span style="color: #ff0000;">&quot;ASVCodar LT&quot;</span>;
			charFormat.<span style="color: #006600;">fontSize</span> = <span style="color: #cc66cc;">20</span>;
			charFormat.<span style="color: #006600;">kerning</span> = Kerning.<span style="color: #0066CC;">ON</span>;
			charFormat.<span style="color: #006600;">fontLookup</span> = flash.<span style="color: #0066CC;">text</span>.<span style="color: #006600;">engine</span>.<span style="color: #006600;">FontLookup</span>.<span style="color: #006600;">EMBEDDED_CFF</span>;
			charFormat.<span style="color: #006600;">renderingMode</span> = flash.<span style="color: #0066CC;">text</span>.<span style="color: #006600;">engine</span>.<span style="color: #006600;">RenderingMode</span>.<span style="color: #006600;">CFF</span>;         
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> textFlow:TextFlow = TextFilter.<span style="color: #006600;">importToFlow</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">text</span>, TextFilter.<span style="color: #006600;">TEXT_LAYOUT_FORMAT</span><span style="color: #66cc66;">&#41;</span>;
			textFlow.<span style="color: #006600;">characterFormat</span> = charFormat;
			textFlow.<span style="color: #006600;">paddingTop</span> = <span style="color: #cc66cc;">20</span>;
			textFlow.<span style="color: #006600;">whiteSpaceCollapse</span> = flashx.<span style="color: #006600;">textLayout</span>.<span style="color: #006600;">formats</span>.<span style="color: #006600;">WhiteSpaceCollapse</span>.<span style="color: #006600;">PRESERVE</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> container:Sprite = addChild<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> as Sprite;
&nbsp;
			textFlow.<span style="color: #006600;">flowComposer</span>.<span style="color: #006600;">addController</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> DisplayObjectContainerController<span style="color: #66cc66;">&#40;</span>container, <span style="color: #cc66cc;">400</span>, <span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			textFlow.<span style="color: #006600;">flowComposer</span>.<span style="color: #006600;">updateAllContainers</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://cameronyule.com/2009/02/superscript-subscript-in-text-layout-framework/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

