The Trunk: Multilingual-nice.190.mcz

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

The Trunk: Multilingual-nice.190.mcz

commits-2
Nicolas Cellier uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-nice.190.mcz

==================== Summary ====================

Name: Multilingual-nice.190
Author: nice
Time: 10 October 2013, 2:27:55.714 am
UUID: 9a594ba3-cf12-435a-b2d6-df250176e3a0
Ancestors: Multilingual-nice.189

Hardcode [^#endOfRun] and [^#crossedX] instead of [^stopConditions endOfRun] and [^stopConditions crossedX].
The possibility of having a different symbol are never used and cost an indirection in character scanning inner loop.
They also are a barrier to the restoring of primitive 103 for slow machines.
We'll then can get rid of TextStopConditions.

=============== Diff against Multilingual-nice.189 ===============

Item was changed:
  ----- Method: CharacterScanner>>scanJapaneseCharactersFrom:to:in:rightX: (in category '*Multilingual-Display') -----
  scanJapaneseCharactersFrom: startIndex to: stopIndex in: sourceString rightX: rightX
  "this is a scanning method for
  multibyte Japanese characters in a WideString - hence the isBreakable:in:in:
  a font that does not do character-pair kerning "
 
  | ascii encoding nextDestX startEncoding char charset |
  lastIndex := startIndex.
  lastIndex > stopIndex ifTrue: [^self handleEndOfRunAt: stopIndex].
  startEncoding := (sourceString at: startIndex) leadingChar.
  charset := EncodedCharSet charsetAt: startEncoding.
  [lastIndex <= stopIndex] whileTrue: [
  char := sourceString at: lastIndex.
  encoding := char leadingChar.
+ encoding ~= startEncoding
+ ifTrue: [lastIndex := lastIndex - 1. ^#endOfRun].
- encoding ~= startEncoding ifTrue: [lastIndex := lastIndex - 1. ^ stopConditions endOfRun].
  ascii := char charCode.
+ (encoding = 0 and: [ascii < 256 and:[(stopConditions at: ascii + 1) ~~ nil]])
- (encoding = 0 and: [ascii < 256 and:[(stopConditions at: ascii + 1) notNil]])
  ifTrue: [^ stopConditions at: ascii + 1].
+ (self isBreakableAt: lastIndex in: sourceString in: charset)
+ ifTrue: [ self registerBreakableIndex].
- (self isBreakableAt: lastIndex in: sourceString in: charset) ifTrue: [
- self registerBreakableIndex.
- ].
  nextDestX := destX + (font widthOf: char).
+ nextDestX > rightX
+ ifTrue: [^#crossedX].
- nextDestX > rightX ifTrue: [^ stopConditions crossedX].
  destX := nextDestX + kern.
  lastIndex := lastIndex + 1.
  ].
  ^self handleEndOfRunAt: stopIndex!

Item was changed:
  ----- Method: CharacterScanner>>scanKernableMultibyteCharactersFrom:to:in:rightX: (in category '*Multilingual-Display') -----
  scanKernableMultibyteCharactersFrom: startIndex to: stopIndex in: sourceString rightX: rightX
  "this is a scanning method for
  multibyte characters in a WideString
  a font that does do character-pair kerning via widthAndKernedWidthOfLeft:right:into:"
 
  | ascii encoding nextDestX startEncoding floatDestX widthAndKernedWidth nextChar atEndOfRun char |
  lastIndex := startIndex.
  lastIndex > stopIndex ifTrue: [^self handleEndOfRunAt: stopIndex].
  startEncoding := (sourceString at: startIndex) leadingChar.
  floatDestX := destX.
  widthAndKernedWidth := Array new: 2.
  atEndOfRun := false.
  [lastIndex <= stopIndex] whileTrue: [
  char := sourceString at: lastIndex.
  encoding := char leadingChar.
+ encoding ~= startEncoding
+ ifTrue: [lastIndex := lastIndex - 1. ^#endOfRun].
- encoding ~= startEncoding ifTrue: [lastIndex := lastIndex - 1. ^ stopConditions endOfRun].
  ascii := char charCode.
+ (ascii < 256 and: [(stopConditions at: ascii + 1) ~~ nil])
+ ifTrue: [^ stopConditions at: ascii + 1].
- (ascii < 256 and: [(stopConditions at: ascii + 1) ~~ nil]) ifTrue: [^ stopConditions 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: char
  right: nextChar
  into: widthAndKernedWidth.
  nextDestX := floatDestX + (widthAndKernedWidth at: 1).
+ nextDestX > rightX ifTrue: [^#crossedX].
- nextDestX > rightX ifTrue: [^ stopConditions crossedX].
  floatDestX := floatDestX + kern + (widthAndKernedWidth at: 2).
  atEndOfRun
  ifTrue:[
  pendingKernX := (widthAndKernedWidth at: 2) - (widthAndKernedWidth at: 1).
  floatDestX := floatDestX - pendingKernX].
  destX := floatDestX .
  lastIndex := lastIndex + 1.
  ].
  ^self handleEndOfRunAt: stopIndex!

Item was changed:
  ----- Method: CharacterScanner>>scanMultibyteCharactersFrom:to:in:rightX: (in category '*Multilingual-Display') -----
  scanMultibyteCharactersFrom: startIndex to: stopIndex in: sourceString rightX: rightX
  "this is a scanning method for
  multibyte characters in a WideString
  a font that does not do character-pair kerning"
  | char ascii encoding nextDestX startEncoding |
  lastIndex := startIndex.
  startEncoding := (sourceString at: startIndex) leadingChar.
  [lastIndex <= stopIndex] whileTrue: [
  char := sourceString at: lastIndex.
  encoding := char leadingChar.
+ encoding ~= startEncoding
+ ifTrue: [lastIndex := lastIndex - 1. ^#endOfRun].
- encoding ~= startEncoding ifTrue: [lastIndex := lastIndex - 1. ^ stopConditions endOfRun].
  ascii := char charCode.
+ (ascii < 256 and: [(stopConditions at: ascii + 1) ~~ nil])
+ ifTrue: [^ stopConditions at: ascii + 1].
+ "bump nextDestX by the width of the current character"
+ nextDestX := destX + (font widthOf: char).
+ nextDestX > rightX ifTrue: [^#crossedX].
- (ascii < 256 and: [(stopConditions at: ascii + 1) ~~ nil]) ifTrue: [^ stopConditions at: ascii + 1].
- "bump nextDestX by the width of the current character"
- nextDestX := destX + (font widthOf: char).
- nextDestX > rightX ifTrue: [^ stopConditions crossedX].
  destX := nextDestX + kern .
  lastIndex := lastIndex + 1.
  ].
  ^self handleEndOfRunAt: stopIndex!