public
anonymous / Thai_FTE
Created

  • Download Gist
Thai_FTE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
<?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>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.