font question

Bob Arning arning at charm.net
Fri Jun 6 16:22:40 UTC 2003


On Fri, 6 Jun 2003 08:35:20 -0700 Ned Konz <ned at bike-nomad.com> wrote:
>On Friday 06 June 2003 12:04 am, Joshua 'Schwa' Gargus wrote:
>> Hi,
>>
>> I noticed that the font size for EToy tiles is specified by
>> StandardScriptingSystem>>fontForTiles, which specifies an 18 point
>> font.  However, the font returned has a #pointSize of 12.  The same
>> font is also obtained from the font menu of a TextMorph by choosing
>> the 12pt version.
>>
>> This seems to be true for quite a number of fonts.  Eg: StrikeFont
>> familyName: #NewYork size: 24 yields a point size of 18.
>
>18 points = 24 pixels at 92 pixels/inch?

This might help a bit:

	| f |
	((1 to: 30) collect: [ :n |
		f _ StrikeFont familyName: #NewYork size: n.
		{
			n.
			f pointSize.
			f height.
			f ascent.
			f descent.
			f.
		}
	]) explore.

#familyName:size: answers the smallest font at least n pixels in height, so you get the same "pointSize = 18" font when you ask for sizes 21 through 25. Note that this font has three pixels of leading, so the overall height of 21 is really 18 pixels of character data + 3 pixels of leading. 

Cheers,
Bob



More information about the Squeak-dev mailing list