[Pkg] The Trunk: Multilingual-tpr.177.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Sep 27 00:03:13 UTC 2013


tim Rowledge uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-tpr.177.mcz

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

Name: Multilingual-tpr.177
Author: tpr
Time: 26 September 2013, 5:02:39.835 pm
UUID: 1a4fc492-87e5-4fa5-a7b4-2d79bd774000
Ancestors: Multilingual-nice.176

Get rid of 
EncodedCharSet class>>scanSelector
MultiCompositionScanner>>isBreakableAt:in:in: & setFont
minor changes to some stopcondition methods

=============== Diff against Multilingual-nice.176 ===============

Item was removed:
- ----- Method: EncodedCharSet class>>scanSelector (in category 'accessing - displaying') -----
- scanSelector
- "This appears to be redundant - possibly once used as a default and now usurped by LanguageEnvironmet class>scanSelector ?"
- 	^ #scanMultiCharactersFrom:to:in:rightX:stopConditions:kern:!

Item was changed:
  ----- Method: MultiCharacterScanner>>isBreakableAt:in:in: (in category 'scanner methods') -----
  isBreakableAt: index in: sourceString in: encodingClass
+ "check with the encoding whether the character at index is a breakable character- only the JISX0208 & JapaneseEnvironment will ever return true, so only the scanJapaneseCharacters... method calls this"
- 
  	^ encodingClass isBreakableAt: index in: sourceString.
  !

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].
  		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 removed:
- ----- 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 changed:
  ----- Method: MultiCompositionScanner>>composeLine:fromCharacterIndex:inParagraph: (in category 'scanning') -----
  composeLine: lineIndex fromCharacterIndex: startIndex inParagraph: aParagraph 
  	"Answer an instance of TextLineInterval that represents the next line in the paragraph."
  	| runLength stopCondition |
  	destX := spaceX := leftMargin := aParagraph leftMarginForCompositionForLine: lineIndex.
  	destY := 0.
  	rightMargin := aParagraph rightMarginForComposition.
  	leftMargin >= rightMargin ifTrue: [self error: 'No room between margins to compose'].
  	lastIndex := startIndex.	"scanning sets last index"
  	lineHeight := textStyle lineGrid.  "may be increased by setFont:..."
  	baseline := textStyle baseline.
- 	baselineY := destY + baseline.
  	self setStopConditions.	"also sets font"
  	self handleIndentation.
  	runLength := text runLengthFor: startIndex.
  	runStopIndex := (lastIndex := startIndex) + (runLength - 1).
  	line := TextLineInterval
  		start: lastIndex
  		stop: 0
  		internalSpaces: 0
  		paddingWidth: 0.
  	spaceCount := 0.
  	
  	[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 changed:
  ----- Method: MultiCompositionScanner>>cr (in category 'stop conditions') -----
  cr
  	"Answer true. Set up values for the text line interval currently being 
  	composed."
  
  	pendingKernX := 0.
+ 	(lastIndex < text size and: [(text at: lastIndex) = Character cr and: [(text at: lastIndex+1) = Character lf]]) ifTrue: [lastIndex := lastIndex + 1].
- 	(lastIndex < text size and: [(text at: lastIndex) = CR and: [(text at: lastIndex+1) = Character lf]]) ifTrue: [lastIndex := lastIndex + 1].
  	line stop: lastIndex.
  	spaceX := destX.
  	line paddingWidth: rightMargin - spaceX.
  	^true!

Item was changed:
  ----- Method: MultiCompositionScanner>>endOfRun (in category 'stop conditions') -----
  endOfRun
  	"Answer true if scanning has reached the end of the paragraph. 
  	Otherwise step conditions (mostly install potential new font) and answer 
  	false."
  
  	| runLength |
  	lastIndex = text size
  	ifTrue:	[line stop: lastIndex.
  			spaceX := destX.
  			line paddingWidth: rightMargin - destX.
  			^true]
  	ifFalse:	[
- 			"(text at: lastIndex) charCode = 32 ifTrue: [destX := destX + spaceWidth]."
  			runLength := (text runLengthFor: (lastIndex := lastIndex + 1)).
  			runStopIndex := lastIndex + (runLength - 1).
  			self setStopConditions.
  			^false]
  !

Item was removed:
- ----- Method: MultiCompositionScanner>>isBreakableAt:in:in: (in category 'multilingual scanning') -----
- isBreakableAt: index in: sourceString in: encodingClass
- 
- 	^ encodingClass isBreakableAt: index in: sourceString.
- !

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



More information about the Packages mailing list