[squeak-dev] The Trunk: Graphics-mt.486.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Feb 21 16:06:45 UTC 2022


Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.486.mcz

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

Name: Graphics-mt.486
Author: mt
Time: 21 February 2022, 5:06:38.314875 pm
UUID: f5395b09-31fa-994e-b227-0dc8166d79d7
Ancestors: Graphics-mt.485

Updates commentary around primitive 103 and its issues with TTCFont.

Thanks to Tony (tonyg) for the pointer!

=============== Diff against Graphics-mt.485 ===============

Item was changed:
  ----- Method: CharacterScanner>>primScanCharactersFrom:to:in:rightX:stopConditions:kern: (in category 'scanning') -----
  primScanCharactersFrom: startIndex to: stopIndex in: sourceString rightX: rightX stopConditions: stops kern: kernDelta
+ 	"Primitive. This is the inner loop of text display--but see #scanCharactersFrom:to:in:rightX: which would get the string, stopConditions and displaying from the instance. March through sourceString from startIndex to stopIndex. If any character is flagged with a non-nil entry in stops, then return the corresponding value. Determine width of each character from xTable, indexed by map. If destX would exceed rightX, then return stops at: 258. Advance destX by the width of the character. If stopIndex has been reached, then return stops at: 257. 
+ 	
+ 	Optional. See Object documentation whatIsAPrimitive.
+ 	
+ 	NOTE THAT this primitive does only work for our legacy StrikeFont because #setActualFont: needs #xTable and #characterToGlyphMap, which are both not available for TTCFont this way and thus we end up calling #widthOf: manually on the font."
+ 	
- 	"Primitive. This is the inner loop of text display--but see 
- 	scanCharactersFrom: to:rightX: which would get the string, 
- 	stopConditions and displaying from the instance. March through source 
- 	String from startIndex to stopIndex. If any character is flagged with a 
- 	non-nil entry in stops, then return the corresponding value. Determine 
- 	width of each character from xTable, indexed by map. 
- 	If dextX would exceed rightX, then return stops at: 258. 
- 	Advance destX by the width of the character. If stopIndex has been
- 	reached, then return stops at: 257. Optional. 
- 	See Object documentation whatIsAPrimitive.
- 	Historical note: this primitive has been unusable since about Squeak 2.8 when the shape of the CharracterScanner class changed. It is left here as a reminder that the actual primitive still needs supporting in the VM to keep old images such as Scratch1.4 alive - tpr"
  	<primitive: 103>
+ 	^self basicScanByteCharactersFrom: startIndex to: stopIndex in: sourceString rightX: rightX 
+ 	
+ "Here are some sketchy benchmarks to illustrate the performance issue regarding the use of TrueType fonts:
+ 
+ 1) TTCFont only; with primitive fail
+  '1,160 per second. 865 microseconds per run. 0.44 % GC time.' 
+ 
+ 2) TTCFont only; without primitive fail
+  '5,730 per second. 175 microseconds per run. 6.12 % GC time.' 
+ 
+ 3) StrikeFont only; using primitive 103
+  '29,700 per second. 33.6 microseconds per run. 1.11978 % GC time.' 
+ 
+ 4) StrikeFont only; without primitive 103
+  '13,900 per second. 71.7 microseconds per run. 1.17976 % GC time.' 
+ 
+ "!
- 	^self basicScanByteCharactersFrom: startIndex to: stopIndex in: sourceString rightX: rightX !



More information about the Squeak-dev mailing list