用于 Adobe® Flash® Platform 的 ActionScript® 3.0 参考
主页  |  隐藏包列表和类列表 |   |   |  新增内容  |  索引  |  附录  |  为什么显示为英语?
过滤条件: AIR 30.0 和更早版本, Flash Player 30.0 和更早版本, Flash Lite 4
Flex 4.6 和更早版本, Flash Pro CS6 和更早版本
隐藏过滤条件
flash.text.engine 

ElementFormat  - AS3

x

顶级
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

语言元素

全局常量
全局函数
运算符
语句、关键字和指令
特殊类型

附录

新增内容
编译器错误
编译器警告
运行时错误
迁移到 ActionScript 3
支持的字符集
仅适用于 MXML 的标签
Motion XML 元素
Timed Text 标记
不推荐使用的元素的列表
AccessibilityImplementation 常量
如何使用 ActionScript 示例
法律声明
flash.text.engine
public final class ElementFormat
继承ElementFormat Inheritance Object

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

ElementFormat 类表示可应用于 ContentElement 的格式设置信息。使用 ElementFormat 类可以为 ContentElement 的各个子类创建特定的文本格式。ElementFormat 类的属性适用于设备字体和嵌入字体。

应用于 TextBlock 中的 ContentElement 的 ElementFormat 对象不会使 TextBlock 无效。将 ElementFormat 应用于 ContentElement 后,将其 locked 属性设置为 true。无法更改已锁定 ElementFormat 对象的属性。相反,可以使用 clone() 方法创建此对象的没有锁定的副本,可以对此副本进行修改并将其分配给 ContentElement。

查看示例

相关 API 元素



公共属性
 属性由以下参数定义
  alignmentBaseline : String
指定包含元素中的基线类型,具有此格式的元素的主要基线将与此基线对齐。
ElementFormat
  alpha : Number
指定受此对象影响的行元素的透明效果。
ElementFormat
  baselineShift : Number
表示元素的基线偏移,以像素为单位。
ElementFormat
  breakOpportunity : String
应用于此文本的换行。
ElementFormat
  color : uint
表示文本的颜色。
ElementFormat
 Inheritedconstructor : Object
对类对象或给定对象实例的构造函数的引用。
Object
  digitCase : String
用于此文本的数字大小写。
ElementFormat
  digitWidth : String
用于此文本的数字宽度。
ElementFormat
  dominantBaseline : String
指定用作主要基线的基线类型。
ElementFormat
  fontDescription : FontDescription
其属性说明字体的对象。
ElementFormat
  fontSize : Number
文本的大小,以像素为单位。
ElementFormat
  kerning : String
字距调整可调整某些字符对之间的像素以提高可读性。
ElementFormat
  ligatureLevel : String
用于此文本的连字级别。
ElementFormat
  locale : String
文本的区域设置。
ElementFormat
  locked : Boolean
表示 ElementFormat 是否已锁定。
ElementFormat
  textRotation : String
设置应用于各个字型的旋转。
ElementFormat
  trackingLeft : Number
应用到每个字型左侧的间距或手动字距调整(以像素为单位)。
ElementFormat
  trackingRight : Number
应用到每个字型右侧的间距或手动字距调整(以像素为单位)。
ElementFormat
  typographicCase : String
用于此文本的印刷大小写。
ElementFormat
公共方法
 方法由以下参数定义
  
ElementFormat(fontDescription:FontDescription = null, fontSize:Number = 12.0, color:uint = 0x000000, alpha:Number = 1.0, textRotation:String = "auto", dominantBaseline:String = "roman", alignmentBaseline:String = "useDominantBaseline", baselineShift:Number = 0.0, kerning:String = "on", trackingRight:Number = 0.0, trackingLeft:Number = 0.0, locale:String = "en", breakOpportunity:String = "auto", digitCase:String = "default", digitWidth:String = "default", ligatureLevel:String = "common", typographicCase:String = "default")
创建 ElementFormat 对象。
ElementFormat
  
