TrueType
Ned Konz
ned at squeakland.org
Sun Mar 20 05:37:04 UTC 2005
On Saturday 19 March 2005 7:50 pm, Ron Jeffries wrote:
> On Saturday, March 19, 2005, at 9:19:45 PM, Yoshiki Ohshima wrote:
> >> Bad font design. The ascender is set too small.
> >
> > I think that the font designer wanted to have the characters
> > overlapped holizontally and vertically.
>
> Yes ... even if you just look at the alphabet in my "good" example,
> you can see that the characters overlap in a very attractive
> fashion.
>
> > We should fix the renderer. It should benefit other languges, such
> > as that require complex ligature.
>
> That would be cool. As it stands, I think I'm stuck with C# ... if
> it can do it right ... or with PhotoShop, which I know can ... but
> I'd have to buy it!
Try the attached fix and see if it does the right thing.
--
Ned Konz
http://bike-nomad.com/squeak/
-------------- next part --------------
'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 19 March 2005 at 9:35:54 pm'!
"Change Set: TTCFontAscentFix-nk
Date: 19 March 2005
Author: Ned Konz
Changes the rendering of TTCFonts to respect the actual contour boundaries, allowing for bounds outside the ascent/descent limits.
"!
!Canvas methodsFor: 'drawing-text' stamp: 'nk 3/19/2005 20:50'!
drawString: s from: firstIndex to: lastIndex at: pt font: font color: aColor
self drawString: s from: firstIndex to: lastIndex in: (Rectangle center: pt extent: 10000 at 10000) font: font color: aColor! !
!TTCFont methodsFor: 'friend' stamp: 'nk 3/19/2005 21:23'!
displayString: aString on: aBitBlt from: startIndex to: stopIndex at: aPoint kern: kernDelta
| destPoint ascii form |
destPoint _ aPoint.
startIndex to: stopIndex do: [:charIndex |
ascii _ (aString at: charIndex) asciiValue bitAnd: 16rFFFFFF.
((ascii between: self minAscii and: self maxAscii) not) ifTrue: [
ascii _ self maxAscii].
form _ self formOf: (aString at: charIndex).
aBitBlt sourceForm: form.
aBitBlt destX: destPoint x.
aBitBlt destY: destPoint y + form offset y.
aBitBlt sourceOrigin: 0 @ 0.
aBitBlt width: form width.
aBitBlt height: form height.
aBitBlt copyBits.
destPoint _ destPoint + (form width + kernDelta @ 0).
].
! !
!TTGlyph methodsFor: 'converting' stamp: 'nk 3/19/2005 21:21'!
asFormWithScale: scale ascender: ascender descender: descender fgColor: fgColor bgColor: bgColor depth: depth replaceColor: replaceColorFlag
| form canvas |
form _ Form extent: (advanceWidth @ (bounds height) * scale) rounded depth: depth.
form fillColor: bgColor.
canvas _ BalloonCanvas on: form.
canvas aaLevel: 4.
canvas transformBy: (MatrixTransform2x3 withScale: scale asPoint * (1 @ -1)).
canvas transformBy: (MatrixTransform2x3 withOffset: 0 @ bounds bottom negated).
canvas
drawGeneralBezierShape: self contours
color: fgColor
borderWidth: 0
borderColor: fgColor.
replaceColorFlag ifTrue: [
form replaceColor: bgColor withColor: Color transparent.
].
form offset: 0 @ ((bounds bottom - ascender) negated * scale) rounded.
^ form! !
More information about the Squeak-dev
mailing list
|