Points and Pixels
Posted: Tue May 10, 2016 7:32 pm
I've long been intrigued as to why the default height
for buttons and labels is 21. Can anyone explain?
I assume that's pixels. I have reset it to 20 - a
nice round number.
An even number would seem more convenient.
This leads to the real question: If I use a 12-point
font with the eight pixel default margin
the text isn't central between top and bottom.
When I change the margin to 7 this is fixed.
From the internet (where else?) I see that a
12-point fond is 16 pixels.
If 16 + 7 is still 23 this doesn't seem to add up.
Another question: While the Inspector only
shows one number for margins in the Text
settings window the code to set margins requires
four parameters for top, bottom, left and right.
Does the one setting allowed under "Text" apply
to all four parameters?
Is there anywhere to set the other three?
What's the right code to set them in a stack?
All my attempts are given the raspberry by
the debugger.
Update: Seems that the default margin setting of 8
positions the text centrally - but only if the font name
and size are in the Inspector fields.
for buttons and labels is 21. Can anyone explain?
I assume that's pixels. I have reset it to 20 - a
nice round number.
An even number would seem more convenient.
This leads to the real question: If I use a 12-point
font with the eight pixel default margin
the text isn't central between top and bottom.
When I change the margin to 7 this is fixed.
From the internet (where else?) I see that a
12-point fond is 16 pixels.
If 16 + 7 is still 23 this doesn't seem to add up.
Another question: While the Inspector only
shows one number for margins in the Text
settings window the code to set margins requires
four parameters for top, bottom, left and right.
Does the one setting allowed under "Text" apply
to all four parameters?
Is there anywhere to set the other three?
What's the right code to set them in a stack?
All my attempts are given the raspberry by
the debugger.
Update: Seems that the default margin setting of 8
positions the text centrally - but only if the font name
and size are in the Inspector fields.