构造 ElementFormat 的没有锁定的克隆副本。
ElementFormat
  
返回一个 FontMetrics 对象,该对象的属性说明由 fontDescription 和 fontSize 指定的字体的全角字框、删除线位置、删除线粗细、下划线位置和下划线粗线。
ElementFormat
 Inherited
表示对象是否已经定义了指定的属性。
Object
 Inherited
表示 Object 类的实例是否在指定为参数的对象的原型链中。
Object
 Inherited
表示指定的属性是否存在、是否可枚举。
Object
 Inherited
设置循环操作动态属性的可用性。
Object
 Inherited
返回此对象的字符串表示形式,其格式设置遵守区域设置特定的约定。
Object
 Inherited
返回指定对象的字符串表示形式。
Object
 Inherited
返回指定对象的原始值。
Object
属性详细信息

alignmentBaseline

属性
alignmentBaseline:String

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

指定包含元素中的基线类型,具有此格式的元素的主要基线将与此基线对齐。对此属性使用 TextBaseline 常量。

行中的最大垂直元素确定基线的对齐方式,除非将 TextBlock.baselineFontDescriptionTextBlock.baselineFontSize 设置为覆盖该逻辑。

默认值为 TextBaseline.USE_DOMINANT_BASELINE

要设置此属性的值,请使用下列字符串值:

字符串值说明
TextBaseline.ROMANdominantBaseline 与该行的罗马字基线对齐。
TextBaseline.ASCENTdominantBaseline 与该行的上缘基线对齐。
TextBaseline.DESCENTdominantBaseline 与该行的下缘基线对齐。
TextBaseline.IDEOGRAPHIC_TOPdominantBaseline 与该行的表意顶部基线对齐。
TextBaseline.IDEOGRAPHIC_CENTERdominantBaseline 与该行的表意中心基线对齐。
TextBaseline.IDEOGRAPHIC_BOTTOMdominantBaseline 与该行的表意底部基线对齐。
TextBaseline.USE_DOMINANT_BASELINEdominantBaseline 与该行的同一基线对齐。

子类设置属性的效果
GraphicElement设置图形元素的 dominantBaseline 所对齐的行的对齐基线。
GroupElement没有任何效果。
TextElement设置文本元素的 dominantBaseline 所对齐的行的对齐基线。



实现
    public function get alignmentBaseline():String
    public function set alignmentBaseline(value:String):void

引发
ArgumentError — 如果设置的值不是 TextBaseline 的成员。
 
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

相关 API 元素

alpha

属性 
alpha:Number

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

指定受此对象影响的行元素的透明效果。有效值范围介于 0(完全透明)到 1(完全不透明)之间。alpha 设置为 0 的显示对象是活动的,即使它们不可见。

默认值为 1

子类设置属性的效果
GraphicElement对图形元素应用指定的 Alpha。与在图形的 DisplayObject 本身或在 TextLine 上设置的任何 Alpha 进行乘法合并。
GroupElement没有任何效果。
TextElement对文本元素应用指定的 Alpha。与在 TextLine 上设置的任何 Alpha 进行乘法合并。



实现
    public function get alpha():Number
    public function set alpha(value:Number):void

引发
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

相关 API 元素

baselineShift

属性 
baselineShift:Number

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

表示元素的基线偏移,以像素为单位。

元素将按照这个量偏离 dominantBaseline。此偏移量将加到元素成员的 y 位置中,因此在非旋转的文本中,正基线偏移会向下移动元素,负基线偏移会向上移动元素。

默认值为 0.0,表示不偏移。

子类设置属性的效果
GraphicElement将图形偏离基线。
GroupElement没有任何效果。
TextElement将文本偏离基线。



实现
    public function get baselineShift():Number
    public function set baselineShift(value:Number):void

引发
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

breakOpportunity

属性 
breakOpportunity:String

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

应用于此文本的换行。此属性确定在将换行文本分为多行时可用于断行的字符。将 BreakOpportunity 常量用于此属性。

