The Trunk: Multilingual-nice.188.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.188.mcz

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

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

Name: Multilingual-nice.188
Author: nice
Time: 9 October 2013, 2:02:52.554 am
UUID: 4ff68b12-ef4c-4ea5-892c-e7b35f2205d5
Ancestors: Multilingual-nice.187

Avoid using theFirstCharCrossedX, this has to be handled differently, and uniformly Multilingual WideString or not.

=============== Diff against Multilingual-nice.187 ===============

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 |
  lastIndex := startIndex.
  lastIndex > stopIndex ifTrue: [^self handleEndOfRunAt: stopIndex].
  startEncoding := (sourceString at: startIndex) leadingChar.
  [lastIndex <= stopIndex] whileTrue: [
  char := sourceString at: lastIndex.
  encoding := char leadingChar.
  encoding ~= startEncoding ifTrue: [lastIndex := lastIndex - 1. ^ stopConditions endOfRun].
  ascii := char charCode.
  (encoding = 0 and: [ascii < 256 and:[(stopConditions at: ascii + 1) notNil]])
  ifTrue: [^ stopConditions at: ascii + 1].
  (self isBreakableAt: lastIndex in: sourceString in: (EncodedCharSet charsetAt: encoding)) ifTrue: [
  self registerBreakableIndex.
  ].
  nextDestX := destX + (font widthOf: char).
+ nextDestX > rightX ifTrue: [^ stopConditions crossedX].
- nextDestX > rightX ifTrue: [self theFirstCharCrossedX ifFalse: [^ 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. ^ stopConditions endOfRun].
  ascii := char charCode.
  (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: [^ stopConditions crossedX].
- nextDestX > rightX ifTrue: [self theFirstCharCrossedX ifFalse: [^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. ^ 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: [^ stopConditions crossedX].
- nextDestX > rightX ifTrue: [self theFirstCharCrossedX ifFalse: [^stopConditions crossedX]].
  destX := nextDestX + kern .
  lastIndex := lastIndex + 1.
  ].
  ^self handleEndOfRunAt: stopIndex!