[Pkg] The Trunk: Multilingual-nice.181.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Sep 28 23:57:28 UTC 2013
Nicolas Cellier uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-nice.181.mcz
==================== Summary ====================
Name: Multilingual-nice.181
Author: nice
Time: 29 September 2013, 1:56:56.232 am
UUID: f732f734-f926-4d92-b25a-2904485ccd21
Ancestors: Multilingual-nice.180
Find a better replacement for firstDestX inst. var. usage (my previous fix broke selection of first char in the line, because a MultiCharacterBlockScanner would never have set firstDestX).
I wonder if this handling is really necessary though...
Remove unused presentationText:
=============== Diff against Multilingual-nice.180 ===============
Item was added:
+ ----- Method: MultiCharacterScanner>>itsNotTheFirstCharThatCrossedX (in category 'private') -----
+ itsNotTheFirstCharThatCrossedX
+ ^true!
Item was changed:
----- Method: MultiCharacterScanner>>scanJapaneseCharactersFrom:to:in:rightX:stopConditions:kern: (in category 'scanner methods') -----
scanJapaneseCharactersFrom: startIndex to: stopIndex in: sourceString rightX: rightX stopConditions: stops kern: kernDelta
| ascii encoding nextDestX startEncoding |
lastIndex := startIndex.
lastIndex > stopIndex ifTrue: [lastIndex := stopIndex. ^ stops endOfRun].
startEncoding := (sourceString at: startIndex) leadingChar.
[lastIndex <= stopIndex] whileTrue: [
encoding := (sourceString at: lastIndex) leadingChar.
encoding ~= startEncoding ifTrue: [lastIndex := lastIndex - 1. ^ stops endOfRun].
ascii := (sourceString at: lastIndex) charCode.
(encoding = 0 and: [ascii < 256 and:[(stops at: ascii + 1) notNil]])
ifTrue: [^ stops at: ascii + 1].
(self isBreakableAt: lastIndex in: sourceString in: (EncodedCharSet charsetAt: encoding)) ifTrue: [
self registerBreakableIndex.
].
nextDestX := destX + (font widthOf: (sourceString at: lastIndex)).
+ nextDestX > rightX ifTrue: [self itsNotTheFirstCharThatCrossedX ifTrue: [^ stops crossedX]].
- nextDestX > rightX ifTrue: [leftMargin ~= destX ifTrue: [^ stops crossedX]].
destX := nextDestX + kernDelta.
lastIndex := lastIndex + 1.
].
lastIndex := stopIndex.
^ stops endOfRun!
Item was changed:
----- Method: MultiCharacterScanner>>scanMultiCharactersCombiningFrom:to:in:rightX:stopConditions:kern: (in category 'scanner methods') -----
scanMultiCharactersCombiningFrom: startIndex to: stopIndex in: sourceString rightX: rightX stopConditions: stops kern: kernDelta
"appears to be unused"
| charCode encoding startEncoding combining combined combiningIndex c |
lastIndex := startIndex.
lastIndex > stopIndex ifTrue: [lastIndex := stopIndex. ^ stops endOfRun].
startEncoding := (sourceString at: startIndex) leadingChar.
combining := nil.
[lastIndex <= stopIndex] whileTrue: [
charCode := (sourceString at: lastIndex) charCode.
c := (sourceString at: lastIndex).
combining ifNil: [
combining := CombinedChar new.
combining add: c.
combiningIndex := lastIndex.
lastIndex := lastIndex + 1.
] ifNotNil: [
(combining add: c) ifFalse: [
self addCharToPresentation: (combined := combining combined).
combining := CombinedChar new.
combining add: c.
charCode := combined charCode.
encoding := combined leadingChar.
encoding ~= startEncoding ifTrue: [lastIndex := lastIndex - 1.
(encoding = 0 and: [charCode < 256 and:[(stops at: charCode + 1) notNil]]) ifTrue: [
^ stops at: charCode + 1
] ifFalse: [
^ stops endOfRun
].
].
(encoding = 0 and: [charCode < 256 and:[(stops at: charCode + 1) notNil]]) ifTrue: [
combining ifNotNil: [
self addCharToPresentation: (combining combined).
].
^ stops at: charCode + 1
].
destX > rightX ifTrue: [
+ self itsNotTheFirstCharThatCrossedX ifTrue: [
- destX ~= leftMargin ifTrue: [
lastIndex := combiningIndex.
self removeLastCharFromPresentation.
^ stops crossedX]].
combiningIndex := lastIndex.
lastIndex := lastIndex + 1.
] ifTrue: [
lastIndex := lastIndex + 1.
].
].
].
lastIndex := stopIndex.
combining ifNotNil: [
combined := combining combined.
self addCharToPresentation: combined.
].
^ stops endOfRun!
Item was changed:
----- Method: MultiCharacterScanner>>scanMultiCharactersFrom:to:in:rightX:stopConditions:kern: (in category 'scanning') -----
scanMultiCharactersFrom: startIndex to: stopIndex in: sourceString rightX: rightX stopConditions: stops kern: kernDelta
| ascii encoding nextDestX startEncoding floatDestX widthAndKernedWidth nextChar atEndOfRun |
lastIndex := startIndex.
lastIndex > stopIndex ifTrue: [lastIndex := stopIndex. ^ stops endOfRun].
startEncoding := (sourceString at: startIndex) leadingChar.
floatDestX := destX.
widthAndKernedWidth := Array new: 2.
atEndOfRun := false.
[lastIndex <= stopIndex] whileTrue: [
encoding := (sourceString at: lastIndex) leadingChar.
encoding ~= startEncoding ifTrue: [lastIndex := lastIndex - 1. ^ stops endOfRun].
ascii := (sourceString at: lastIndex) charCode.
(ascii < 256 and: [(stops at: ascii + 1) ~~ nil]) ifTrue: [^ stops at: ascii + 1].
nextChar := (lastIndex + 1 <= stopIndex)
ifTrue:[sourceString at: lastIndex + 1]
ifFalse:[
atEndOfRun := true.
"if there is a next char in sourceString, then get the kern
and store it in pendingKernX"
lastIndex + 1 <= sourceString size
ifTrue:[sourceString at: lastIndex + 1]
ifFalse:[ nil]].
font
widthAndKernedWidthOfLeft: (sourceString at: lastIndex)
right: nextChar
into: widthAndKernedWidth.
nextDestX := floatDestX + (widthAndKernedWidth at: 1).
+ nextDestX > rightX ifTrue: [self itsNotTheFirstCharThatCrossedX ifTrue: [^stops crossedX]].
- nextDestX > rightX ifTrue: [destX ~= leftMargin ifTrue: [^stops crossedX]].
floatDestX := floatDestX + kernDelta + (widthAndKernedWidth at: 2).
atEndOfRun
ifTrue:[
pendingKernX := (widthAndKernedWidth at: 2) - (widthAndKernedWidth at: 1).
floatDestX := floatDestX - pendingKernX].
destX := floatDestX .
lastIndex := lastIndex + 1.
].
lastIndex := stopIndex.
^ stops endOfRun!
Item was added:
+ ----- Method: MultiCompositionScanner>>itsNotTheFirstCharThatCrossedX (in category 'private') -----
+ itsNotTheFirstCharThatCrossedX
+ "When composing, this is used to avoid wrapping the line if the first char does not fit in composition rectangle"
+ ^destX ~= leftMargin!
Item was removed:
- ----- Method: MultiDisplayScanner>>presentationText: (in category 'private') -----
- presentationText: t
-
- text := t.
- !
More information about the Packages
mailing list