默认值为 BreakOpportunity.AUTO

要设置此属性的值,请使用下列字符串值:

字符串值说明
BreakOpportunity.AUTO换行基于标准的 Unicode 字符属性,如在文字间以及在连字符处换行。
BreakOpportunity.ANYContentElement 对象中的任何字符均可换行。此值通常用于亚洲文字中嵌入罗马文字并需要在文字的中间换行的场合。
BreakOpportunity.NONE范围内的任何字符均不可进行换行。
BreakOpportunity.ALL范围内的所有字符均可换行,表示换行符将出现在各个字符的后面。可用于创建路径文本这样的效果。

子类设置属性的效果
GraphicElement没有任何效果。
GroupElement确定组中相邻文本元素间的换行。如果组的 elementFormat 为 null,则使用相邻元素中第一个元素的格式。
TextElement确定文本元素中字符间的换行。



实现
    public function get breakOpportunity():String
    public function set breakOpportunity(value:String):void

引发
ArgumentError — 如果设置的值不是 BreakOpportunity 的成员。
 
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

相关 API 元素

color

属性 
color:uint

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

表示文本的颜色。一个包含三个 8 位 RGB 分量的整数;例如,0xFF0000 为红色,0x00FF00 为绿色。

默认值为 0x000000,黑色。

子类设置属性的效果
GraphicElement没有任何效果。
GroupElement没有任何效果。
TextElement设置文本的颜色。



实现
    public function get color():uint
    public function set color(value:uint):void

引发
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

digitCase

属性 
digitCase:String

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

用于此文本的数字大小写。数字大小写会影响数字字符组的样式和位置。将 DigitCase 常量用于此属性。

默认值为 DigitCase.DEFAULT

要设置此属性的值,请使用下列字符串值:

字符串值说明
DigitCase.DEFAULT对文本应用默认数字大小写。
DigitCase.LINING对文本应用全高数字大小写。
DigitCase.OLD_STYLE对文本应用旧样式数字大小写。

子类设置属性的效果
GraphicElement没有任何效果。
GroupElement没有任何效果。
TextElement确定用于元素中的文本的数字大小写。



实现
    public function get digitCase():String
    public function set digitCase(value:String):void

引发
ArgumentError — 如果设置的值不是 DigitCase 的成员。
 
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

相关 API 元素

digitWidth

属性 
digitWidth:String

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

用于此文本的数字宽度。将 DigitWidth 常量用于此属性。

默认值为 DigitWidth.DEFAULT

要设置此属性的值,请使用下列字符串值:

字符串值说明
DigitWidth.DEFAULT对文本应用默认数字宽度。
DigitWidth.PROPORTIONAL对文本应用变宽数字宽度。
DigitWidth.TABULAR对文本应用定宽数字宽度。

子类设置属性的效果
GraphicElement没有任何效果。
GroupElement没有任何效果。
TextElement确定用于元素中的文本的数字宽度。



实现
    public function get digitWidth():String
    public function set digitWidth(value:String):void

引发
ArgumentError — 如果设置的值不是 DigitWidth 的成员。
 
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

相关 API 元素

dominantBaseline

属性 
dominantBaseline:String

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

指定用作主要基线的基线类型。将主要基线与对齐基线对齐以确定元素在行中的垂直位置。对此属性使用 TextBaseline 常量。

元素的内容将确定基线。对于 TextElement,字体和点值将确定基线。对于 GraphicElement,元素的高度将确定基线。

默认值为 TextBaseline.ROMAN

要设置此属性的值,请使用下列字符串值:

字符串值说明
TextBaseline.ROMAN元素的罗马字基线将与 alignmentBaseline 对齐。
TextBaseline.ASCENT元素的上缘基线将与 alignmentBaseline 对齐。
TextBaseline.DESCENT元素的下缘基线将与 alignmentBaseline 对齐。
TextBaseline.IDEOGRAPHIC_TOP元素的表意顶部基线将与 alignmentBaseline 对齐。
TextBaseline.IDEOGRAPHIC_CENTER元素的表意中心基线将与 alignmentBaseline 对齐。
TextBaseline.IDEOGRAPHIC_BOTTOM元素的表意底部基线将与 alignmentBaseline 对齐。

