Mega Code Archive

 
Categories / Flex / Graphics
 

Embed same font for different character ranges

<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"     creationComplete="checkCharacterSupport();">     <mx:Style>         @font-face{              font-family: myABFont;              flashType: true;             src:url("a.ttf");              unicodeRange: U+0041-U+0042;          }          @font-face{              font-family: myABFont;             flashType: true;              src:url("a.ttf");             unicodeRange: U+0041-U+007F;          }     </mx:Style>     <mx:Script>         public function checkCharacterSupport():void {             var fontArray:Array = Font.enumerateFonts(false);             for(var i:int = 0; i < fontArray.length; i++) {                 var thisFont:Font = fontArray[i];                 if (thisFont.hasGlyphs("DHARMA")) {                     trace(thisFont.fontName + " supports these glyphs");                 } else {                     trace(thisFont.fontName +" does not support these glyphs");                 }             }         }     </mx:Script> </mx:Application>