newButton() Label vertical alignment problem

Anyone else seeing this in newButton() with the 2.0 library? See attached image.

If you want to make a slim button the label doesn’t get vertically centered. Easy to demonstrate with the CL WidgetDemo sample. Goto Tab 3 and reduce the height of the getValuesButton to 20. Even if the font size is too large for the button (and in this case it is not) it should still be centered properly. 

I am also seeing that this issue affects iPhone vs iPad at a different rate. I know I can counter this with labelYOffset but out of the box widgets should center right. Anyways, bug reported for this and was wondering if others are seeing it too. 

Anyone else seeing this beside me?

Can you file a bug report on it?

Case 23968 reported on June 5th

Any luck duplicating this one? 

Anyone else seeing this beside me?

Can you file a bug report on it?

Case 23968 reported on June 5th

Any luck duplicating this one? 

I am wondering if this issue will be tackled at some point in the future. I do understand there is an undocumented labelYOffset feature in widget.newButton but it still does not make sense for me to have to apply an offset to fix the widgets centering problem. How hard is it to center text in the button by default? Thanks for not forgetting about this one. 

have you checked to see if it does it on the device also or just the sim

Yes. This issue affects both the device builds as well as the sim.

Hey ksan,

It is not about being hard, it’s about prioritizing things.

We’ll definitely look at it in the near future.

Thanks,

Alex

Absolutely! I get it. Just wanted to get a confirmation that this is acknowledged as something to be fixed and it is somewhere in the queue. I do realize it is a lower priority item and will wait for its turn to come. Thank you very much!!!

This is quite an issue. I know I can apply labelYOffset values to get the label to appear centered but I need different offset values for each different device type which is yet another thing to worry about when going from device to device. The workaround is almost impossible to use… I think I will have to resort to a bitmap image as button face for the time being. Any idea when this issue is likely to get resolved? Thanks

Hi Kerem,

Just curious, is this in relation to how text inherently doesn’t line up across platforms because of different rendering methods at the OS level? If so, can’t you just sense the device type in your code and pass an offset value in the widget creation? I haven’t discussed with Alex exactly how he planned to solve this, but if it’s related to inherent vertical text alignment, there’s probably not much he can do internally to the widget code. Some fonts get “nudged” more than others, and it also depends on the size of the font, and the source font file. I think very little could be done within the widget code to achieve perfect vertical text alignment across all fonts and OSes.

Brent

Hi Brent,

Given that there are about 4000 different Android devices detecting devices and then offsetting labels accordingly is not something I want to event attempt. The widget button centers the label perfectly in all devices / resolutions provided the button height is over 25 or so. The problem becomes evident when you try to create a slim button. Even though the button at height = 20 still has more than enough room to fit the label vertically the anomaly shown above in the first post starts to occur. The rate of shift seems to be varied from device to device.

I am really hoping this is a simple one to fix for Alex once he gets to it. Regards,

Kerem

Hi Kerem,

I’ll be looking at it tomorrow.

Regarding your comment on Walter’s last blog post, i replied. So please, if you have any other issues with the widgets framework except the ones i already know about, post bug reports with test cases.

Thanks,

Alex

Alex, 

Thanks much! I look forward to your findings and hopefully a fix. 

Regarding my comments on Walter’s recent blog, I stand by them. Only you have access to outstanding issues on widgets (ie the report from bug tracking system) but I can see what I see on the widgets sub-forum and its not looking pretty. No offense to you and your colleagues. I really appreciate your hard work. I am just concerned that all other ‘priorities’ are taking away time from fixing whats broken hence my rant to Walter.

Lets keep our eyes on the goal. Many many thanks for your continued efforts and amazing work. 

Regards,

Kerem

Hi Alex, 

I hope you had a chance to look into this bug yesterday as you were hoping to. Did you have any luck in fixing it? 

Have a great weekend. Regards,

Kerem