子类设置属性的效果
GraphicElement确定图形元素的哪些基线将与 alignmentBaseline 对齐。
GroupElement没有任何效果。
TextElement确定文本元素的哪些基线将与 alignmentBaseline 对齐。



实现
    public function get dominantBaseline():String
    public function set dominantBaseline(value:String):void

引发
ArgumentError — 如果设置的值不是 TextBaseline 的成员。
 
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

相关 API 元素

fontDescription

属性 
fontDescription:FontDescription

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

其属性说明字体的对象。

默认值为默认构造的 FontDescription 对象。

如果设置了 fontDescription 属性,提供的 FontDescription 对象已锁定,则 locked 属性将设置为 true。无法修改已锁定 FontDescription。

子类设置属性的效果
GraphicElement没有任何效果。
GroupElement没有任何效果。
TextElement确定用于元素中的文本的字体。



实现
    public function get fontDescription():FontDescription
    public function set fontDescription(value:FontDescription):void

引发
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

相关 API 元素

fontSize

属性 
fontSize:Number

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

文本的大小,以像素为单位。

默认值为 12.0

子类设置属性的效果
GraphicElement没有任何效果。
GroupElement没有任何效果。
TextElement确定元素中的文本的大小(以像素为单位)。



实现
    public function get fontSize():Number
    public function set fontSize(value:Number):void

引发
ArgumentError — 如果设置为小于零的值。
 
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

kerning

属性 
kerning:String

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

字距调整可调整某些字符对之间的像素以提高可读性。具有字距微调表的所有字体都支持字距调整。

默认值为 Kerning.ON

要设置该属性的值,请使用 Kerning 类中的下列常量:

字符串值说明
Kerning.ON启用字距调整。
Kerning.OFF禁用字距调整。
Kerning.AUTO除不适合采用中文版式的字符外均已启用字距调整。如果两个字符都不是日文汉字、平假名或片假名,则在这两个字符之间应用字距调整。

子类设置属性的效果
GraphicElement没有任何效果。
GroupElement确定是否在组中的相邻文本元素间应用字距调整。如果组的 elementFormat 为 null,则使用相邻元素中第一个元素的格式。
TextElement确定是否在文本元素中的字符间应用字距调整。



实现
    public function get kerning():String
    public function set kerning(value:String):void

引发
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

相关 API 元素

ligatureLevel

属性 
ligatureLevel:String

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

用于此文本的连字级别。由两个或两个以上的字母结合在一起形成单个字型时就是连字。连字通常用于替换一些共享公共部分的连续字符,例如字母对“fi”、“fl”或“ae”。在拉丁语字符集和非拉丁语字符集中均可使用连字。将 LigatureLevel 常量用于此属性。

默认值为 LigatureLevel.COMMON

要设置此属性的值,请使用下列字符串值:

字符串值说明
LigatureLevel.NONE不创建任何连字。
LigatureLevel.MINIMUM创建最少的连字。
LigatureLevel.COMMON创建常见连字。
LigatureLevel.UNCOMMON创建不常见连字。
LigatureLevel.EXOTIC创建外来语连字。

子类设置属性的效果
GraphicElement没有任何效果。
GroupElement确定组中相邻文本元素间的连字级别。如果组的 elementFormat 为 null,则使用相邻元素中第一个元素的格式。
TextElement确定文本元素中字符间的连字级别。



实现
    public function get ligatureLevel():String
    public function set ligatureLevel(value:String):void

引发
ArgumentError — 如果设置的值不是 LigatureLevel 的成员。
 
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

相关 API 元素

locale

属性 
locale:String

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

文本的区域设置。控制大小写转换和形状。使用标准区域设置标识符。例如,"en"、"en_US" 和 "en-US" 均表示英语,"ja" 表示日语。有关区域设置代码列表的信息,请参阅 iso639-2 code list

