適用於 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 標籤
移動 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 指定的字體來描述 emBox、刪除線位置、刪除線粗細、底線位置及底線粗細。
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.AUTO 結合 TextBlock.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只針對全形和寬文字 (由字符的 Unicode 屬性所決定) 指定 90 度逆時針旋轉。此值通常用於亞洲文字,只旋轉那些需要旋轉的字符。此旋轉只適用於垂直文字,以便將全形和寬字元轉為垂直方向,而不影響其它字元。

子類別設定屬性的效果
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

套用至每個字符左方的字距或手動字距微調 (以像素為單位)。如果已啟用 kerningtrackingLeft 值就會加入到該字體之字距微調表中的值。如果已停用 kerningtrackingLeft 值會當做手動字距微調值來使用。同時支援正值與負值。

所需的字距值通常會在 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

套用至每個字符右方的字距或手動字距微調 (以像素為單位)。如果已啟用 kerningtrackingRight 值就會加入到該字體之字距微調表中的值。如果已停用 kerningtrackingRight 值會當做手動字距微調值來使用。同時支援正值與負值。

所需的字距值通常會在 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) — 文字的基線位移 (以像素 em 為單位)。
 
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 指定的字體來描述 emBox、刪除線位置、刪除線粗細、底線位置及底線粗細。

傳回值
FontMetricsFontMetrics 物件,可描述 fontDescription 指定之字體的屬性。

相關 API 元素


範例  ( 如何使用本範例 )

此範例會建立一個 ElementFormat 物件 (內含指定的 FontDescription),然後使用 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 物件並分別為每個物件設定好幾個屬性。接著,它會將新的 ElementFormats 指定給 TextElement 物件,後者先前已經指定為 TextBlock 的內容。請注意,變更 TextElementElementFormat 不會影響先前由父輩 TextBlock 所建立的 TextLines。

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 類別就會以英文顯示。