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

Marcel Taeumel marcel.taeumel at hpi.de
Thu Jan 20 13:43:58 UTC 2022

On second thought, I might be better to address this issue in TextEditor directly and just add those text attributes to line-break characters if adjacent to the current text selection. We don't want to make text rendering slower than necessary. :-)

Am 19.01.2022 18:32:28 schrieb commits at source.squeak.org <commits at source.squeak.org>:
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.!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220120/c9f5d7d4/attachment.html>

More information about the Squeak-dev mailing list