默认值为 "en"

子类设置属性的效果
GraphicElement没有任何效果。
GroupElement没有任何效果。
TextElement确定元素中文本的转换和形状。



实现
    public function get locale():String
    public function set locale(value:String):void

引发
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

locked

属性 
locked:Boolean

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5., Flash Lite 4

表示 ElementFormat 是否已锁定。如果为 true,将无法修改 ElementFormat。调用 ElementFormat.clone() 获取 ElementFormat 对象的没有锁定的副本。



实现
    public function get locked():Boolean
    public function set locked(value:Boolean):void

引发
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

textRotation

属性 
textRotation:String

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

设置应用于各个字型的旋转。将 TextRotation 类中定义的常量用于此属性。

默认值为 TextRotation.AUTO

任何字型的最终旋转均为 ElementFormat.textRotationContentElement.textRotationTextBlock.lineRotation 之和。

您通常将此属性用于亚洲文字,在其中必须旋转字符才能在垂直布局中正确显示。将 TextRotation.AUTOTextBlock.lineRotation = TextRotation.ROTATE_90 结合使用以实现该目的。

对不包含垂直布局信息的字体设置此属性可能会产生不良结果。包含 vmtx 或 VORG 表的字体(例如,日文字体、“MS Mincho”)能够正常工作,因为这些表提供布局引擎显示正确布局所需的数据。而未包含必要信息的字体(例如 Verdana)则不能正常工作。

要设置此属性的值,请使用下列字符串值:

字符串值说明
TextRotation.ROTATE_0不旋转字型。
TextRotation.ROTATE_90将字型顺时针旋转 90 度。
TextRotation.ROTATE_180将字型旋转 180 度。
TextRotation.ROTATE_270将字型顺时针旋转 270 度。
TextRotation.AUTO指定仅将全角和宽字型沿逆时针方向旋转 90 度,这是由字型的 Unicode 属性确定的。此值通常与亚洲文字一起使用,以便仅旋转那些需要旋转的字型。此旋转仅应用在垂直文本中,以将全角字符和宽字符返回到垂直方向,而不会影响其他的字符。

子类设置属性的效果
GraphicElement没有任何效果。
GroupElement没有任何效果。
TextElement确定文本元素中字型的旋转。



实现
    public function get textRotation():String
    public function set textRotation(value:String):void

引发
ArgumentError — 如果设置的值不是 TextRotation 的成员。
 
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

相关 API 元素

trackingLeft

属性 
trackingLeft:Number

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5., Flash Lite 4

应用到每个字型左侧的间距或手动字距调整(以像素为单位)。如果启用 kerning,则会将 trackingLeft 值与字体字距微调表中的值相加。如果禁用 kerning,则使用 trackingLeft 值作为手动字距调整值。同时支持正值和负值。

通常,在 trackingRighttrackingLeft 之间拆分所需的间距值。否则,在混合方向文本中,一个双向边界处间距加倍,而另一个双向边界处不存在间距。

默认值为 0.0

子类设置属性的效果
GraphicElement确定应用到图形左侧的间距。
GroupElement没有任何效果。
TextElement确定应用到文本元素中字符左侧的间距。

示例:

          //positive tracking added to kerning
          var ef1:ElementFormat = new ElementFormat();
          ef1.kerning = flash.text.engine.Kerning.ON;
          ef1.trackingLeft = 0.5;
     
          //negative manual kerning
          var ef2:ElementFormat = new ElementFormat();
          ef2.kerning = flash.text.engine.Kerning.OFF;
          ef2.trackingLeft = -1.0;
     



实现
    public function get trackingLeft():Number
    public function set trackingLeft(value:Number):void

引发
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

trackingRight

属性 
trackingRight:Number

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5., Flash Lite 4

