[squeak-dev] Graphical oddities across image save (squeak 5.1)

Bob Arning arning315 at comcast.net
Sat Oct 7 14:08:31 UTC 2017


Here it is boiled down:

x _ #('Bitmap DejaVu Sans' 'Atlanta') at: 1.
f1 _ Form extent: 100 at 100 depth: 32.
f1 fillColor: Color green.
Form allInstancesDo: [ :f | f hibernate].
f1 getCanvas drawString: 'Black on green' in: (0 at 0 extent: 100 at 100) 
font: (StrikeFont familyName: x size: 12) color: Color black.
f1 asMorph openInWorld.

Do this in a clean 5.1 image and all looks as expected.

Turn off subPixelRendering and the problem appears.

The Atlanta font works fine either way.


On 10/7/17 8:32 AM, Marcel Taeumel wrote:
> Hi Bob,
>
> I would look for state that changes via preferences updates. Here are 
> two side-effects that might help understand the situation:
>
> Preferences class >> #storePreferencesIn:
> It is odd that there is a hidden clean-up of the var "Parameters" in 
> this method. You image might have specifics in that var?
>
> Preference >> #notifyInformeeOfChange
> PragmaPreference >> #notifyInformeeOfChange
> Your current image and a fresh 5.1 image might trigger different 
> amounts of those update calls.
>
> Best,
> Marcel
>>
>> Am 07.10.2017 14:17:48 schrieb Marcel Taeumel <marcel.taeumel at hpi.de>:
>>
>> What's the image version you export your prefs from?
>>
>> Best,
>> Marcel
>>>
>>> Am 07.10.2017 14:15:46 schrieb Bob Arning <arning315 at comcast.net>:
>>>
>>> A bit more on what's happening
>>>
>>> If the font used (the default font in the example below) is a 
>>> StrikeFont, then this
>>>
>>> f1 _ Form extent: 100 at 100 depth: 32.
>>> f1 fillColor: Color green.
>>> Form allInstancesDo: [ :f | f hibernate].
>>> f1 getCanvas drawString: 'Black on green' in: (0 at 0 extent: 100 at 100) 
>>> font: nil color: Color black.
>>> f1 asMorph openInWorld.
>>>
>>> draws black text on a white rectangle on a larger green rectangle. 
>>> StrikeFonts are drawn (in depth 32, anyway) by a primitive using 
>>> rule 34. If the primitive fails, then #copyBits is used character by 
>>> character.
>>>
>>> primDisplayString: aString from: startIndex to: stopIndex map: 
>>> glyphMap xTable: xTable kern: kernDelta
>>>     | ascii |
>>>     <primitive:'primitiveDisplayString' module:'BitBltPlugin'>
>>>     startIndex to: stopIndex do:[:charIndex|
>>>         ascii := (aString at: charIndex) asciiValue.
>>>         glyphMap ifNotNil:[ascii := glyphMap at: ascii+1].
>>>         sourceX := xTable at: ascii + 1.
>>>         width := (xTable at: ascii + 2) - sourceX.
>>>         self copyBits.
>>>         destX := destX + width + kernDelta.
>>>     ].
>>>
>>> It seems like rule 34 is handled differently by 
>>> primitiveDisplayString and primitiveCopyBits. If I add code as 
>>> exists elsewhere to unhibernate forms and retry, all is working as 
>>> expected:
>>>
>>> primDisplayString: aString from: startIndex to: stopIndex map: 
>>> glyphMap xTable: xTable kern: kernDelta
>>>     | ascii |
>>>     <primitive:'primitiveDisplayString' module:'BitBltPlugin'>
>>>     (sourceForm isForm and: [sourceForm unhibernate]) ifTrue: [
>>>         ^self primDisplayString: aString from: startIndex to: 
>>> stopIndex map: glyphMap xTable: xTable kern: kernDelta
>>>     ].
>>>     (destForm isForm and: [destForm unhibernate]) ifTrue: [
>>>         ^self primDisplayString: aString from: startIndex to: 
>>> stopIndex map: glyphMap xTable: xTable kern: kernDelta
>>>     ].
>>>     (halftoneForm isForm and: [halftoneForm unhibernate]) ifTrue: [
>>>         ^self primDisplayString: aString from: startIndex to: 
>>> stopIndex map: glyphMap xTable: xTable kern: kernDelta
>>>     ].
>>>     startIndex to: stopIndex do:[:charIndex|
>>>         ascii := (aString at: charIndex) asciiValue.
>>>         glyphMap ifNotNil:[ascii := glyphMap at: ascii+1].
>>>         sourceX := xTable at: ascii + 1.
>>>         width := (xTable at: ascii + 2) - sourceX.
>>>         self copyBits.
>>>         destX := destX + width + kernDelta.
>>>     ].
>>>
>>> On 10/6/17 10:59 PM, Bob Arning wrote:
>>>>
>>>> Here is a strange one. I noticed a few morphs changing appearance 
>>>> after saving the image. It seems to be related to the hibernation 
>>>> of Forms which happens prior to saving the image. This snippet
>>>>
>>>> (m := SimpleButtonMorph new)
>>>>     label: 'Black on yellow';
>>>>     color: Color yellow.
>>>> Form allInstancesDo: [ :f | f hibernate].    "this happens when 
>>>> saving image"
>>>> m imageForm asMorph openInWorld
>>>>
>>>> has a white background for the text with a bit of yellow 
>>>> surrounding it. Running it in a clean 5.1 image gets the expected 
>>>> result: black text on a yellow background. However, if I load the 
>>>> preferences from my current image into the clean image, then the 
>>>> problem occurs: black on white on yellow. My prefs are attached if 
>>>> you would like to take a stab at it (and if it isn't too large an 
>>>> attachment).
>>>>
>>>>
>>>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20171007/241b0389/attachment.html>


More information about the Squeak-dev mailing list