The API is no longer being updated here until further notice. |
<Font> (creates a Font object) defines a font for text-containing elements like <FontString> and <EditBox>.
<Font name="" inherits="" virtual="" font="" spacing="" outline="" monochrome="" justifyV="" justifyH="" height="" fixedSize="" filter=""> <FontHeight /> <Color /> <Shadow /> </Font>
Attributes[]
- name (xs:string? ) - Similar to <LayoutFrame>; normally required but may be omitted inside a <FontFamily>
- inherits (xs:string? ) - Similar to <LayoutFrame>.
- virtual (xs:boolean? ) - Similar to <LayoutFrame>.
- font (xs:string? )
- spacing (xs:float? )
- outline (ui:OUTLINETYPE ?) - "NONE" (default), "NORMAL", "THICK"
- monochrome (xs:boolean? )
- justifyV (ui:JUSTIFYVTYPE ?) - "TOP", "BOTTOM", "MIDDLE" (default)
- justifyH (ui:JUSTIFYVTYPE ?) - "LEFT", "RIGHT", "CENTER" (default)
- height (xs:float? )
- fixedSize (xs:boolean? )
- filter (xs:boolean? )
Child elements[]
<FontHeight> sets the font height.
- val (xs:float) - Sets the font height, scaling dependent.
<Color> sets color using RGB values or a ColorMixin, and alpha.
- r (xs:float? ) - Red component from 0.0 (default) to 1.0.
- g (xs:float? ) - Green component from 0.0 (default) to 1.0.
- b (xs:float? ) - Blue component from 0.0 (default) to 1.0.
- a (xs:float? ) - Alpha (opacity) from 0.0 to 1.0 (default).
- name (xs:string? ) - Name of a ColorMixin made with CreateColor().
<Shadow> places a shadow behind text with a <Color> child tag.
- x (xs:float) - Left (+) or right (-), scaling dependent.
- y (xs:float) - Up (+) or down (-), scaling dependent.
Details[]
- <Font> objects are commonly made as virtual XML templates, as in
FrameXML/SharedFontStyles.xml
, and then inherited by other elements:- <FontString inherits="fontObject">
- <EditBox inherits="fontObject">
- <SimpleHTML inherits="fontObject">
- <MessageFrame inherits="fontObject">
- Alternatively, instantiate a concrete Font object and assign it with the
font=""
attribute or during runtime with FontInstance:SetFontObject(fontObject) - For localising to multiple character sets, the font should reside in a <FontFamily> or inherit from one.
Examples[]
Using a Virtual XML template:
<Font name="MyFontTemplate" virtual="true">
<FontHeight val="12">
<Color name="WHITE_FONT_COLOR" />
</Font>
<FontString inherits="MyFontTemplate" text="Foo" />
Using a concrete Font:
<Font name="MyFont">
<FontHeight val="12">
<Color name="WHITE_FONT_COLOR" />
</Font>
<FontString font="MyFont" text="Bar" />
Patch changes[]
- Patch 7.0.3 (2016-07-19): Added fixedSize and filter attributes.[1]
- Patch 6.1.0 (2015-02-24): Added height attribute; and may now reside in the new <FontFamily> element.[2]
- Patch 1.10.0 (2006-03-28): Added.[3][4]
See also[]
References[]
- ^ 2016-07-19, UI.xsd, version 7.0.3.22267, near line 353, archived at Townlong-Yak
- ^ 2015-02-26, UI.xsd, version 6.1.0.19702, near line 346, archived at Townlong-Yak
- ^ Iriel 2005-12-28. Upcoming 1.10 Changes - Concise List. Archived from the original
- ^ 2006-05-02, UI.xsd, version 1.10.2.5302, near line 223, archived at Townlong-Yak