应用到每个字型右侧的间距或手动字距调整(以像素为单位)。如果启用 kerning,则会将 trackingRight 值与字体字距微调表中的值相加。如果禁用 kerning,则使用 trackingRight 值作为手动字距调整值。同时支持正值和负值。

通常,在 trackingRighttrackingLeft 之间拆分所需的间距值。否则,在混合方向文本中,一个双向边界处间距加倍,而另一个双向边界处不存在间距。

默认值为 0.0

子类设置属性的效果
GraphicElement确定应用到图形右侧的间距。
GroupElement没有任何效果。
TextElement确定应用到文本元素中字符右侧的间距。

示例:

          //positive tracking added to kerning
          var ef1:ElementFormat = new ElementFormat();
          ef1.kerning = flash.text.engine.Kerning.ON;
          ef1.trackingRight = 0.5;
     
          //negative manual kerning
          var ef2:ElementFormat = new ElementFormat();
          ef2.kerning = flash.text.engine.Kerning.OFF;
          ef2.trackingRight = -1.0;
     



实现
    public function get trackingRight():Number
    public function set trackingRight(value:Number):void

引发
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

typographicCase

属性 
typographicCase:String

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

用于此文本的印刷大小写。将 TypographicCase 类中定义的常量用于此属性。

默认值为 TypographicCase.DEFAULT

要设置此属性的值,请使用下列字符串值:

字符串值说明
TypographicCase.DEFAULT指定正常大小写用于所有字符。
TypographicCase.TITLE指定大写字符在输出时使用标题字型。
TypographicCase.CAPS指定在输出时调整大写字符的间距。
TypographicCase.SMALL_CAPS指定大写字符在输出时使用小型大写字母字型。
TypographicCase.UPPERCASE指定所有字符在输出时都使用大写字型。
TypographicCase.LOWERCASE指定所有字符在输出时都使用小写字型。
TypographicCase.CAPS_AND_SMALL_CAPS指定所有小写字符在输出时都使用小型大写字母字型。

子类设置属性的效果
GraphicElement没有任何效果。
GroupElement没有任何效果。
TextElement确定用于元素中的文本的印刷大小写。



实现
    public function get typographicCase():String
    public function set typographicCase(value:String):void

引发
ArgumentError — 如果设置的值不是 TypographicCase 的成员。
 
IllegalOperationError — 如果在锁定 ElementFormat 对象(lockedtrue)之后进行设置。

相关 API 元素

构造函数详细信息

ElementFormat

()构造函数
public function ElementFormat(fontDescription:FontDescription = null, fontSize:Number = 12.0, color:uint = 0x000000, alpha:Number = 1.0, textRotation:String = "auto", dominantBaseline:String = "roman", alignmentBaseline:String = "useDominantBaseline", baselineShift:Number = 0.0, kerning:String = "on", trackingRight:Number = 0.0, trackingLeft:Number = 0.0, locale:String = "en", breakOpportunity:String = "auto", digitCase:String = "default", digitWidth:String = "default", ligatureLevel:String = "common", typographicCase:String = "default")

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

创建 ElementFormat 对象。

参数
fontDescription:FontDescription (default = null) — 标识要与此元素格式一起使用的字体的 FontDescription 对象。默认值为 null。如果未提供字体说明,则构造默认字体说明。
 
fontSize:Number (default = 12.0) — 文本的大小,以像素为单位。
 
color:uint (default = 0x000000) — 文本的颜色。包含三个 8 位 RGB 颜色成分的十六进制数字;例如,0xFF0000 为红色,0x00FF00 为绿色。
 
alpha:Number (default = 1.0) — 基于元素格式应用于所有行 atom 的 alpha 属性。
 
textRotation:String (default = "auto") — 应用于各个字型的旋转。将 TextRotation 常量用于此属性。
 
dominantBaseline:String (default = "roman") — 文本中的字型紧贴到的基线。对此属性使用 TextBaseline 常量。
 
alignmentBaseline:String (default = "useDominantBaseline") — 字型所在行上的基线,主要基线将贴紧到此基线。对此属性使用 TextBaseline 常量。
 
