[BUG][FIX] StrikeFont: fonts in italics a incomplete

Boris Gaertner Boris.Gaertner at gmx.net
Sun Oct 6 11:38:29 UTC 2002


This report is for Squeak 3.2, latest update: 4917

As you know, a font in italics is a so-called derived font: It is created
from the basal font by shearing. This is implemented in method
StrikeFont>>makeItalicsGlyphs.

Derived fonts are purged when you save the image; they are created
again when they are needed. In Squeak 3.2, the fonts in italics do not
include all glyphs of the basal font.

To see that bug, do this:
1. Open a workspace, select the font style "NewYork' and
   the font size 12.

2. Type this into the workspace and evaluate it with 'print it':
    'Zw', (String with: (Character value: 16r9A)), 'lf'

   This is the german word for 'twelve' and I gave it in the form
   above because not all of you have german keyboards.

3. Now change the font to italics. (Press 'alt' and '8' simultaneously
    to do that.) You see a space where the third letter should be shown.

You can demonstrate this bug also with the accented characters that
are needed to write french or spanish.

My analysis showed that the glyph form for the font in italics is
not created wide enough. To prove that, insert this statement
in method makeItalicGlyphs:

Transcript show: newGlyphs width printString;
         show: '   ';
         show: newXTable printString; cr.

This statement should follow the assignment:

 xTable _ newXTable.

In method makeItalicGlyphs, a small extra width is added to
the form that will take the new glyphs.  That extra width has
to be added not once, but once for every glyph!

So, instead of

 newGlyphs _ Form extent: (glyphs width + extraWidth) @ glyphs height.

we have to write:

 newGlyphs _ Form extent: (glyphs width + (maxAscii + 1 -
minAscii*extraWidth)) @ glyphs height.

You find this change in tha attached change set.

When you have installed the attached fix, you have to save and quit the
image.
As soon as you start again, derived fonts are created again when needed.
When you repeat the test above, you will see all characters of the word.

For the benefit of those that write european languages other than english,
I recommend to add this fix to Squeak 3.2, too.

Greetings,
Boris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ItalicStrikeFont.2.cs
Type: application/octet-stream
Size: 1670 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20021006/f32e7b76/ItalicStrikeFont.2.obj


More information about the Squeak-dev mailing list