API review: RT-27762: Text not centered vertically in bounds for windows default 12px

Felipe Heidrich felipe.heidrich at oracle.com
Tue Feb 26 11:20:17 PST 2013


Honestly I couldn't think of a good name, I nearly named CENTER (so that the bounds type are LOGICAL, VISUAL, CENTER). Maybe LOGICAL_CENTER (as we will never have a horizontal variation of this).

Other problem Jasper brought up is that we can't set this mode on caspian (as it already has uneven padding to workaround this problem). While we could detected the theme name in the code to decide when to set the mode it felt a bit hacky. A cleaner solution is to make Text#boundsTypeProperty() styleable. What do you think ?


Felipe


On Feb 26, 2013, at 9:28 AM, Richard Bair wrote:

> I probably would go with LOGICAL_VERTICAL_CENTER in this case (longer but code-complete is my friend).
> 
> What do you think?
> 
> Richard
> 
> On Feb 25, 2013, at 4:48 PM, Felipe Heidrich <felipe.heidrich at oracle.com> wrote:
> 
>> Hi,
>> 
>> In order to fix RT-27762 Jasper and I have been experiment with a new type of text bounds.
>> 
>> What this new type does is to change the metrics of the node so that the pixel space above the bellow the cap height are the same (either by increasing the descent, or the internal leading).
>> We are do this to improve the visual appearance of UI components holding vertically centered text, such buttons, labels, and others.
>> 
>> New API proposal:
>> 
>> TextBoundsType#LOGICAL_V_CENTER:
>>     /**
>>      * Use logical vertical centered bounds as the basis for calculating the bounds.
>>      * <p>
>>      * This bounds type is typically used to center {@code Text} nodes vertically
>>      * within the bounds of its parent.
>>      */
>>     LOGICAL_V_CENTER
>> 
>> Here is a screenshot of new mode in action (hopping the mailing allows attachments):
>> Left is regular logical bounds, right is logical v center bounds, you need ninja eyes to see the difference:
>> 
>> <RT-27762.png>
>> 
>> Regards
>> Felipe
> 



More information about the openjfx-dev mailing list