WoW:XML/FontString: Difference between revisions

From AddOn Studio
< XML
Jump to navigation Jump to search
m (→‎Example: case)
mNo edit summary
Line 1: Line 1:
Derived from: [[XML/LayoutFrame|LayoutFrame]]
{{uixmlelem}}
[[XML/FontString|FontString]] is an element that allows drawing text in the WoW UI. Like [[XML/Texture|Texture]], 'FontString' is a [[XML/LayoutFrame|LayoutFrame]] and is placed in a [[XML/Layer|Layer]] in a [[XML/Frame|Frame]]. Also [[XML/Font|Font]] is a special type for FontString that allows properties to be more easily defined for inheriting or association, rather than using a full [[XML/FontString|FontString]] in a [[XML/Ui]] element for virtual 'non-directly visible' instances.


Elements: FontHeight, Color, Shadow
== Inheritance ==
Inherited by: none, Inherits: [[XML/LayoutFrame|LayoutFrame]], Defined in: [[XML/Layer|Layer]], [[XML/Button|Button]], others<br />
Widget API: [[UIOBJECT FontString|UIObject FontString]]


Attributes: font, bytes, text, spacing, outline, monochrome, nonspacewrap, justifyV, justifyH, maxLines, inherits
== Elements ==
* FontHeight ([[XML/Value|Value]])
* [[XML/Color|Color]]
* [[XML/Shadow|Shadow]]


== Attributes ==
* name (string) - name of this layout frame
* inherits (string) - a virtual [[XML/Font|Font]] or [[XML/FontString|FontString]] to inherit properties from.
* virtual (bool) - Default is 'false'.
* font (string) - resource path to an actual wow font file. not a reference to [[XML/Font|Font]] or [[XML/FontString|FontString]].
* spacing (float) - alters the natural text character spacing. Default is '0'.
* outline ([[XML/OUTLINE|OUTLINE]]) - Default is 'NONE'.
* monochrome (bool) - Default is 'false'.
* justifyV ([[XML/JUSTIFYV|JUSTIFYV]]) - Default is 'MIDDLE'.
* justifyH ([[XML/JUSTIFYH|JUSTIFYH]]) - Default is 'CENTER'.
* bytes - storage bytes to set asside as an optimization to hold text internally. Default is '255'.
* text - actual text to be displayed.
* nonspacewrap - if enabled, will break on characters instead of words. effective only when wordwrap is enabled.
* wordwrap - enables traditional word wrap, where text will wrap around to a new line if it exceeds the frontstring frame width, breaking at the end of the last word that fits the width on any particular line.
* maxLines - the maximum number of lines to render, independant of the size of the fontstring box. text will be constrained by either the heigth of the fontstring frame or the maxLines setting, whichever is smaller.
* indented - indents all but the first line of text. effective only when wordwrap is enbled. Default is 'false'.
== Summary ==
''The Fontstring element is used to display a text in the user interface. The text displayed by the Fontstring element can be changed with the LUA function <fontstringobject>:SetText() or read with the function <fontstringobject>:GetText().''
''The Fontstring element is used to display a text in the user interface. The text displayed by the Fontstring element can be changed with the LUA function <fontstringobject>:SetText() or read with the function <fontstringobject>:GetText().''
=== Example ===
<[[XML/Ui|Ui]] xmlns="http://www.blizzard.com/wow/ui/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <[[XML/Font|Font]] name="MyFont" font="myfont.ttf" virtual="true">
    <FontHeight>
      <AbsValue val="12"/>
    </FontHeight>
  </Font>
  <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.
== Details ==


outline = "NORMAL" or "THICK", monochrome = "true" or "false", justifyV = "TOP", "MIDDLE" or "BOTTOM", justifyH = "LEFT", "RIGHT", "CENTER"
outline = "NORMAL" or "THICK", monochrome = "true" or "false", justifyV = "TOP", "MIDDLE" or "BOTTOM", justifyH = "LEFT", "RIGHT", "CENTER"


