[squeak-dev] The Trunk: Graphics-mt.484.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Feb 21 14:58:13 UTC 2022
Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.484.mcz
==================== Summary ====================
Name: Graphics-mt.484
Author: mt
Time: 21 February 2022, 3:58:06.002099 pm
UUID: 6fe57031-9af4-af44-87f3-4f7779ee19fe
Ancestors: Graphics-mt.483
Activate top/bottom margins during text composition step 1 of 2: Fill margins with actual values during composition.
=============== Diff against Graphics-mt.483 ===============
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 |
- | runLength stopCondition |
"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.
- lineHeight := baseline := lineGap := lineGapSlice := 0. "Will be increased by setFont"
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.
+
+ "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.
+ line topMargin: topMargin bottomMargin: bottomMargin.
+ ^ line!
- ^ line
- lineHeight: lineHeight + lineGap
- baseline: baseline + lineGapSlice!
More information about the Squeak-dev
mailing list
|