Created
May 5, 2010 16:01
-
-
Save anonymous/390993 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" | |
xmlns:s="library://ns.adobe.com/flex/spark" | |
xmlns:mx="library://ns.adobe.com/flex/mx" | |
width="600" height="600" | |
creationComplete="onCreationComplete()"> | |
<fx:Script> | |
<![CDATA[ | |
import flashx.textLayout.BuildInfo; | |
import mx.collections.ArrayCollection; | |
import mx.collections.Sort; | |
import mx.collections.SortField; | |
[Bindable] | |
protected var myFontsCol : ArrayCollection; | |
[Bindable] | |
protected var thaiText : String = "การประมาณวันที่ออกเดินทาง"; | |
private function onCreationComplete() : void { | |
// all fonts | |
var myFonts:Array = Font.enumerateFonts(true); | |
var myFontsS:Array = new Array(); | |
for (var i:int = 0; i < myFonts.length; i++) { | |
var font : Font = Font(myFonts[i]); | |
myFontsS.push(font); | |
} | |
myFontsCol = new ArrayCollection(myFontsS); | |
var sort : Sort = new Sort(); | |
var sortField : SortField = new SortField(); | |
sortField.descending = false; | |
sortField.name = "fontName"; | |
sort.fields = [sortField]; | |
sort.unique = true; | |
myFontsCol.sort = sort; | |
myFontsCol.refresh(); | |
} | |
]]> | |
</fx:Script> | |
<s:layout> | |
<s:VerticalLayout paddingLeft="10" paddingTop="10"> | |
</s:VerticalLayout> | |
</s:layout> | |
<fx:Style> | |
@namespace s "library://ns.adobe.com/flex/spark"; | |
@namespace mx "library://ns.adobe.com/flex/mx"; | |
mx|FormItemLabel { | |
font-weight : bold; | |
} | |
</fx:Style> | |
<s:controlBarContent> | |
<s:Label id="sdkVer" initialize="sdkVer.text = mx_internal::VERSION;" /> | |
<s:Label id="tlfVer" initialize="tlfVer.text = BuildInfo.kBranch + ' ' + BuildInfo.kBuildNumber;" /> | |
</s:controlBarContent> | |
<s:HGroup width="100%" height="100%"> | |
<s:Panel title="List of locally installed fonts" | |
width="200" height="100%"> | |
<s:layout> | |
<s:VerticalLayout paddingLeft="10" paddingTop="10" | |
paddingRight="10" paddingBottom="10"> | |
</s:VerticalLayout> | |
</s:layout> | |
<s:List dataProvider="{myFontsCol}" | |
width="100%" | |
height="100%" | |
labelField="fontName"> | |
</s:List> | |
</s:Panel> | |
<s:Panel title="Rendering Thai using Spark and MX labels" | |
width="100%" height="100%"> | |
<s:layout> | |
<s:VerticalLayout paddingLeft="10" paddingTop="10" | |
paddingRight="10" paddingBottom="10"> | |
</s:VerticalLayout> | |
</s:layout> | |
<s:Label text="Spark labels" | |
fontWeight="normal" | |
fontSize="14"/> | |
<mx:Form | |
labelWidth="130"> | |
<mx:FormItem label="No FontFamily"> | |
<s:Label id="sparkLabel" | |
text="{thaiText}"> | |
</s:Label> | |
</mx:FormItem> | |
<mx:FormItem label="Tahoma"> | |
<s:Label id="sparkLabel2" fontFamily="Tahoma" | |
text="{thaiText}"> | |
</s:Label> | |
</mx:FormItem> | |
<mx:FormItem label="Microsoft Sans Serif"> | |
<s:Label id="sparkLabel3" fontFamily="Microsoft Sans Serif" | |
text="{thaiText}"> | |
</s:Label> | |
</mx:FormItem> | |
<mx:FormItem label="_sans"> | |
<s:Label id="sparkLabel4" fontFamily="_sans" | |
text="{thaiText}"> | |
</s:Label> | |
</mx:FormItem> | |
</mx:Form> | |
<s:Label text="MX labels" | |
fontWeight="normal" | |
fontSize="14"/> | |
<mx:Form | |
labelWidth="130"> | |
<mx:FormItem label="No fontFamily"> | |
<mx:Label id="mxLabel" | |
text="{thaiText}"> | |
</mx:Label> | |
</mx:FormItem> | |
<mx:FormItem label="Tahoma"> | |
<mx:Label id="mxLabel1" fontFamily="Tahoma" | |
text="{thaiText}"> | |
</mx:Label> | |
</mx:FormItem> | |
<mx:FormItem label="Microsoft Sans Serif"> | |
<mx:Label id="mxLabel2" fontFamily="Microsoft Sans Serif" | |
text="{thaiText}"> | |
</mx:Label> | |
</mx:FormItem> | |
<mx:FormItem label="_sans"> | |
<mx:Label id="mxLabel3" fontFamily="_sans" | |
text="{thaiText}"> | |
</mx:Label> | |
</mx:FormItem> | |
</mx:Form> | |
</s:Panel> | |
</s:HGroup> | |
</s:Application> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment