Font size and TextMorph
Last updated at 5:13 pm UTC on 15 May 2017
Question: TextMorph abandons 'Principle of Least Astonishment' I don't know if this is considered a bug. but..
(TextMorph new string: 'Text me!' fontName: 'BitstreamVeraSans' size: 26) openInWorld.
shows the proper font but has font size 11.
Answer: Ned Konz November 02, 2004
- Don't confuse 'size' with 'pointSize'.
- The font operations that have 'size' in their names refer to nominal height in pixels.
- A point is not the same as a pixel, these differ by a factor of 96/72 (by default). I picked a nominal factor of 96 dpi because it was close to the actual resolution of today's display devices.
will find the closest pixel size to whatever.
If you ask for a 26 pixel tall font (which is what you did), this is going to find the closest available font size to 26 pixels or 19.5 points (26 * 3/4).
Which apparently was the 11 point font you found.
The Squeak 5.1 help menu,'Tools', 'Font size summary' gives you a list of the available font point sizes.