Italic fonts and cs 1975

Bob Arning arning at charm.net
Tue Apr 25 20:19:43 UTC 2000


Changeset 1975 seems to have introduced some oddities in generated italic fonts. Check a string like 'T H I S  I S  I N  C O D E' in italic in the largest size of NewYork. I sweated over the code for a while and decided to try something simpler. The code below fixes the new glitch as well as the clipped upper right portions of characters. One drawback, however, is that characters are now spaced farther apart. I would appreciate hearing from anyone who cares about the appearance of large italic fonts as to whether the change is a net gain or not.

Cheers,
Bob

===== code follows =====
'From Squeak2.8alpha of 13 January 2000 [latest update: #2005] on 25 April 2000 at 4:09:36 pm'!

!StrikeFont methodsFor: 'emphasis' stamp: 'RAA 4/25/2000 15:57'!
makeItalicGlyphs
	"Make an italic set of glyphs with same widths by skewing left and right
		(may require more intercharacter space)"
	| dest nextX source destRect bb rect delta |

	dest _ Form extent: glyphs extent + ((4 * (maxAscii - minAscii + 1))@0) depth: glyphs depth.
	bb _ WarpBlt toForm: dest.
	bb colorMap: nil.
	bb combinationRule: Form over.
	nextX _ 0.
	minAscii to: maxAscii do: [ :i |
		source _ self characterFormAt: (Character value: i).
		destRect _ nextX at 0 extent: (source width + 4 @ source height).
		bb sourceForm: source.
		rect _ source boundingBox innerCorners.
		rect at: 1 put: (rect at: 1) - (4 at 0).
		rect at: 3 put: (rect at: 3) + (4 at 0).
		bb copyQuad: rect toRect: destRect.
		nextX _ nextX + destRect width
	].
	glyphs _ dest.
	delta _ 0.
	minAscii to: maxAscii do: [ :i |
		delta _ delta + 4.
		xTable at: i+2 put: (xTable at: i+2) + delta.
	].
! !





More information about the Squeak-dev mailing list