TrueType

Ned Konz ned at squeakland.org
Sat Mar 19 21:20:34 UTC 2005


On Saturday 19 March 2005 11:44 am, Ron Jeffries wrote:
> On Saturday, March 19, 2005, at 2:07:24 PM, Ned Konz wrote:
> >> It's still cutting off the tops of letters and
> >>the descenders, though.
> >
> > If you inspect the font itself (open an explorer on a TextMorph and find
> > the font), look at the 'lineGrid' (maybe in the TextStyle), 'ascender',
> > and 'descender' settings. You can change the lineGrid and try again.
>
> lineGrid is 14. There are no settings for ascender and descender
> that I can find. There are three instances of TextStyle accessible
> (that I can find, and two of them are identical, one is not). When I
> change alignment on the one that occurs twice, it will right align
> the next. Changes on the other numbers seem to have no effect.
>
> > Where's the font itself available so we can look at it?
>
> Attached. Please let me know what you find ...
>

Bad font design. The ascender is set too small.

font := ((TextStyle named: #'Bunnigrrrl''shandwriting') fontOfPointSize: 36).
desc := font ttcDescription.
glyph := desc at: $B.

Ok, look at the bounds of the 'B' character:

glyph bounds 17 at -18 corner: 719 at 804

But...
desc ascender 750
desc descender -170

So the region from 750 to 804 (at the top of the B) will be chopped off.

Let's look at the alphabetic characters alone:

Rectangle merging: (($A to: $Z), ($a to: $z) collect: [ :i | (desc at: i) 
bounds ])
 -217 at -581 corner: 1040 at 982

So the ascender would have to be set at least to 982, and the descender to at 
least -581 to get all the characters.

To prove this (and to fix this), try this in a Workspace:

style := TextStyle named: #'Bunnigrrrl''shandwriting'.

style fontArray do: [ :font |
 font flushCache.
 t := TextMorph new
  backgroundColor: Color white;
  beAllFont: font;
  contentsAsIs: (String streamContents: [ :strm | strm print: font pointSize; 
nextPutAll: ' Before:'; cr; nextPutAll: ($A to: $Z); cr; nextPutAll: ($a to: 
$z) ]);
  yourself.
 PNGReadWriter putForm: t imageForm onFileNamed: (font pointSize printString, 
'Before.png')
].

"then fix the font description"
style fontArray first ttcDescription setAscender: 982 descender: -581 lineGap: 
30.

"And make samples again:"

style fontArray do: [ :font |
 font flushCache.
 t := TextMorph new
  backgroundColor: Color white;
  beAllFont: font;
  contentsAsIs: (String streamContents: [ :strm | strm print: font pointSize; 
nextPutAll: ' After:'; cr; nextPutAll: ($A to: $Z); cr; nextPutAll: ($a to: 
$z) ]);
  yourself.
 PNGReadWriter putForm: t imageForm onFileNamed: (font pointSize printString, 
'After.png')
].


See the attached.

> >>And I'm also wondering, just a little, why Squeak is using 15% of my
> >>CPU while it's minimized. 100% when I'm on the Graphics page. But
> >>that's a whole 'nother topic, I guess.
> >
> > What Graphics page?
>
> The squeak project with all the morphs in it. I suppose it's the
> animation that is drilling my CPU.

What animation?


-- 
Ned Konz
http://bike-nomad.com/squeak/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 15After.png
Type: image/png
Size: 7753 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20050319/af5ca83c/15After.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 15Before.png
Type: image/png
Size: 6451 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20050319/af5ca83c/15Before.png


More information about the Squeak-dev mailing list