[squeak-dev] The Inbox: Multilingual-nice.158.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Mar 7 21:11:58 UTC 2013


A new version of Multilingual was added to project The Inbox:
http://source.squeak.org/inbox/Multilingual-nice.158.mcz

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

Name: Multilingual-nice.158
Author: nice
Time: 7 March 2013, 10:11:37.211 pm
UUID: 99170ca9-87b9-4584-9f05-25b944e37d56
Ancestors: Multilingual-fbs.157

Do to Multilinngual what we did to Unilingual, or in other words:
Let MultiCharacterScanner take kerning into account when measuring a String in order to fall in agreement with CompositionScanner.
Note that #measureString:inFont:from:to: is not used in image but seems to be by some Tweak code as reported by mtf in dec. 2010.
Remove unused xTable (such low level responsibility has been transferred into BitBlt)

=============== Diff against Multilingual-fbs.157 ===============

Item was changed:
  Object subclass: #MultiCharacterScanner
+ 	instanceVariableNames: 'destX lastIndex destY stopConditions text textStyle alignment leftMargin rightMargin font line runStopIndex spaceCount spaceWidth emphasisCode kern indentationLevel wantsColumnBreaks pendingKernX baselineY firstDestX presentation presentationLine numOfComposition lastWidth'
- 	instanceVariableNames: 'destX lastIndex xTable destY stopConditions text textStyle alignment leftMargin rightMargin font line runStopIndex spaceCount spaceWidth emphasisCode kern indentationLevel wantsColumnBreaks pendingKernX baselineY firstDestX presentation presentationLine numOfComposition lastWidth'
  	classVariableNames: 'DefaultStopConditions NilCondition PaddedSpaceCondition SpaceCondition'
  	poolDictionaries: 'TextConstants'
  	category: 'Multilingual-Scanning'!

Item was changed:
  ----- Method: MultiCharacterScanner>>measureString:inFont:from:to: (in category 'scanning') -----
  measureString: aString inFont: aFont from: startIndex to: stopIndex
  	"WARNING: In order to use this method the receiver has to be set up using #initializeStringMeasurer"
  	destX := destY := lastIndex := 0.
  	baselineY := aFont ascent.
+ 	font := aFont.
+ 	pendingKernX := 0.
+ 	kern := 0 - font baseKern.
+ 	spaceWidth := font widthOf: Space.
+ 	
+ 	self scanCharactersFrom: startIndex to: stopIndex in: aString rightX: 999999 stopConditions: stopConditions kern: kern.
- 	xTable := aFont xTable.
- 	font := aFont.  " added Dec 03, 2004 "
- "	map := aFont characterToGlyphMap."
- 	self scanCharactersFrom: startIndex to: stopIndex in: aString rightX: 999999 stopConditions: stopConditions kern: 0.
  	^destX!

Item was changed:
  ----- Method: MultiCharacterScanner>>setFont (in category 'private') -----
  setFont
  	| priorFont |
  	"Set the font and other emphasis."
  	priorFont := font.
  	text == nil ifFalse:[
  		emphasisCode := 0.
  		kern := 0.
  		indentationLevel := 0.
  		alignment := textStyle alignment.
  		font := nil.
  		(text attributesAt: lastIndex forStyle: textStyle)
  			do: [:att | att emphasizeScanner: self]].
  	font == nil ifTrue:
  		[self setFont: textStyle defaultFontIndex].
  	font := font emphasized: emphasisCode.
  	priorFont 
  		ifNotNil: [
  			font = priorFont 
  				ifTrue:[
  					"font is the same, perhaps the color has changed?
  					We still want kerning between chars of the same
  					font, but of different color. So add any pending kern to destX"
  					destX := destX + (pendingKernX ifNil:[0])].
  			destX := destX + priorFont descentKern].
  	pendingKernX := 0. "clear any pending kern so there is no danger of it being added twice"
  	destX := destX - font descentKern.
  	"NOTE: next statement should be removed when clipping works"
  	leftMargin ifNotNil: [destX := destX max: leftMargin].
  	kern := kern - font baseKern.
  
  	"Install various parameters from the font."
  	spaceWidth := font widthOf: Space.
- 	xTable := font xTable.
- "	map := font characterToGlyphMap."
  	stopConditions := DefaultStopConditions.!



More information about the Squeak-dev mailing list