Making 4.1 test green - exercize #1

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Making 4.1 test green - exercize #1

Nicolas Cellier
This evening: why (FontTest new testParagraphFallback) does fail ?

Well, a collateral effect of Unicode leadingChar = 0...

Since Unicode change, (EncodedCharSet scanSelectorAt: startEncoding) =
#scanMultiCharactersCombiningFrom:to:in:rightX:stopConditions:kern:
And this method behaves differently than previous
#scanMultiCharactersFrom:to:in:rightX:stopConditions:kern:

In effect, let's take a look at
MultiCharacterScanner>>#scanMultiCharactersCombiningFrom:to:in:rightX:stopConditions:kern:
scanMultiCharactersCombiningFrom: startIndex to: stopIndex in:
sourceString rightX: rightX stopConditions: stops kern: kernDelta
...snip... lot of code
        lastIndex := stopIndex.
        combining ifNotNil: [
                combined := combining combined.
                self addCharToPresentation: combined.
                "assuming that there is always enough space for at least one character".
                destX := destX + (self widthOf: combined inFont: font).
        ].
        ^ stops endOfRun

You see it ? It reserves the space for last character twice !
self addCharToPresentation: combined. Once !
destX := destX + (self widthOf: combined inFont: font). Twice !

Well, I've got no idea why and I don't know if I can safely remove it...
Any light ?

Nicolas


P.S.
There's probably more dust, because Henrik Johanssen told me that the
change of encoding is no more detected as a stop condition in
StrikeFont>>displayString:on:from:to:at:kern:baseLineY.
Consequently, the fallback font is used for any ASCII character
following a wide-character. Tricky!

Reply | Threaded
Open this post in threaded view
|

Re: Making 4.1 test green - exercize #1

Nicolas Cellier
2010/3/17 Nicolas Cellier <[hidden email]>:

> This evening: why (FontTest new testParagraphFallback) does fail ?
>
> Well, a collateral effect of Unicode leadingChar = 0...
>
> Since Unicode change, (EncodedCharSet scanSelectorAt: startEncoding) =
> #scanMultiCharactersCombiningFrom:to:in:rightX:stopConditions:kern:
> And this method behaves differently than previous
> #scanMultiCharactersFrom:to:in:rightX:stopConditions:kern:
>
> In effect, let's take a look at
> MultiCharacterScanner>>#scanMultiCharactersCombiningFrom:to:in:rightX:stopConditions:kern:
> scanMultiCharactersCombiningFrom: startIndex to: stopIndex in:
> sourceString rightX: rightX stopConditions: stops kern: kernDelta
> ...snip... lot of code
>        lastIndex := stopIndex.
>        combining ifNotNil: [
>                combined := combining combined.
>                self addCharToPresentation: combined.
>                "assuming that there is always enough space for at least one character".
>                destX := destX + (self widthOf: combined inFont: font).
>        ].
>        ^ stops endOfRun
>
> You see it ? It reserves the space for last character twice !
> self addCharToPresentation: combined. Once !
> destX := destX + (self widthOf: combined inFont: font). Twice !
>
> Well, I've got no idea why and I don't know if I can safely remove it...
> Any light ?
>

I just can tell that the test pass if I remove the destX := ...

> Nicolas
>
>
> P.S.
> There's probably more dust, because Henrik Johanssen told me that the
> change of encoding is no more detected as a stop condition in
> StrikeFont>>displayString:on:from:to:at:kern:baseLineY.
> Consequently, the fallback font is used for any ASCII character
> following a wide-character. Tricky!
>