注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

和申的个人主页

专注于java开发,1985wanggang

 
 
 

日志

 
 

flash.text.Font  

2012-03-20 17:24:31|  分类: Flash编程 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/Font.html

Package
flash.text
Classpublic class Font
InheritanceFont Inheritance Object
Subclasses FontAsset

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4


Was this helpful?YesNo

The Font class is used to manage embedded fonts in SWF files. Embedded fonts are represented as a subclass of the Font class. The Font class is currently useful only to find out information about embedded fonts; you cannot alter a font by using this class. You cannot use the Font class to load external fonts, or to create an instance of a Font object by itself. Use the Font class as an abstract base class.

More examples

Learn more



Public Properties
 PropertyDefined By
  fontName : String
[read-only] The name of an embedded font.
Font
  fontStyle : String
[read-only] The style of the font.
Font
  fontType : String
[read-only] The type of the font.
Font
Public Methods
 MethodDefined By
  
enumerateFonts(enumerateDeviceFonts:Boolean = false):Array
[static] Specifies whether to provide a list of the currently available embedded fonts.
Font
  
Specifies whether a provided string can be displayed using the currently assigned font.
Font
  
[static] Registers a font class in the global font list.
Font
Property Detail

fontName

property
fontName:String  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

The name of an embedded font.



Implementation
    public function get fontName():String

Example  ( How to use this example )
The following example shows how you can use an embedded font with the Flash Professional ActionScript 3.0 CheckBox control by setting the textFormat and embedFonts styles. Example provided by ActionScriptExamples.com.
// Requires: // - A CheckBox control UI component in Flash library. // - An embedded font in Flash library with linkage class "MyFont" and Export for ActionScript checked. // import fl.controls.CheckBox;   var embeddedFont:Font = new MyFont();   var textFormat:TextFormat = new TextFormat(); textFormat.font = embeddedFont.fontName; textFormat.size = 24;   var checkBox:CheckBox = new CheckBox(); checkBox.setStyle("textFormat", textFormat); checkBox.setStyle("embedFonts", true); checkBox.label = "The quick brown fox jumps over the lazy dog."; checkBox.textField.autoSize = TextFieldAutoSize.LEFT; checkBox.move(10, 10); checkBox.validateNow(); addChild(checkBox); 

fontStyle

property 
fontStyle:String  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

The style of the font. This value can be any of the values defined in the FontStyle class.



Implementation
    public function get fontStyle():String

Related API Elements

fontType

property 
fontType:String  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

The type of the font. This value can be any of the constants defined in the FontType class.



Implementation
    public function get fontType():String

Related API Elements

Method Detail

enumerateFonts

()method
public static function enumerateFonts(enumerateDeviceFonts:Boolean = false):Array

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Specifies whether to provide a list of the currently available embedded fonts.

Parameters

enumerateDeviceFonts:Boolean (default = false) — Indicates whether you want to limit the list to only the currently available embedded fonts. If this is set to true then a list of all fonts, both device fonts and embedded fonts, is returned. If this is set to false then only a list of embedded fonts is returned.

Returns
Array — A list of available fonts as an array of Font objects.

Example  ( How to use this example )

This example first calls the static method Font.enumerateFonts() to get a list of all device and embedded fonts. Then it sorts the resulting Array of Font objects by the fontName property.

Next the example shows how to call the Font.enumerateFonts() method with the enumerateDeviceFonts parameter set to false. The resulting Array only includes embedded Font objects. (If you run this code within an application that does not contain any embedded fonts, the embeddedFonts array will be empty.)

  import flash.text.Font;  var allFonts:Array = Font.enumerateFonts(true); allFonts.sortOn("fontName", Array.CASEINSENSITIVE);  var embeddedFonts:Array = Font.enumerateFonts(false); embeddedFonts.sortOn("fontName", Array.CASEINSENSITIVE); 

hasGlyphs

()method 
public function hasGlyphs(str:String):Boolean

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Specifies whether a provided string can be displayed using the currently assigned font.

Parameters

str:String — The string to test against the current font.

Returns
Boolean — A value of true if the specified string can be fully displayed using this font.

registerFont

()method 
public static function registerFont(font:Class):void

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Registers a font class in the global font list.

Parameters

font:Class — The class you want to add to the global font list.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/Font.html
  评论这张
 
阅读(2085)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2016