baselineShift:Number (default = 0.0) — 文本的基线偏移,以像素为单位。
 
kerning:String (default = "on") — 用于此文本的字距调整。使用 Kerning 类中定义的常量。
 
trackingRight:Number (default = 0.0) — 应用到每个字型右侧的间距或手动字距调整(以像素为单位)。
 
trackingLeft:Number (default = 0.0) — 应用到每个字型左侧的间距或手动字距调整(以像素为单位)。
 
locale:String (default = "en") — 文本的区域设置。
 
breakOpportunity:String (default = "auto") — 应用于此文本的换行。将 BreakOpportunity 常量用于此属性。
 
digitCase:String (default = "default") — 用于此文本的数字大小写。将 DigitCase 常量用于此属性。
 
digitWidth:String (default = "default") — 用于此文本的数字宽度。将 DigitWidth 常量用于此属性。
 
ligatureLevel:String (default = "common") — 用于此文本的连字级别。将 LigatureLevel 常量用于此属性。
 
typographicCase:String (default = "default") — 用于此文本的印刷大小写。将 TypographicCase 常量用于此属性。

引发
ArgumentError — 指定的 fontSize 小于 0。
 
ArgumentError — 指定的 textRotation 不是 TextRotation 的成员。
 
ArgumentError — 指定的 dominantBaseline 不是 TextBaseline 的成员。
 
ArgumentError — 指定的 alignmentBaseline 不是 TextBaseline 的成员。
 
ArgumentError — 指定的 kerning 不是 Kerning 的成员。
 
ArgumentError — 指定的 breakOpportunity 不是 BreakOpportunity 的成员。
 
ArgumentError — 指定的 digitCase 不是 DigitCase 的成员。
 
ArgumentError — 指定的 digitWidth 不是 DigitWidth 的成员。
 
ArgumentError — 指定的 ligatureLevel 不是 LigatureLevel 的成员。
 
ArgumentError — 指定的 typographicCase 不是 TypographicCase 的成员。
方法详细信息

clone

()方法
public function clone():ElementFormat

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

构造 ElementFormat 的没有锁定的克隆副本。

返回
ElementFormatElementFormat 对象的没有锁定的副本。

示例  ( 如何使用本示例 )

此示例创建了一个 ElementFormat 对象并设置了 FontSize。使用 ElementFormat 创建新的 TextElement(因此锁定它),并将 TextElement 用作 TextBlock 的内容。从 TextBlock 创建的文本行。

要修改 ElementFormat 对象,请首先检查其 locked 属性。如果为 true,则使用 clone() 方法创建 ElementFormat 的没有锁定的副本,更改其属性,然后将此新的 ElementFormat 重新链接到 TextBlock。重新断开这些行后,新行将具有新的字体设置。

package {

    import flash.display.Sprite;
    import flash.text.engine.*;

    
    public class ElementFormat_cloneExample extends Sprite {
        private var ef1:ElementFormat;
        private var ef2:ElementFormat;
        
        public function ElementFormat_cloneExample():void {
            var fd:FontDescription = new FontDescription();
            fd.fontLookup = flash.text.engine.FontLookup.DEVICE;
            fd.fontName = "Palatino";

            var ef1:ElementFormat = new ElementFormat(fd);
            ef1.fontSize=20;
            
            var str:String = "This is flash text 0123456789";
            var tb:TextBlock = new TextBlock();
            var te1:TextElement = new TextElement(str, ef1);
            tb.content = te1;
            var line1:TextLine = tb.createTextLine(null, 600);
            addChild(line1);
            
            ef2 = (ef1.locked) ? ef1.clone() : ef1;    
            ef2.fontSize = 32;

            tb.content.elementFormat=ef2;
            var line2:TextLine = tb.createTextLine(null, 600);
            addChild(line2);
            
        }
    }    
}

getFontMetrics

()方法 
public function getFontMetrics():FontMetrics

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

