在Flex4中嵌入字体

如果要使用的字体不是系统字体,可以把字体嵌入到Flash中,然后引用该字体。不过字体文件一般都比较大,慎重使用该功能。

官方例子

http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f5f.html

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?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"  minWidth= "955"  minHeight= "600" >
     <s:layout>
         <s:BasicLayout/>
     </s:layout>
     <fx:Style>
         @ namespace  s "library://ns.adobe.com/flex/spark" ;
         @ namespace  mx "library://ns.adobe.com/flex/mx" ;
         
         @font-face{
             src:url( "W8.TTF" );
             font-family:W8;
         }
     </fx:Style>
     <fx:Declarations>
         <!-- 将非可视元素(例如服务、值对象)放在此处 -->
     </fx:Declarations>
     <s:Label x= "104"  y= "107"  text= "这是一个测试"  fontSize= "32"  fontFamily= "W8" />
</s:Application>

你可能感兴趣的:(flex4)