[squeak-dev] The Trunk: TrueType-mt.73.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Mon May 9 09:32:24 UTC 2022


Hi Jakob --

> Is there anything that can be done about it to help someone
> else if they get stuck and don't think of searching the mailing list?

No, we cannot guarantee that you can update your personal
image to the latest Trunk without having to patch something. Any
custom change can be in conflict with upstream, whether you know
it or not.

We try to keep the update stream free to mistakes and errors
but it might happen, especially when dealing with complex
hen-and-egg problems. And we cannot rewrite/fix all older entries
in the update stream. But some. This one we cannot.

In this case, the CI did not show the issue even though it updates
from a very old Trunk version. So this issue was a slip on my
part that could not be fixed in the update stream.

Personally, I am not surprised that such things might happen.
Even if I try to avoid such mistakes "at all cost". But nobody
is perfect. :o)

Luckily, this is an open system and simple patches
can help fix such things. However, people that insist on 100%
flawlessness and compatibility do not quite understand the
actual challenge that exists in updating and evolving both
VM and Image. Sometimes the user has to do something, and
learn something about the system they are using. ;-)

... which is a good thing.

Best,
Marcel
Am 07.05.2022 20:13:26 schrieb Jakob Reschke <jakres+squeak at gmail.com>:
For reference, my image went from version 21315 -> 21736.

Am Sa., 7. Mai 2022 um 19:58 Uhr schrieb Jakob Reschke <jakres+squeak at gmail.com [mailto:jakres%2Bsqueak at gmail.com]>:

After the next error a few versions later, I found your message from 11 days ago: http://lists.squeakfoundation.org/pipermail/squeak-dev/2022-April/220093.html [http://lists.squeakfoundation.org/pipermail/squeak-dev/2022-April/220093.html]

Am Di., 26. Apr. 2022 um 11:19 Uhr schrieb Marcel Taeumel <marcel.taeumel at hpi.de [mailto:marcel.taeumel at hpi.de]>:

During the last 3 months of updating stuff in Trunk, I made 2 bigger mistakes that might raise debuggers when updating older Trunk images.


1. I was not aware that TTCFontSet was actually in use even for simple latin-1/ascii systems. Any MNU can simply be fixed by forwarding the implementation of that message to "fontArray first" in the font set.

So that answers my question whether there is a bug in the update stream with a "yes". Is there anything that can be done about it to help someone else if they get stuck and don't think of searching the mailing list?

Kind regards,
Jakob



Am Sa., 7. Mai 2022 um 19:49 Uhr schrieb Jakob Reschke <jakres+squeak at gmail.com [mailto:jakres%2Bsqueak at gmail.com]>:

Hi Marcel,

I just updated a Trunk image that I apparently did not update in a
while. The update got stuck with a message not understood while it was
executing this postscript. The methods added in TrueType-mt.75 were
missing, so I merged that while the update was stuck in the debugger,
then had the update proceed.

Is there a bug in the update stream?

Kind regards,
Jakob


