[squeak-dev] The Inbox: Graphics-mt.463.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jan 19 17:32:14 UTC 2022

A new version of Graphics was added to project The Inbox:

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

Name: Graphics-mt.463
Author: mt
Time: 19 January 2022, 6:32:07.639177 pm
UUID: 20a970f6-bcf4-1747-b194-0aef3ad7edbc
Ancestors: Graphics-mt.462

Proposal: Ignore text attributes for line-break characters.

This makes it easier, for example, select a single line of text and change its font to something smaller than the default font. Usually you would need to also change the font of that line-break character to make the entire line smaller... well, it is possible:

1. Hit [Home] key.
2. Hold [Shift] and hit [End] key.
3. Hold [Shift] and hit [ArrowRight] key.

This proposal would make the third step unnecessary.

=============== Diff against Graphics-mt.462 ===============

Item was changed:
  ----- Method: CharacterScanner>>setFont (in category 'private') -----
+ 	| priorFont lastChar |
- 	| priorFont |
  	"Set the font and other emphasis."
  	priorFont := font.
  	text ifNotNil:[
  		emphasisCode := 0.
  		kern := 0.
  		indentationLevel := 0.
  		alignment := textStyle alignment.
+ 		((lastChar := text at: lastIndex ifAbsent: [$0 "dummy"]) = CR or: [lastChar = Character lf])
+ 			ifFalse: [
+ 				font := nil.
+ 				(text attributesAt: lastIndex forStyle: textStyle)
+ 					do: [:att | att emphasizeScanner: self]]].
- 		font := nil.
- 		(text attributesAt: lastIndex forStyle: textStyle)
- 			do: [:att | att emphasizeScanner: self]].
  	font ifNil: [self setFont: textStyle defaultFontIndex].
  	self setActualFont: (font emphasized: emphasisCode).
  		ifNotNil: [
  			font = priorFont 
  					"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.!

More information about the Squeak-dev mailing list