Inconsistency when using 'center' value within layout with TEXT_JUSTIFY_VCENTER

NOTE: This is a duplicate thread from my post in the general Connect IQ forum.

Environment:
- MacOS 10.12.2
- Eclipse Neon.2, plug-in 2.2.3
- SDK 2.2.3

Detailed description of the issue:

There is an inconsistency with the way layouts handle vertical center text justification. Specifically, when using TEXT_JUSTIFY_CENTER the location on the Y-axis of the rendered text differs when the y value is set to "center" versus set to the actual pixel value that is the center of the watch.

Steps to reproduce the issue:

When using a 218x218 watch (such as the fenix 3 and derivatives), the center of the watch on the vertical Y axis is 109. So if we use to following layout XML we see the label contents properly centered on the watch (vertically and horizontally).

<layout id="WatchFace">
<label id="TimeLabel" x="center" y="109" font="Gfx.FONT_LARGE" justification="Gfx.TEXT_JUSTIFY_CENTER|Gfx.TEXT_JUSTIFY_VCENTER" color="Gfx.COLOR_BLUE" />
</layout>


But if we use the same layout but change the "109" to "center", which should translate to 109px upon rendering, we end up with label contents up higher than they should be (and thus NOT centered vertically).

<layout id="WatchFace">
<label id="TimeLabel" x="center" y="center" font="Gfx.FONT_LARGE" justification="Gfx.TEXT_JUSTIFY_CENTER|Gfx.TEXT_JUSTIFY_VCENTER" color="Gfx.COLOR_BLUE" />
</layout>


To render the text properly on the Y axis, we have to remove the TEXT_JUSTIFY_VCENTER as such:

<layout id="WatchFace">
<label id="TimeLabel" x="center" y="center" font="Gfx.FONT_LARGE" justification="Gfx.TEXT_JUSTIFY_CENTER" color="Gfx.COLOR_BLUE" />
</layout>


The results of the above three layouts is, respectively, as follows:



The left and middle images should look the same (but they don't) and the right image should have the time slightly displaced given that there is no use of TEXT_JUSTIFY_VCENTER.
Parents
  • I've been looking at the resource compiler a lot recently, and I've found a host of issues that I'd like to fix. Unfortunately, nearly any fix we make will potentially break label placement for existing apps.

    I'm going to try to push for fixing some of these issues, but I have doubts that it will happen due to the potential for breakage.

Reply
  • I've been looking at the resource compiler a lot recently, and I've found a host of issues that I'd like to fix. Unfortunately, nearly any fix we make will potentially break label placement for existing apps.

    I'm going to try to push for fixing some of these issues, but I have doubts that it will happen due to the potential for breakage.

Children
No Data