Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.234.mcz ==================== Summary ==================== Name: Graphics-nice.234 Author: nice Time: 28 September 2013, 3:05:03.082 pm UUID: a6f7b246-719d-441c-b082-9f627559e4a5 Ancestors: Graphics-nice.233 The scan* methods should not devise if font isNil isFontSet or whatever. Tell don't ask... They can legitimately assume that the font was correctly set, and should mind their own business. =============== Diff against Graphics-nice.233 =============== Item was changed: ----- Method: CharacterScanner>>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 | - | ascii encoding f nextDestX startEncoding | lastIndex := startIndex. lastIndex > stopIndex ifTrue: [lastIndex := stopIndex. ^ stops endOfRun]. startEncoding := (sourceString at: startIndex) leadingChar. - font ifNil: [font := (TextConstants at: #DefaultMultiStyle) fontArray at: 1]. - font isFontSet ifTrue: [ - f := font fontArray at: startEncoding + 1. - spaceWidth := f widthOf: Space. - ]. - [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]. nextDestX := destX + (font widthOf: (sourceString at: lastIndex)). nextDestX > rightX ifTrue: [^ stops crossedX]. destX := nextDestX + kernDelta. "destX printString displayAt: 0@(lastIndex*20)." lastIndex := lastIndex + 1. ]. lastIndex := stopIndex. ^ stops endOfRun! Item was changed: ----- Method: CharacterScanner>>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 | - | ascii encoding f nextDestX startEncoding | lastIndex := startIndex. lastIndex > stopIndex ifTrue: [lastIndex := stopIndex. ^ stops endOfRun]. startEncoding := (sourceString at: startIndex) leadingChar. - font ifNil: [font := (TextConstants at: #DefaultMultiStyle) fontArray at: 1]. - font isFontSet ifTrue: [ - f := font fontArray at: startEncoding + 1. - spaceWidth := f widthOf: Space. - ]. - [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]. nextDestX := destX + (font widthOf: (sourceString at: lastIndex)). nextDestX > rightX ifTrue: [^ stops crossedX]. destX := nextDestX + kernDelta. "destX printString displayAt: 0@(lastIndex*20)." lastIndex := lastIndex + 1. ]. lastIndex := stopIndex. ^ stops endOfRun! |
Free forum by Nabble | Edit this page |