Relax Breath of Solution.Community tech blog of Sameera Thilakasiri - Consultant UI, UX, RWD Specialist/ Interactive Designer

Just I wanted.. Do you?…

How to add system Fonts in your application – Font.enumerateFonts()

Posted on March 7, 2010 | No Comments

How to add system Fonts in your application

systemFonts.mxml

<?xml     version="1.0?     encoding="utf-8??>
<mx:Application         xmlns:mx=" http://www.adobe.com/2006/mxml   "   layout="vertical" verticalAlign="middle" backgroundColor="white"   creationComplete="init()">
	<mx:Script>
		<![CDATA[
		import     flash.text.Font;
		private function init():void 
		{
			arr   = Font.enumerateFonts(true);
			arr.sortOn("fontName",   Array.CASEINSENSITIVE);
		}
		]]>
	</mx:Script>
	<mx:Array     id="arr"   />
	&lt;mx:String <a href="http://over50losingweight.com/images/">424 buy viagra</a>  id=&quot;str&quot;&gt;Check the font style in datagrid.&lt;/mx:String&gt;
	&lt;mx:String   id=&quot;str1?&gt;Check   the font style in combobox.&lt;/mx:String&gt;
	&lt;mx:Label   text=&quot;Number of installed fonts:   {arr.length}&quot;   /&gt;

	&lt;mx:DataGrid id=&quot;dataGrid&quot; dataProvider=&quot;{arr}&quot;&gt;
	&lt;mx:columns&gt;
	&lt;mx:DataGridColumn   dataField=&quot;fontName&quot; width=&quot;200? itemRenderer=&quot;mx.controls.Label&quot;       /&gt;
	&lt;mx:DataGridColumn dataField=&quot;fontStyle&quot;     /&gt;
	&lt;mx:DataGridColumn dataField=&quot;fontType&quot; /&gt;
	&lt;/mx:columns&gt;
	&lt;/mx:DataGrid&gt;

	&lt;mx:Label   id=&quot;lb2? text=&quot;{str1}&quot; width=&quot;{cb.width}&quot;     <a href="http://loanscreditandinsurance.info/images/index.php">can <a href="http://blogtorn.com/images/">where do you buy viagra | buy cialis phentermine | cheap levitra online</a>  you buy viagra in stores | buy cialis brand | levitra drugs</a>  height=&quot;32? fontFamily=&quot;{cb.selectedItem.fontName}&quot;   fontSize=&quot;16? /&gt;
	&lt;mx:Label   id=&quot;lbl&quot; text=&quot;{str}&quot; width=&quot;{dataGrid.width}&quot; height=&quot;32?   fontFamily=&quot;{dataGrid.selectedItem.fontName}&quot;       fontSize=&quot;16?     /&gt;
	&lt;mx:ComboBox       id=&quot;cb&quot;   dataProvider=&quot;{arr}&quot;   labelField=&quot;fontName&quot;/&gt;
&lt;/mx:Application&gt;

Author
Sameera Thilakasiri By Sameera Thilakasiri
,is a front-end developer based in Colombo, is a blogger and a lifestyle photographer.
Follow him Twitter and Google+. Check out him.

Comments

Leave a Reply

You must be logged in to post a comment.