[Approved] vertical text alignment (new feature) (1 Viewer)

ajp8164

Portal Pro
January 9, 2008
575
1,166
Atlanta, GA
Home Country
United States of America United States of America
EDIT: added the patch changes for TVE3.

This patch provides skinners the ability to vertically align text for the following controls; label, fadelabel, button. It could be extended to other controls and I'll be happy to look into that if the requests come:)

Each of these controls now have a new attribute as follows:

textvalign - specifies the vertical alignment of the text. Valid values are top, middle, bottom. The default value is "top".

Example:

<textvalign>middle<textvalign>

The vertical text position is computed based on the controls specified height. In all cases the computed position will result in the text being drawn inside the rectangle defined by the controls, x, y, width, height values. If the control has an offset attribute (e.g., textOffY on button control), and it is used then the offset value is added to the calculated position which may result in the text not being placed at the position specified by the textvalign attribute. To avoid this simply set the textOffY attribute to 0.

In each of these controls the legacy behavior of the textalign control attribute (whose values can be left, center, right) is internally inconsistent. The implementation of textalign="center" (unfortunately) centers the text both horizontally and vertically inside the controls rectangle (whereas textalign left or right only adjusts the horizontal position of the text). The result of which is that it is not possible to place the text at a calculated center(x),middle(y) position; in otherwords, if you specify textalign="center" then the value of textvalign is effectively ignored. This implementation preserves the legacy behavior and so it does not break existing skins.

This patch was created from my svn23209 workspace that was modified to include the following patches -- it rolls these patches into this one - anticipating that these patches would be approved and put into svn first ;) This should make it much easier to apply this patch since they overlap quite a bit.

https://forum.team-mediaportal.com/submit-patches-mediaportal-tv-server-etc-325/fadelabel-text-clip-fix-68547/
https://forum.team-mediaportal.com/submit-patches-mediaportal-tv-server-etc-325/keeplook-new-gui-feature-68601/
https://forum.team-mediaportal.com/submit-patches-mediaportal-tv-server-etc-325/borders-your-images-buttons-new-feature-68447/

The following skin xml produces the result show in the attached image. Notice in each of these controls that the x, y, width, height of each control is identical, only the textvalign is different. Hope ya'll like this new capability!

Code:
		<control>
			<type>fadelabel</type>
			<posX>250</posX>
			<posY>600</posY>
			<width>100</width>
			<height>100</height>
			<valign>top</valign>
			<font>rss</font>
			<textcolor>FFFFFFFF</textcolor>
		    <label>Top Top Top</label>
		    <wrapString>...</wrapString>
		</control>
		<control>
			<type>fadelabel</type>
			<posX>250</posX>
			<posY>600</posY>
			<width>100</width>
			<height>100</height>
			<valign>middle</valign>
			<font>rss</font>
			<textcolor>FFFFFFFF</textcolor>
		    <label>Middle Middle</label>
		    <wrapString>...</wrapString>
		</control>
		<control>
			<type>fadelabel</type>
			<posX>250</posX>
			<posY>600</posY>
			<width>100</width>
			<height>100</height>
			<valign>bottom</valign>
			<font>rss</font>
			<textcolor>FFFFFFFF</textcolor>
		    <label>Bottom Bottom</label>
		    <wrapString>...</wrapString>
		</control>
 

Attachments

  • Picture 1.png
    Picture 1.png
    13.4 KB
  • valign_text.patch
    30.6 KB
  • valign_text_tve3.patch
    30.7 KB

pilehave

Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    Sweet. You just keep on rolling out patches I have missed for a full year :D
     

    Users who are viewing this thread

    Top Bottom