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

Marcel Taeumel marcel.taeumel at hpi.de
Sat Oct 7 12:17:48 UTC 2017


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/3093419a/attachment.html>


More information about the Squeak-dev mailing list