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

commits at source.squeak.org commits at source.squeak.org
Sat Feb 5 18:49:05 UTC 2022


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

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

Name: Graphics-mt.475
Author: mt
Time: 5 February 2022, 7:48:58.382366 pm
UUID: 646ee472-f5b8-9e4d-a5ec-329115e16e83
Ancestors: Graphics-mt.474

Modify #sampleText to consider the font's available code points.

=============== Diff against Graphics-mt.474 ===============

Item was changed:
  ----- Method: AbstractFont>>sampleText (in category 'example') -----
  sampleText
  
  	| text |
  	text := (self isSymbolFont or: [(self basicHasGlyphOf: $a) not])
+ 		ifTrue: [self symbolSample asText]
- 		ifTrue: [Text symbolSample]
  		ifFalse: [Text textSample].
  	text addAttribute: (TextFontReference toFont: self).
  	^ text!

Item was added:
+ ----- Method: AbstractFont>>symbolSample (in category 'example') -----
+ symbolSample
+ 	"Variation of Text class >> #symbolSample, which uses the receiver's available code points. This is important for fonts such as Wingdings."
+ 	
+ 	^ String streamContents: [:stream | | start lineLength character |
+ 		lineLength := 0.
+ 		(start := self minCodePoint max: 33) to: (self maxCodePoint min: start + 200) do: [:codePoint |
+ 			(self hasGlyphOf: (character := Character value: codePoint))
+ 				ifTrue: [stream nextPut: character.
+ 					((lineLength := lineLength + 1) > 30) ifTrue: [
+ 						lineLength := 0.
+ 						stream cr]]]]!



More information about the Squeak-dev mailing list