[squeak-dev] The Trunk: Graphics-mt.452.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Dec 21 17:13:05 UTC 2021
Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.452.mcz
==================== Summary ====================
Name: Graphics-mt.452
Author: mt
Time: 21 December 2021, 6:13:00.146727 pm
UUID: f7e76441-8d3c-42ba-ba4f-860c8105475f
Ancestors: Graphics-mt.451
Fixes implementation of #pixelSize in StrikeFont. (Note that the commentary refers to another commit I will do soon.)
For each StrikeFont, show the effective PPI in the printString to improve debugging and exploration.
Complements EToys-mt.453 and TrueType-mt.55.
=============== Diff against Graphics-mt.451 ===============
Item was changed:
----- Method: AbstractFont>>pixelSize (in category 'accessing') -----
pixelSize
"Make sure that we don't return a Fraction"
+ ^ (TextStyle pointsToPixels: self pointSize) rounded!
- ^ TextStyle pointsToPixels: self pointSize!
Item was added:
+ ----- Method: AbstractFont>>pixelsPerInch (in category 'accessing') -----
+ pixelsPerInch
+ "Answers the PPI reference for the pre-rendered receiver."
+
+ ^ (self height * 72 / self pointSize asFloat) rounded!
Item was changed:
----- Method: AbstractFont>>printShortDescriptionOn: (in category 'printing') -----
printShortDescriptionOn: aStream
+ aStream nextPutAll: self familyName!
- aStream space; nextPutAll: self familyName!
Item was added:
+ ----- Method: StrikeFont>>pixelSize (in category 'accessing') -----
+ pixelSize
+ "Overwritten because the receiver is pre-rendered using a fixed pixels-per-inch (PPI) value, usually 96 PPI. Note that you can change the #pointSize to match 96 PPI (see TextStyle class >> #pixelsPerInch) as follows:
+
+ self pointSize: ((72 * self pixelSize / 96) roundTo: 0.5).
+ self derivativeFonts do: [:d | d pointSize: font pointSize].
+
+ Note that a line gap (similar to a TTCFont's #lineGap) for pre-rendered fonts is managed via TextStyle's #lineGrid.
+
+ Also see StrikeFont class >> #referenceHeight."
+
+ ^ self height!
Item was changed:
----- Method: StrikeFont>>printOn: (in category 'file in/out') -----
printOn: aStream
+
super printOn: aStream.
+
+ aStream nextPut: $(.
+ self printShortDescriptionOn: aStream.
+ aStream nextPut: $).!
- aStream
- nextPut: $(;
- nextPutAll: self name;
- space;
- print: self height;
- nextPut: $)!
Item was changed:
----- Method: StrikeFont>>printShortDescriptionOn: (in category 'printing') -----
printShortDescriptionOn: aStream
+
+ aStream
+ nextPutAll: self familyName;
+ space; print: self pointSize; nextPutAll: 'pt';
+ space; print: self pixelsPerInch; nextPutAll: 'ppi';
+ space; print: self height; nextPutAll: 'px'.!
- aStream space; nextPutAll: self name!
Item was changed:
----- Method: TextStyle>>printOn: (in category 'printing') -----
printOn: aStream
super printOn: aStream.
+ aStream nextPut: $(.
+ aStream print: fontArray size.
+ aStream nextPut: $).
+ aStream space.
+ self defaultFont printShortDescriptionOn: aStream.
- self defaultFont printShortDescriptionOn: aStream
!
More information about the Squeak-dev
mailing list
|