Navigation menu

WoW:UIOBJECT FontString: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Describing how fontstring wrapping works in relation to anchor points and width/height)
 
No edit summary
Line 8: Line 8:
Neither of them necessarily directly work with the area used to paint the fontstring. Rather, they're used to compute what dimensions are needed in one direction, given the size in the other direction.
Neither of them necessarily directly work with the area used to paint the fontstring. Rather, they're used to compute what dimensions are needed in one direction, given the size in the other direction.


== Anchoring 1 corner == <div style="margin-left: 3%;">
== Anchoring 1 corner ==  
<div style="margin-left: 3%;">


Let's assume we have a frame that is 100x100, and that we anchor our fontstring to the topleft corner only, and tell it to display a sizeable chunk of text in a 10 point font, that is ~250 pixels long if nonwrapped (i.e. [[API FontString GetStringWidth|GetStringWidth()]] would return 250).
Let's assume we have a frame that is 100x100, and that we anchor our fontstring to the topleft corner only, and tell it to display a sizeable chunk of text in a 10 point font, that is ~250 pixels long if nonwrapped (i.e. [[API FontString GetStringWidth|GetStringWidth()]] would return 250).
Line 16: Line 17:
|
|
* The text runs off as far as it needs to.
* The text runs off as far as it needs to.
* GetWidth() will return return 250, the same as GetStringWidth()
* GetWidth() will return 250, the same as GetStringWidth()
* GetHeight() will return 10
* GetHeight() will return 10
|}
|}
Line 46: Line 47:


</div>
</div>
== Anchoring more points == <div style="margin-left: 3%;">
== Anchoring more points ==
<div style="margin-left: 3%;">


When you control the dimensions by anchoring more than one point, the drawn text will obey your points. But GetWidth() and GetHeight() continue to operate in their own little world.
When you control the dimensions by anchoring more than one point, the drawn text will obey your points. But GetWidth() and GetHeight() continue to operate in their own little world.
Line 54: Line 56:
|
|
* The output gets clamped to 100 pixels wide by the anchor points
* The output gets clamped to 100 pixels wide by the anchor points
* GetWidth() will return return 250 ('''!''')
* GetWidth() will return 250 ('''!''')
* GetHeight() will return return 10 ('''!''')
* GetHeight() will return 10 ('''!''')
|}
|}


Doing SetWidth(100) will result in:
Doing SetWidth(100) will result in:
* The output remains clamped to 100 pixels wide '''by the anchor points'''
* The output remains clamped to 100 pixels wide '''by the anchor points'''
* GetWidth() will return return 100
* GetWidth() will return 100
* GetHeight() will return return 40
* GetHeight() will return 40


Doing SetWidth(50) will result in:
Doing SetWidth(50) will result in:
* The output remains clamped to 100 pixels wide '''by the anchor points'''
* The output remains clamped to 100 pixels wide '''by the anchor points'''
* GetWidth() will return return 50
* GetWidth() will return 50
* GetHeight() will return return 80 (or something)
* GetHeight() will return 80 (or something)


Adding a SetHeight(20) will result in:
Adding a SetHeight(20) will result in:
Anonymous user