WoW:XML/FontString: Difference between revisions

m
no edit summary
mNo edit summary
Line 3: Line 3:


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


== Elements ==
== Elements ==
* FontHeight ([[XML/Value|Value]])
* FontHeight ([[XML/Value|Value]]) - screen height of the font, 'font' attribute must also be set
* [[XML/Color|Color]]
* [[XML/Color|Color]]
* [[XML/Shadow|Shadow]]
* [[XML/Shadow|Shadow]]
Line 13: Line 13:
== Attributes ==
== Attributes ==
* name (string) - name of this layout frame
* name (string) - name of this layout frame
* inherits (string) - a virtual [[XML/Font|Font]] or [[XML/FontString|FontString]] to inherit properties from.
* inherits (string) - a virtual [[XML/Font|Font]], [[XML/FontFamily|FontFamily]] or [[XML/FontString|FontString]] to inherit properties from.
* virtual (bool) - Default is 'false'.
* 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]].
* font (string) - resource path to an actual wow font file. '''not''' a reference to [[XML/Font|Font]], [[XML/FontFamily|FontFamily]] or [[XML/FontString|FontString]].
* spacing (float) - alters the natural text character spacing. Default is '0'.
* spacing (float) - alters the natural text character spacing. Default is '0'.
* outline ([[XML/OUTLINE|OUTLINE]]) - Default is 'NONE'.
* outline ([[XML/OUTLINE|OUTLINE]]) - Default is 'NONE'.
Line 22: Line 22:
* justifyH ([[XML/JUSTIFYH|JUSTIFYH]]) - Default is 'CENTER'.
* justifyH ([[XML/JUSTIFYH|JUSTIFYH]]) - Default is 'CENTER'.
* bytes - storage bytes to set asside as an optimization to hold text internally. Default is '255'.
* bytes - storage bytes to set asside as an optimization to hold text internally. Default is '255'.
* text - actual text to be displayed.
* text - actual text to be displayed, or predefined WoW constant that gets replaced with localized text.
* nonspacewrap - if enabled, will break on characters instead of words. effective only when wordwrap is enabled.
* 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.
* 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 character or 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.
* 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'.
* indented - indents all but the first line of text. effective only when wordwrap is enbled. Default is 'false'.
Line 32: Line 32:


=== Example ===
=== Example ===
  <[[XML/Ui|Ui]] xmlns="http://www.blizzard.com/wow/ui/"
  <[[XML/Ui|Ui]] xmlns="http://www.blizzard.com/wow/ui/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <[[XML/Font|Font]] name="MyFont" font="myfont.ttf" virtual="true">
   <[[XML/Font|Font]] name="MyFont" font="myfont.ttf" virtual="true">
     <FontHeight>
     <FontHeight>
Line 53: Line 54:
   </Frame>
   </Frame>
  </Ui>
  </Ui>


This example creates a Font that is used by a FontString.
This example creates a Font that is used by a FontString.


== Details ==
== Details ==
=== Specific Options ===
* outline = NORMAL, THICK
* monochrome = true, false
* justifyV = TOP, MIDDLE, BOTTOM
* justifyH = LEFT, CENTER, RIGHT


outline = "NORMAL" or "THICK", monochrome = "true" or "false", justifyV = "TOP", "MIDDLE" or "BOTTOM", justifyH = "LEFT", "RIGHT", "CENTER"
=== Inheritance ===
 
FontString 'Inherits', in addition to being able to be set to another FontString, can also be set to an existing Font or FontFamily. 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|&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!


Code: [[Widget_API#FontString|FontString Widget API]]
=== Localization ===
In addition to setting a 'text' value to a localized string programmatically via WoW Lua run after the XML is loaded, text can also be replaced with a localized string automatically via one of the WoW pre-defined localization constants. For example text="GENERAL_MACROS" would get replaced with text="General Macros" for English text settings, or the Spanish version for Spanish text settings. The value must be one of the pre-defined localization constants or the FontString will simply display the literal text you gave it for the 'text' attribute.


==== Example ====
=== Another Example ===


  <FontString name="$parentFontString" font="Fonts\FRIZQT__.TTF" text="Example Text" justifyH="LEFT" justifyV="TOP">
  <FontString name="$parentFontString" font="Fonts\FRIZQT__.TTF"
      text="Example Text" justifyH="LEFT" justifyV="TOP">
   <Color r="1" g="0.8" b="1" a="1"/>
   <Color r="1" g="0.8" b="1" a="1"/>
   <FontHeight val="12"/>
   <FontHeight val="12"/>
Line 81: Line 85:
   </Shadow>
   </Shadow>
  </FontString>
  </FontString>
== Notes ==
* <FontString> must be within a ''[[XML_User_Interface#Layers_and_Textures|&lt;Layer&gt;]]
* attribute 'font' needs to be set in order for element "FontHeight" to work
== See also ==
* [{{wdnlink|FrameXML/Fonts.xml}} FrameXML/Fonts.xml] - for the system default list of inheritable fonts
* [[Widget_API#FontString]] for more code
[[Category:XML elements]]
[[Category:XML elements]]