Android Question About the MeasureStringHeight

Laurent95

Active Member
Licensed User
Longtime User
Hello all,

I have an issue, in a widget i must write numbers on a bitmap with the canvas command 'DrawText'. The widget contains a clock and the widgets doesn't support to change the font of text, only the size & the color.

But if i want give the choice to the user to change the font i don't find the good way for write the numbers on the bitmap with a good alignment.
I have continuously some difference of height alignment between the numbers, that depends the font.
That's due to the true type fonts ?

And if you had a simple sample of code about it, that would be nice.

Any help will be appreciated thanks a lot.
Regards.
 

Laurent95

Active Member
Licensed User
Longtime User
Different fonts can use different spacings. Have you see this class: [custom view] AutoTextSizeLabel ?

Hello Erel,

Damn, that's what i think about the fonts.

Yes i have reading about it.
But i figure out that i can't use it for this case because it's a widget, no ?
Thank you for the response. I will take a look to the class if i can manage it and transfer the result to the widget.

Regards.
 
Upvote 0

Laurent95

Active Member
Licensed User
Longtime User
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…