[squeak-dev] The Trunk: Collections-mt.986.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Feb 5 16:48:08 UTC 2022


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

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

Name: Collections-mt.986
Author: mt
Time: 5 February 2022, 5:48:06.324947 pm
UUID: 843f8169-dc62-4847-b3eb-49233199a905
Ancestors: Collections-cmm.985

Adds a cheap way to lookup the font at a character index in a text without having to have a text style at hand. This is useful for TextFontReference. See #fontAt:withStyle:.

=============== Diff against Collections-cmm.985 ===============

Item was added:
+ ----- Method: Text>>fontAt:withDefault: (in category 'emphasis') -----
+ fontAt: characterIndex withDefault: aFont
+ 	"Answer the font for characters in the run beginning at characterIndex."
+ 
+ 	| attributes font |
+ 	self size = 0 ifTrue: [^ aFont]. "null text tolerates access"
+ 	attributes := runs atPin: characterIndex.
+ 	font := aFont.  "default"
+ 	attributes do: [:att | att forFontInStyle: nil do: [:f | font := f]].
+ 	^ font!

Item was changed:
  ----- Method: TextFontChange>>forFontInStyle:do: (in category 'private') -----
+ forFontInStyle: aTextStyleOrNil do: aBlock
+ 
+ 	^ aTextStyleOrNil ifNotNil: [aBlock value: (aTextStyleOrNil fontAt: fontNumber)]!
- forFontInStyle: aTextStyle do: aBlock
- 	aBlock value: (aTextStyle fontAt: fontNumber)!



More information about the Squeak-dev mailing list