StrikeFont(NewYork12 15) becomes bold after #saveOnFile

Boris Gaertner Boris.Gaertner at gmx.net
Sun Jun 1 10:21:26 UTC 2003


Stéphane Rollandin <hepta at zogotounga.net> wrote:

>
> ok I did the trick with a TextMorph in NewYork12.
>
> this is what I get in the debugger, when a 'self halt' is prepended to the
> described statement:
>
> self height: 12
> self emphasis: 0
> self familyName: 'NewYork'
>
> now if I put the halt after the statement, I can also check that dp is a
> DiskProxy whose constructorArgs array is indeed #('NewYork 12 0')
>
Ok, this is the first of four StrikeFonts, the smallest one.
The file that you gave us on May 18th contains descriptors for four fonts
and that is not a surprice: These four fonts set up the TextStyle 'NewYork'
When you save the Morph with the 'self halt' that I proposed to you in
my last mail, the debugger will open four times. The second time it
opens, it will show you what will be filed out for the font of size 15 and
that is the most interesting point.

Now a different proposal:

The method Object>>objectForDataStream:
does most of the file-out for almost all classes.
A few classes that need special handling redefine that
method.
You can add this method to the instance protocol of
TextStyle:


objectForDataStream: refStrm
    self halt.
    ^ super objectForDataStream: refStrm


This method delegates the work to the superclass (Object)
but before it does so, it opens the debugger. You can look
into the text style and the interesting element is the value
of instance variable  fontArray. You should see four
StrikeFonts and the second font in the array is that of
size 15. (The pointSize variable of that font has the value 15)
What are the values of instance variables emphasis and name?)

The debugger will open for the TextStyle method first. When you
continue, it will open four times for the four instances of
StrikeFont (Provided that you keep the 'self halt'  in
StrikeFont>>objectForDataStream:) You should always
close the debugger with 'proceed' when it shows the method 'halt'
You can than create the complete *.morph file.

Greetings, Boris





More information about the Squeak-dev mailing list