[squeak-dev] The Trunk: Graphics-mt.519.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Jun 3 09:46:07 UTC 2022
Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.519.mcz
==================== Summary ====================
Name: Graphics-mt.519
Author: mt
Time: 3 June 2022, 11:46:00.379122 am
UUID: 617a1b80-ce28-3146-8ddd-1544e6042cc8
Ancestors: Graphics-mt.518
To avoid graphics glitches when drawing text selections, adjust #lineHeight instead of #bottomMargin to realize #lineSpacing during text composition.
=============== Diff against Graphics-mt.518 ===============
Item was changed:
----- Method: CompositionScanner>>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 lineSpacing |
"Set up margins"
leftMargin := lineRectangle left.
leftSide ifTrue: [leftMargin := leftMargin +
(firstLine ifTrue: [textStyle firstIndent]
ifFalse: [textStyle restIndent])].
destX := spaceX := leftMargin.
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"
lineGap := lineGapSlice := -9999. "Will be increased by setFont; allow negative to show all effects of a custom #extraGap value. See TTFontDescription."
topMargin := bottomMargin := 0.
line := (TextLine start: lastIndex stop: 0 internalSpaces: 0 paddingWidth: 0)
rectangle: lineRectangle.
self setStopConditions. "also sets font"
runLength := text runLengthFor: startIndex.
runStopIndex := (lastIndex := startIndex) + (runLength - 1).
nextIndexAfterLineBreak := spaceCount := 0.
lastBreakIsNotASpace := false.
self handleIndentation.
leftMargin := destX.
line leftMargin: leftMargin.
[stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
in: text string rightX: rightMargin.
"See setStopConditions for stopping conditions for composing."
self perform: stopCondition] whileFalse.
lineHeight := lineHeight + lineGap.
baseline := baseline + lineGapSlice.
+ (lineSpacing := textStyle lineSpacing) = 0.0 ifFalse: [
+ "Modify lineHeight to realize lineSpacing instead of bottomMargin to avoid
+ rendering glitches for lineSpacing values < 0.0."
+ lineHeight := lineHeight + (lineSpacing * lineHeight) truncated.
+ "ALT: bottomMargin := bottomMargin + (lineSpacing * lineHeight) truncated"].
- "TODO: Allow special characters or text attributes to accumulate extra top or bottom margin."
- (lineSpacing := textStyle lineSpacing) = 0.0
- ifFalse: [bottomMargin := bottomMargin + (lineSpacing * lineHeight) truncated].
line lineHeight: lineHeight baseline: baseline.
+ "TODO: Allow special characters or text attributes to accumulate extra top or bottom margin."
line topMargin: topMargin bottomMargin: bottomMargin.
^ line!
More information about the Squeak-dev
mailing list
|