[squeak-dev] The Trunk: Multilingual-nice.176.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Sep 26 23:43:44 UTC 2013


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

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

Name: Multilingual-nice.176
Author: nice
Time: 27 September 2013, 1:43:11.99 am
UUID: c3723402-2de2-4f11-83cb-d6dca977f57c
Ancestors: Multilingual-nice.175

Don't registerBreakableIndex in Latin1Environment, the DefaultStopConditions will handle that graciously.
isBreakableAt:in:in usage should be reserved to eastern asian language environments.
Take back two methods stolen by Morphic. They do not refer to Morphic and are sent by Multilingual and Graphics (ok 1 Morphic sender does not make a reason for being hijacked).

=============== Diff against Multilingual-nice.175 ===============

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 f startEncoding combining combined combiningIndex c |
  	lastIndex := startIndex.
  	lastIndex > stopIndex ifTrue: [lastIndex := stopIndex. ^ stops endOfRun].
  	startEncoding := (sourceString at: startIndex) leadingChar.
  	font ifNil: [font := (TextConstants at: #DefaultMultiStyle) fontArray at: 1].
  	((font isMemberOf: StrikeFontSet) or: [font isKindOf: TTCFontSet]) ifTrue: [
  		f := [font fontArray at: startEncoding + 1]
  			on: Exception do: [:ex | nil].
  		f ifNil: [ f := font fontArray at: 1].
  	].
  
  	spaceWidth := font widthOf: Space.
  	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
  				].
- 				(self isBreakableAt: lastIndex in: sourceString in: Latin1Environment) ifTrue: [
- 					self registerBreakableIndex.
- 				].		
  				destX > rightX ifTrue: [
  					destX ~= firstDestX 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 f nextDestX startEncoding floatDestX widthAndKernedWidth nextChar atEndOfRun |
  	lastIndex := startIndex.
  	lastIndex > stopIndex ifTrue: [lastIndex := stopIndex. ^ stops endOfRun].
  	startEncoding := (sourceString at: startIndex) leadingChar.
  	font ifNil: [font := (TextConstants at: #DefaultMultiStyle) fontArray at: 1].
  	((font isMemberOf: StrikeFontSet) or: [font isKindOf: TTCFontSet]) ifTrue: [
  		f := [font fontArray at: startEncoding + 1] ifError: [nil].
  		f ifNil: [ f := font fontArray at: 1].
  		spaceWidth := f widthOf: Space.
  	].
  	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].
- 		(self isBreakableAt: lastIndex in: sourceString in: Latin1Environment) ifTrue: [
- 			self registerBreakableIndex.
- 		].
  		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: [destX ~= firstDestX 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>>composeFrom:inRectangle:firstLine:leftSide:rightSide: (in category 'scanning') -----
+ composeFrom: startIndex inRectangle: lineRectangle
+ 	firstLine: firstLine leftSide: leftSide rightSide: rightSide
+ 	"Answer an instance of TextLineInterval that represents the next line in the paragraph."
+ 	| runLength stopCondition |
+ 	"Set up margins"
+ 	leftMargin := lineRectangle left.
+ 	leftSide ifTrue: [leftMargin := leftMargin +
+ 						(firstLine ifTrue: [textStyle firstIndent]
+ 								ifFalse: [textStyle restIndent])].
+ 	destX := spaceX := leftMargin.
+ 	firstDestX := destX.
+ 	rightMargin := lineRectangle right.
+ 	rightSide ifTrue: [rightMargin := rightMargin - textStyle rightIndent].
+ 	lastIndex := startIndex.	"scanning sets last index"
+ 	destY := lineRectangle top.
+ 	lineHeight := baseline := 0.  "Will be increased by setFont"
+ 	self setStopConditions.	"also sets font"
+ 	runLength := text runLengthFor: startIndex.
+ 	runStopIndex := (lastIndex := startIndex) + (runLength - 1).
+ 	line := (TextLine start: lastIndex stop: 0 internalSpaces: 0 paddingWidth: 0)
+ 				rectangle: lineRectangle.
+ 	spaceCount := 0.
+ 	self handleIndentation.
+ 	leftMargin := destX.
+ 	line leftMargin: leftMargin.
+ 
+ 	[stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
+ 		in: text string rightX: rightMargin stopConditions: stopConditions
+ 		kern: kern.
+ 	"See setStopConditions for stopping conditions for composing."
+ 	self perform: stopCondition] whileFalse.
+ 	
+ 	^ line
+ 		lineHeight: lineHeight + textStyle leading
+ 		baseline: baseline + textStyle leading!

Item was added:
+ ----- Method: MultiCompositionScanner>>setFont (in category 'stop conditions') -----
+ setFont
+ 	super setFont.
+ 	breakAtSpace := false.!



More information about the Squeak-dev mailing list