[FIX] PSPointSizeFix-nk

Ned Konz ned at squeakland.org
Wed Apr 14 01:20:02 UTC 2004


from preamble:

"Change Set:		PSPointSizeFix-nk (v3)
Date:			13 April 2004
Author:			Ned Konz

Postscript output from Squeak has been in pixel units. However, we're
outputting requests for fonts in point units, making the fonts appear
3/4 as big as they should on output.

This change set fixes that problem by also requesting fonts in pixel
units.

v3 (13 April): fixed discrepancy between (ascender+descender) and
(unitsPerEm) in TTCFont. This will rename existing point sizes but keep
glyphs the same size.

v2 (25 March): improved decoding of font names and attributes.

Factored out knowledge of font naming to TextStyle class.

"

"Repair bad sizes *before* installing new code (see TTCFont
class>>repairBadSizes)"

	| description computedScale cached desiredScale newPointSize repaired |
	repaired _ OrderedCollection new.
	TTCFont allInstancesDo: [ :font |
		cached := (font cache copyFrom: $A asciiValue + 1 to: $z asciiValue +
1)
			detect: [ :f | f notNil ] ifNone: [].
		cached := cached ifNil: [  font formOf: $A ] ifNotNil: [ cached value
].
		description _ font ttcDescription.
		desiredScale _ cached height asFloat / (description ascender -
description descender).
		computedScale _ font pixelSize asFloat / font ttcDescription
unitsPerEm.
		(((computedScale / desiredScale) - 1.0 * cached height) abs < 1.0)
ifFalse: [
			newPointSize _ (font pointSize * desiredScale / computedScale)
rounded.
			font pointSize: newPointSize; flushCache.
			repaired add: font.
			font derivativeFonts do: [ :df | df ifNotNil: [
				df pointSize: newPointSize; flushCache.
				repaired add: df. ]].
		].
	].

!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PSPointSizeFix-nk.cs.gz
Type: application/octet-stream
Size: 8584 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040414/9ca2f713/PSPointSizeFix-nk.cs.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Summary.png
Type: application/octet-stream
Size: 44800 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040414/9ca2f713/Summary.obj


More information about the Squeak-dev mailing list