| 包 | flash.text |
| 类 | public class Font |
| 继承 | Font Object |
| 子类 | FontAsset |
| 语言版本: | ActionScript 3.0 |
| 运行时版本: | AIR 1.0, Flash Player 9, Flash Lite 4 |
公共属性
| 属性 | 由以下参数定义 | ||
|---|---|---|---|
![]() | constructor : Object
对类对象或给定对象实例的构造函数的引用。 | Object | |
| fontName : String [只读]
嵌入字体的名称。 | Font | ||
| fontStyle : String [只读]
字体的样式。 | Font | ||
| fontType : String [只读]
字体的类型。 | Font | ||
公共方法
| 方法 | 由以下参数定义 | ||
|---|---|---|---|
[静态]
指定是否提供当前可用嵌入字体列表。 | Font | ||
指定能否使用当前指定的字体显示提供的字符串。 | Font | ||
![]() |
表示对象是否已经定义了指定的属性。 | Object | |
![]() |
表示 Object 类的实例是否在指定为参数的对象的原型链中。 | Object | |
![]() |
表示指定的属性是否存在、是否可枚举。 | Object | |
[静态]
在全局字体列表中注册一个字体类。 | Font | ||
![]() |
设置循环操作动态属性的可用性。 | Object | |
![]() |
返回此对象的字符串表示形式,其格式设置遵守区域设置特定的约定。 | Object | |
![]() |
返回指定对象的字符串表示形式。 | Object | |
![]() |
返回指定对象的原始值。 | Object | |
属性详细信息
fontName | 属性 |
fontName:String [只读] | 语言版本: | ActionScript 3.0 |
| 运行时版本: | AIR 1.0, Flash Player 9, Flash Lite 4 |
嵌入字体的名称。
实现
public function get fontName():String示例 ( 如何使用本示例 )
以下示例说明了如何通过设置 textFormat 和 embedFonts 样式,将嵌入字体与 Flash Professional ActionScript 3.0 复选框控件一起使用。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 | 属性 |
fontType | 属性 |
方法详细信息
enumerateFonts | () | 方法 |
public static function enumerateFonts(enumerateDeviceFonts:Boolean = false):Array| 语言版本: | ActionScript 3.0 |
| 运行时版本: | AIR 1.0, Flash Player 9, Flash Lite 4 |
指定是否提供当前可用嵌入字体列表。
参数
enumerateDeviceFonts:Boolean (default = false) — 表示是否要将列表限制为仅当前可用的嵌入字体。如果设置为 true,则返回一个包括所有字体(设备字体和嵌入字体)的列表。如果设置为 false,则返回一个只包括嵌入字体的列表。
|
Array — 一个作为 Font 对象数组的可用字体列表。
|
示例 ( 如何使用本示例 )
此示例首先调用静态方法
Font.enumerateFonts() 来获取包括所有设备字体和嵌入字体的列表。然后此示例按 fontName 属性对生成的 Array 的 Font 对象进行排序。
接下来,此示例显示如何调用 enumerateDeviceFonts 参数设置为 false 时的 Font.enumerateFonts() 方法。生成的 Array 只包括嵌入的 Font 对象。(如果在不包含任何嵌入字体的应用程序中运行此代码,则 embeddedFonts 数组将为空。)
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 | () | 方法 |
registerFont | () | 方法 |
Tue Jun 12 2018, 11:04 AM Z
隐藏继承的公共属性
显示继承的公共属性