inherits can be set to an existing font. If set, the current FontString will take on all of that font's settings, unless overridden in the current FontString.
inherits can be set to an existing font. If set, the current FontString will take on all of that font's settings, unless overridden in the current FontString.


Note: ''<FontString>'' must be within a ''[[XML_User_Interface#Layers_and_Textures|<Layer>]], Attribute "font" needs to be set for element "FontHeight" to work''
Note: ''<FontString>'' must be within a ''[[XML_User_Interface#Layers_and_Textures|&lt;Layer&gt;]], Attribute "font" needs to be set for element "FontHeight" to work''


:{{icon-shortcut}}'''See [{{wdnlink|FrameXML/Fonts.xml}} FrameXML/Fonts.xml]''' for the system default list of inheritable fonts!
:{{icon-shortcut}}'''See [{{wdnlink|FrameXML/Fonts.xml}} FrameXML/Fonts.xml]''' for the system default list of inheritable fonts!

Revision as of 00:54, 19 September 2013

XML UI ← XML elements < FontString

FontString is an element that allows drawing text in the WoW UI. Like Texture, 'FontString' is a LayoutFrame and is placed in a Layer in a Frame. Also Font is a special type for FontString that allows properties to be more easily defined for inheriting or association, rather than using a full FontString in a XML/Ui element for virtual 'non-directly visible' instances.

Inheritance

Inherited by: none, Inherits: LayoutFrame, Defined in: Layer, Button, others
Widget API: UIObject FontString

Elements

Attributes

  • name (string) - name of this layout frame
  • inherits (string) - a virtual Font or FontString to inherit properties from.
  • virtual (bool) - Default is 'false'.
  • font (string) - resource path to an actual wow font file. not a reference to Font or FontString.
  • spacing (float) - alters the natural text character spacing. Default is '0'.
  • outline (OUTLINE) - Default is 'NONE'.
  • monochrome (bool) - Default is 'false'.
  • justifyV (JUSTIFYV) - Default is 'MIDDLE'.
  • justifyH (JUSTIFYH) - Default is 'CENTER'.
  • bytes - storage bytes to set asside as an optimization to hold text internally. Default is '255'.
  • text - actual text to be displayed.
  • nonspacewrap - if enabled, will break on characters instead of words. effective only when wordwrap is enabled.
  • wordwrap - enables traditional word wrap, where text will wrap around to a new line if it exceeds the frontstring frame width, breaking at the end of the last word that fits the width on any particular line.
  • maxLines - the maximum number of lines to render, independant of the size of the fontstring box. text will be constrained by either the heigth of the fontstring frame or the maxLines setting, whichever is smaller.
  • indented - indents all but the first line of text. effective only when wordwrap is enbled. Default is 'false'.

Summary

The Fontstring element is used to display a text in the user interface. The text displayed by the Fontstring element can be changed with the LUA function <fontstringobject>:SetText() or read with the function <fontstringobject>:GetText().

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.

Details

outline = "NORMAL" or "THICK", monochrome = "true" or "false", justifyV = "TOP", "MIDDLE" or "BOTTOM", justifyH = "LEFT", "RIGHT", "CENTER"

inherits can be set to an existing font. If set, the current FontString will take on all of that font's settings, unless overridden in the current FontString.

Note: <FontString> must be within a <Layer>, Attribute "font" needs to be set for element "FontHeight" to work

Template:Icon-shortcutSee [DEPRECATED http://wowprogramming.com/utils/xmlbrowser/live/FrameXML/Fonts.xml FrameXML/Fonts.xml] for the system default list of inheritable fonts!

Code: FontString Widget API

Example

<FontString name="$parentFontString" font="Fonts\FRIZQT__.TTF" text="Example Text" justifyH="LEFT" justifyV="TOP">
  <Color r="1" g="0.8" b="1" a="1"/>
  <FontHeight val="12"/>
  <Anchors>
   <Anchor point="TOPLEFT" relativeTo="$parent" x="20" y="-20" />
  </Anchors>
  <Shadow>
    <Offset x="1" y="1" />
    <Color r="0" g="0" b="0"/>
  </Shadow>
</FontString>