返回一个 FontMetrics 对象,该对象的属性说明由 fontDescriptionfontSize 指定的字体的全角字框、删除线位置、删除线粗细、下划线位置和下划线粗线。

返回
FontMetrics — 说明由 fontDescription 指定的字体的属性的 FontMetrics 对象。

相关 API 元素


示例  ( 如何使用本示例 )

此示例创建了一个具有指定的 FontDescriptionElementFormat 对象,并使用 getFontMetrics 方法显示 24 点的所选字体的度量。
package {

    import flash.display.Sprite;
    import flash.text.engine.*;

    
    public class FontMetricsExample extends Sprite {
        
        public function FontMetricsExample():void {
            var fd:FontDescription = new FontDescription();
            fd.fontName = "Garamond";
            fd.fontWeight = flash.text.engine.FontWeight.BOLD;

            var ef1:ElementFormat = new ElementFormat(fd);
            ef1.fontSize = 24;            
            var fm1:FontMetrics = ef1.getFontMetrics();

            trace(fm1.emBox);
            trace(fm1.strikethroughOffset);
            trace(fm1.strikethroughThickness);
            trace(fm1.subscriptScale);
            trace(fm1.subscriptOffset);
            trace(fm1.superscriptScale);
            trace(fm1.superscriptOffset);
            trace(fm1.underlineOffset);
            trace(fm1.underlineThickness);
            
            
        }
    }    
}
ElementFormatExample.as

此示例创建了两个 ElementFormat 对象并设置了它们的一些属性。然后,该示例将新的 ElementFormat 分配给 TextElement 对象,该对象已经被指定为 TextBlock 的内容。请注意,更改 TextElementElementFormat 不会影响父 TextBlock 以前创建的 TextLine。

package {

    import flash.display.Sprite;
    import flash.text.engine.*;

    
    public class ElementFormatExample extends Sprite {
        
        public function ElementFormatExample():void {
            var fd:FontDescription = new FontDescription();
            fd.fontName = "Garamond";
            fd.fontWeight = flash.text.engine.FontWeight.BOLD;

            var ef1:ElementFormat = new ElementFormat(fd);
            ef1.fontSize = 30;
            ef1.color = 0xFF0000;
            ef1.alpha = 100;
            ef1.kerning = flash.text.engine.Kerning.ON;
            ef1.trackingRight = 2;
            ef1.typographicCase = flash.text.engine.TypographicCase.UPPERCASE;
            ef1.alignmentBaseline = flash.text.engine.TextBaseline.DESCENT;
            ef1.ligatureLevel = flash.text.engine.LigatureLevel.EXOTIC;
            
            var ef2:ElementFormat = new ElementFormat(fd);
            ef2.fontSize = 30;
            ef2.color = 0xFF0000;
            ef2.alpha = 0.3;
            ef2.kerning = flash.text.engine.Kerning.OFF;
            ef2.typographicCase = flash.text.engine.TypographicCase.LOWERCASE;
            ef2.digitCase = flash.text.engine.DigitCase.OLD_STYLE;
            ef2.textRotation = flash.text.engine.TextRotation.ROTATE_180;
            
            var str:String = "This is flash text 0123456789";
            var tb:TextBlock = new TextBlock();
            var te1:TextElement = new TextElement(str, ef1);
            tb.content = te1;
            var line1:TextLine = tb.createTextLine(null, 600);
            addChild(line1);
            line1.x = 15;
            line1.y = 30;

            tb.content.elementFormat = ef2;
            var line2:TextLine = tb.createTextLine(null, 600);
            addChild(line2);
            line2.x = 15;
            line2.y = 60;
            
        }
    }    
}




[ X ]为什么显示为英语?
《ActionScript 3.0 参考》中的内容以英语显示

《ActionScript 3.0 参考》中的部分内容未翻译成所有语言。当某个语言元素未翻译时,将显示为英语。例如,ga.controls.HelpBox 类未翻译成任何语言。因此在简体中文版的参考中,ga.controls.HelpBox 类显示为英语。