Am Fr., 25. Feb. 2022 um 10:37 Uhr schrieb <commits at source.squeak.org [mailto:commits at source.squeak.org]>:
>
> Marcel Taeumel uploaded a new version of TrueType to project The Trunk:
> http://source.squeak.org/trunk/TrueType-mt.73.mcz [http://source.squeak.org/trunk/TrueType-mt.73.mcz]
>
> ==================== Summary ====================
>
> Name: TrueType-mt.73
> Author: mt
> Time: 25 February 2022, 10:37:20.57863 am
> UUID: 9a7bc579-7e0f-8c48-8a25-10f8a5466379
> Ancestors: TrueType-mt.72
>
> Move extral scale/gap from TTFontDescription up to TTCFont -- Step 2 of 2
>
> Activate the use of TTCFont's #extraGlyphScale and #extraLineGap.
>
> (Note that this also fixes clipping artifacts of over-height and over-wide glyphs. That is, left/top/right/bottom bearings in a glyph are not respected.)
>
> =============== Diff against TrueType-mt.72 ===============
>
> Item was changed:
>   TTCFont subclass: #LinedTTCFont
>         instanceVariableNames: 'emphasis lineGlyph contourWidth'
>         classVariableNames: ''
>         poolDictionaries: ''
>         category: 'TrueType-Fonts'!
> +
> + !LinedTTCFont commentStamp: 'mt 2/24/2022 16:24' prior: 0!
> + I am a TrueType font that uses the glyph for $_ to appear with underlined emphasis. If that glyph's decent is too close the baseline, the underlined font might look awkward.!
>
> Item was changed:
>   ----- Method: LinedTTCFont>>computeForm: (in category 'private') -----
>   computeForm: char
>         "Overwritten to add line glyph."
>
> +       ^ ttcDescription renderGlyph: char height: self height extraScale: self extraGlyphScale fgColor: foregroundColor bgColor: Color transparent depth: self depth lineGlyph: lineGlyph lineGlyphWidth: contourWidth emphasis: emphasis!
> -       ^ ttcDescription renderGlyph: char height: self height fgColor: foregroundColor bgColor: Color transparent depth: self depth lineGlyph: lineGlyph lineGlyphWidth: contourWidth emphasis: emphasis!
>
> Item was changed:
>   ----- Method: TTCFont>>computeForm: (in category 'character shapes') -----
> + computeForm: aCharacter
> - computeForm: char
>         "Compute the glyph form for the given character"
> +
> +       ^ ttcDescription
> +               renderGlyph: aCharacter
> +               height: self height "in pixels"
> +               extraScale: self extraGlyphScale
> +               fgColor: foregroundColor
> +               bgColor: Color transparent
> +               depth: self depth!
> -       ^ttcDescription renderGlyph: char height: self height fgColor: foregroundColor bgColor: Color transparent depth: self depth!
>
> Item was changed:
>   ----- Method: TTCFont>>displayString:on:from:to:at:kern:baselineY: (in category 'displaying') -----
>   displayString: aString on: aBitBlt from: startIndex to: stopIndex at: aPoint kern: kernDelta baselineY: baselineY
>
>         | form glyphInfo destX destY hereX nextX actualFont |
>         destX := aPoint x.
>         glyphInfo := Array new: 5.
>         startIndex to: stopIndex do: [:charIndex |
>                 self glyphInfoOf: (aString at: charIndex) into: glyphInfo.
>                 form := glyphInfo at: 1.
>                 hereX := glyphInfo at: 2.
>                 nextX := glyphInfo at: 3.
>                 (actualFont := glyphInfo at: 5) ==  aBitBlt lastFont
>                         ifFalse: [actualFont installOn: aBitBlt].
>                 destY := baselineY - (glyphInfo at: 4).
>                 aBitBlt sourceForm: form.
> +               aBitBlt destX: destX + form offset x.
> -               aBitBlt destX: destX.
>                 aBitBlt destY: destY + form offset y. "Compensate overdraw. See #extraScale:."
>                 aBitBlt sourceX: hereX; sourceY: 0.
> +               aBitBlt width: form width.
> -               aBitBlt width: nextX - hereX.
>                 aBitBlt height: form height.
>                 aBitBlt copyBits.
>                 destX := destX + (nextX - hereX) + kernDelta.
>         ].
>         ^ destX @ destY
>   !
>
> Item was changed:
>   ----- Method: TTCFont>>glyphInfoOf:into: (in category 'displaying') -----
>   glyphInfoOf: aCharacter into: glyphInfoArray
>         "return the glyph info for aCharacter; if I don't have such a character, try my fallback font"
>
>         | form |
>         (self hasGlyphOf: aCharacter) ifFalse: [
>                 ^ self fallbackFont glyphInfoOf: aCharacter into: glyphInfoArray.
>         ].
>         form := self formOf: aCharacter.
>         glyphInfoArray at: 1 put: form;
> +               at: 2 put: 0; "hereX -- relative, unlike StrikeFont"
> +               at: 3 put: form advanceWidth; "nextX -- relative, unlike StrikeFont"
> -               at: 2 put: 0;
> -               at: 3 put: form width;
>                 at: 4 put: self ascent "(self ascentOf: aCharacter)";
>                 at: 5 put: self.
>         ^ glyphInfoArray.
>   !
>
> Item was changed:
>   ----- Method: TTCFont>>lineGap (in category 'accessing') -----
>   lineGap
> +       "Answer the line gap in pixels. Scale from #typographicLineGap to make larger texts more ledigble."
> -       "Answer the line gap from the ttf description. Use #typographicLineGap to make larger tests more ledigble."
>
> +       ^ lineGap ifNil: [lineGap := (self pixelTypoScale * (ttcDescription typographicLineGap + self extraLineGap)) rounded]
> +
> + "Do not use the non-typo values:
> + ^ (self pixelScale * (ttcDescription lineGap + ttcDescription extraGap) rounded
> + "!
> -       "^ (self pixelScale * (ttcDescription lineGap + ttcDescription extraGap) rounded"
> -       ^ lineGap ifNil: [lineGap := (self pixelTypoScale * (ttcDescription typographicLineGap + ttcDescription extraGap)) rounded]!
>
> Item was changed:
> + ----- Method: TTCFont>>widthOf: (in category 'measuring') -----
> - ----- Method: TTCFont>>widthOf: (in category 'public') -----
>   widthOf: aCharacter
> +       "Overwritten to use the #advanceWidth and not the #width of the form. See TTGlyphForm"
> +
> -       "This method cannot use #formOf: because formOf: discriminates the color and causes unnecessary bitmap creation."
>         (self hasGlyphOf: aCharacter)
>                 ifFalse: [^ self fallbackFont widthOf: aCharacter].
> +       ^(self formOf: aCharacter) advanceWidth!
> -       ^(self formOf: aCharacter) width!
>
> Item was changed:
>   ----- Method: TTFileDescription>>renderGlyph:height:fgColor:bgColor:depth: (in category 'rendering') -----
>   renderGlyph: code height: fontHeight fgColor: fgColor bgColor: bgColor depth: depth
>         "Render the glyph with the given code point at the specified pixel height."
>
> +       self flag: #deprecated.
>         ^ self
> +               renderGlyph: code height: fontHeight extraScale: 1.0
> -               renderGlyph: code height: fontHeight
>                 fgColor: fgColor bgColor: bgColor depth: depth
>                 lineGlyph: nil lineGlyphWidth: 0 emphasis: 0!
>
> Item was changed:
>   ----- Method: TTFileDescription>>renderGlyph:height:fgColor:bgColor:depth:lineGlyph:lineGlyphWidth:emphasis: (in category 'rendering') -----
> + renderGlyph: code height: fontHeight fgColor: fgColor bgColor: bgColor depth: depth lineGlyph: lineGlyphOrNil lineGlyphWidth: lWidth emphasis: emphasis
> - renderGlyph: code height: fontHeight fgColor: fgColor bgColor: bgColor depth: depth lineGlyph: lineGlyph lineGlyphWidth: lWidth emphasis: emphasis
>         "Render the glyph with the given code point at the specified pixel height. Underline it with lineGlyph."
>
> +       self flag: #deprecated.
> +       ^ self
> +               renderGlyph: code height: fontHeight extraScale: 1.0
> -       | form pixelScale  offset |
> -       pixelScale := fontHeight asFloat / self fontHeight.
> -       offset := 0 @ ( (((self ascender) - ((self ascender) * self extraScale)) * pixelScale) truncated).
> -       form := (self at: code)
> -               asFormWithScale: pixelScale * self extraScale
> -               ascender: self ascender
> -               descender: self descender
>                 fgColor: fgColor bgColor: bgColor depth: depth
> +               lineGlyph: lineGlyphOrNil lineGlyphWidth: lWidth emphasis: emphasis!
> -               replaceColor: false
> -               lineGlyph: lineGlyph lineGlyphWidth: lWidth
> -               emphasis: emphasis.
> -       form offset: offset.
> -       ^ form!
>
> Item was changed:
>   ----- Method: TTFontDescription>>renderGlyph:height:fgColor:bgColor:depth: (in category 'rendering') -----
>   renderGlyph: code height: fontHeight fgColor: fgColor bgColor: bgColor depth: depth
>         "Render the glyph with the given code point at the specified pixel height."
>
> +       self flag: #deprecated.
>         ^ self
> +               renderGlyph: code height: fontHeight extraScale: 1.0
> -               renderGlyph: code height: fontHeight
>                 fgColor: fgColor bgColor: bgColor depth: depth
>                 lineGlyph: nil lineGlyphWidth: 0 emphasis: 0!
>
> Item was changed:
>   ----- Method: TTFontDescription>>renderGlyph:height:fgColor:bgColor:depth:lineGlyph:lineGlyphWidth:emphasis: (in category 'rendering') -----
>   renderGlyph: code height: fontHeight fgColor: fgColor bgColor: bgColor depth: depth lineGlyph: lineGlyphOrNil lineGlyphWidth: lWidth emphasis: emphasis
>         "Render the glyph with the given code point at the specified pixel height. Underline it with lineGlyph."
>
> +       self flag: #deprecated.
> +       ^ self
> +               renderGlyph: code height: fontHeight extraScale: 1.0
> -       | form pixelScale  offset |
> -       pixelScale := fontHeight asFloat / self fontHeight.
> -       offset := 0 @ ( (((self ascender) - ((self ascender) * self extraScale)) * pixelScale) truncated).
> -       form := (self at: code)
> -               asFormWithScale: pixelScale * self extraScale
> -               ascender: self ascender
> -               descender: self descender
>                 fgColor: fgColor bgColor: bgColor depth: depth
> +               lineGlyph: lineGlyphOrNil lineGlyphWidth: lWidth emphasis: emphasis!
> -               replaceColor: false
> -               lineGlyph: lineGlyphOrNil lineGlyphWidth: lWidth
> -               emphasis: emphasis.
> -       form offset: offset.
> -       ^ form!
>
> Item was changed:
>   ----- Method: TTGlyph>>asFormWithScale:ascender:descender:fgColor:bgColor:depth:replaceColor:lineGlyph:lineGlyphWidth:emphasis: (in category 'converting') -----
>   asFormWithScale: scale ascender: ascender descender: descender fgColor: fgColor bgColor: bgColor depth: depth replaceColor: replaceColorFlag lineGlyph: lineGlyph lineGlyphWidth: lWidth emphasis: code
>
> +       | topBearing bottomBearing pixelBox pixelOutset form canvas newScale renderOffset |
> +       topBearing := bounds bottom - ascender max: 0.
> +       bottomBearing := bounds top - descender min: 0.
> +       renderOffset := leftSideBearing abs @ (ascender+topBearing) negated.
> +
> +       "Prepare the pixel box"
> +       pixelBox := ((advanceWidth @ (ascender - descender)) * scale) rounded.
> +       pixelOutset := ((leftSideBearing abs @ topBearing "abs" ) * scale) rounded
> +               corner: ((rightSideBearing abs @ bottomBearing abs ) * scale) rounded.
> +       form := TTGlyphForm extent: pixelBox
> +               + pixelOutset left + pixelOutset top
> +               + pixelOutset right + pixelOutset bottom
> +                       depth: depth.
> +       form advanceWidth: pixelBox x.
> +       form offset: pixelOutset topLeft negated.
> +
> -       | form canvas newScale |
> -       form := Form extent: ((advanceWidth @ (ascender - descender)) * scale) rounded depth: depth.
>         form fillColor: bgColor.
>         canvas := form getCanvas asBalloonCanvas.
>         canvas aaLevel: 4.
>         canvas transformBy: (MatrixTransform2x3 withScale: scale asPoint * (1 @ -1)).
> +       canvas transformBy: (MatrixTransform2x3 withOffset: renderOffset).
> -       canvas transformBy: (MatrixTransform2x3 withOffset: 0 @ ascender negated).
>         canvas
>                 drawGeneralBezierShape: self contours
>                 color: fgColor
>                 borderWidth: 0
>                 borderColor: fgColor.
>         ((code bitAnd: 4) ~= 0 or: [(code bitAnd: 16) ~= 0]) ifTrue: [
> +               newScale := (pixelBox x + 1) asFloat / lineGlyph calculateWidth asFloat.
> -               newScale := (form width + 1) asFloat / lineGlyph calculateWidth asFloat.
>                 canvas transformBy: (MatrixTransform2x3 withScale: (newScale / scale)@1.0).
>
>                 (code bitAnd: 4) ~= 0 ifTrue: [
>                         canvas
>                                 drawGeneralBezierShape: lineGlyph contours
>                                 color: fgColor
>                                 borderWidth: 0
>                                 borderColor: fgColor.
>                 ].
>
> +               (code bitAnd: 16) ~= 0 ifTrue: [ | renderLineOffset |
> +                       renderLineOffset := renderOffset x @ (renderOffset y negated // 2).
> +                       canvas transformBy: (MatrixTransform2x3 withOffset: renderLineOffset).
> -               (code bitAnd: 16) ~= 0 ifTrue: [
> -                       canvas transformBy: (MatrixTransform2x3 withOffset: 0@(ascender // 2)).
>                         canvas
>                                 drawGeneralBezierShape: lineGlyph contours
>                                 color: fgColor
>                                 borderWidth: 0
>                                 borderColor: fgColor.
>                 ].
>         ].
>
>         replaceColorFlag ifTrue: [
>                 form replaceColor: bgColor withColor: Color transparent.
>         ].
>         ^ form!
>
> Item was added:
> + (PackageInfo named: 'TrueType') postscript: '"Moves extra glyph scale and extra line gap from font description (i.e., TTFontDescription) up to font instance (i.e., TTCFont). Restore glyph scale for default fonts. Note that we might want to rename their #familyName(:)  in the future to make that clear. Scale factors were chosen to look good on various scale factors at 10.5 pt."
> +
> + #(
> + BitstreamVeraSans 1.059 24
> + BitstreamVeraSansMono 1.059 24
> + BitstreamVeraSerif 1.11 47
> + ) groupsDo: [:name :scale :gap |
> +       (TextStyle named: name) defaultFont
> +               extraGlyphScale: scale;
> +               extraLineGap: gap].
> + TTCFont shutDown: true. "Reset glyph caches"'!
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220509/e41ff395/attachment-0001.html>


More information about the Squeak-dev mailing list