Nicolas Cellier uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-nice.187.mcz ==================== Summary ==================== Name: Multilingual-nice.187 Author: nice Time: 9 October 2013, 1:58:20.378 am UUID: 29d92261-d59a-4166-a576-f6f4aaf1fea1 Ancestors: Multilingual-nice.186 Remove scanSelector/scanSelectorAt: now that they are replaced by new mechanism #scanMultibyteCharactersFrom:to:in:with:rightX:font: Take property of specific *Multilingual methods from CharacterScanner =============== Diff against Multilingual-nice.186 =============== Item was added: + ----- Method: CharacterScanner>>isBreakableAt:in:in: (in category '*Multilingual-Display') ----- + isBreakableAt: index in: sourceString in: encodingClass + "check with the encoding whether the character at index is a breakable character. + Only the JISX0208 & JapaneseEnvironments ever return true, so only the scanJapaneseCharacters... method calls this" + ^ encodingClass isBreakableAt: index in: sourceString. + ! Item was added: + ----- Method: CharacterScanner>>registerBreakableIndex (in category '*Multilingual-Display') ----- + registerBreakableIndex + + "Record left x and character index of the line-wrappable point. + The default implementation here does nothing." + + ^ false. + ! Item was added: + ----- 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: [self theFirstCharCrossedX ifFalse: [^ stopConditions crossedX]]. + destX := nextDestX + kern. + lastIndex := lastIndex + 1. + ]. + ^self handleEndOfRunAt: stopIndex! Item was added: + ----- 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: [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 added: + ----- 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: [self theFirstCharCrossedX ifFalse: [^stopConditions crossedX]]. + destX := nextDestX + kern . + lastIndex := lastIndex + 1. + ]. + ^self handleEndOfRunAt: stopIndex! Item was added: + ----- Method: CompositionScanner>>registerBreakableIndex (in category '*Multilingual-Display') ----- + registerBreakableIndex + "Record left x and character index of the line-wrappable point. + Used for wrap-around in eastern Asian languages." + + spaceX := destX. + lineHeightAtSpace := lineHeight. + baselineAtSpace := baseline. + spaceIndex := lastIndex. + lastBreakIsNotASpace := true.! Item was added: + ----- Method: DisplayScanner>>isBreakableAt:in:in: (in category '*Multilingual-Display') ----- + isBreakableAt: index in: sourceString in: encodingClass + + ^ false. + ! Item was removed: - ----- Method: EncodedCharSet class>>scanSelector (in category 'accessing - displaying') ----- - scanSelector - "Note: this message can be sent both to an EncodedCharSet or a LanguageEnvironment." - ^ #scanMultiCharactersFrom:to:in:rightX:stopConditions:kern:! Item was removed: - ----- Method: EncodedCharSet class>>scanSelectorAt: (in category 'accessing - displaying') ----- - scanSelectorAt: encoding - | charset | - charset := self charsetAt: encoding. - ^ charset - ifNil: [LanguageEnvironment scanSelector] - ifNotNil: [charset scanSelector]! Item was removed: - ----- Method: JapaneseEnvironment class>>scanSelector (in category 'language methods') ----- - scanSelector - - ^ #scanJapaneseCharactersFrom:to:in:rightX:stopConditions:kern: - ! Item was removed: - ----- Method: LanguageEnvironment class>>scanSelector (in category 'language methods') ----- - scanSelector - "return a message to send to scan multi-byte characters - default when EncodedCharSet has no entry at the required encoding" - ^ #scanMultiCharactersFrom:to:in:rightX:stopConditions:kern: - ! Item was removed: - ----- Method: Unicode class>>scanSelector (in category 'accessing - displaying') ----- - scanSelector - "return a message to send to scan multi-byte characters - Unicode is one of the encodings supported by EncodedCharSet" - - "^ #scanMultiCharactersCombiningFrom:to:in:rightX:stopConditions:kern:." - ^ #scanMultiCharactersFrom:to:in:rightX:stopConditions:kern:. - ! |
Free forum by Nabble | Edit this page |