WoW:XML/Font: Difference between revisions

From AddOn Studio
< XML
Jump to navigation Jump to search
(Created page with "{{uixml}} Font is a special element that allows FontString properties to be more easily defined for inheriting. The Font element ...")
 
m (Move page script moved page XML/Font to XML/Font without leaving a redirect)
(No difference)

Revision as of 04:49, 15 August 2023

XML UI ← XML elements < Font

Font is a special element that allows FontString properties to be more easily defined for inheriting. The Font element can be used in a XML/Ui element.

Inheritance

Inherited by: FontString, Inherits: none, Defined in: Ui

Elements

Attributes

  • name (string)
  • inherits (string)
  • virtual (bool) - Default is 'false'.
  • font (string)
  • spacing (float) - Default is '0'.
  • outline (OUTLINE) - Default is 'NONE'.
  • monochrome (bool) - Default is 'false'.
  • justifyV (JUSTIFYV) - Default is 'MIDDLE'.
  • justifyH (JUSTIFYH) - Default is 'CENTER'.
  • height (int) - font height. is inline alternative to <FontHeight>

Summary

Font is one of the few types that can be virtually inherited by more than one type. Fonts can inherit other Fonts and FontStrings can inherit Fonts. The primary purpose of Font is to avoid having to create virtual FontStrings which are expensive since they are fully renderable elements.

Example

<Ui xmlns="http://www.blizzard.com/wow/ui/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Font name="MyFont" font="myfont.ttf" virtual="true">
    <FontHeight>
      <AbsValue val="12"/>
    </FontHeight>
  
  <Frame name="MyFrame">
    <Size x="200" y="200"/>
    <Layers>
      <Layer>
        <FontString text="Bob" inherits="MyFont">
          <Size x="100" y="100"/>
          <Anchors>
            <Anchor point="TOP"/>
          </Anchors>
        </Texture>
      </Layer>
    </Layers>
  </Frame>
</Ui>

This example creates a Font that is used by a FontString. Demonstrates using Font to simplify use of FontString.

Notes

  • height attribute added 6.1.0