[squeak-dev] The Trunk: Graphics-fbs.280.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Nov 29 19:21:01 UTC 2013


Frank Shearar uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-fbs.280.mcz

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

Name: Graphics-fbs.280
Author: fbs
Time: 29 November 2013, 8:28:36.953 am
UUID: ed8d2409-b9b9-0d49-9120-3b02e7b54a07
Ancestors: Graphics-fbs.279

In order to break the Graphics -> System dependency a bit more, change FontSubstitution to MissingFont to indicate what when wrong, not when it went wrong, and move the notification to Graphics.

=============== Diff against Graphics-fbs.279 ===============

Item was added:
+ Notification subclass: #MissingFont
+ 	instanceVariableNames: 'familyName pixelSize'
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'Graphics-Fonts'!
+ 
+ !MissingFont commentStamp: '<historical>' prior: 0!
+ signaled by font loading code when reading a DiskProxy that calls for a missing font.!

Item was added:
+ ----- Method: MissingFont class>>forFamilyName:pixelSize: (in category 'instance creation') -----
+ forFamilyName: aName pixelSize: aSize
+ 	^(self new)
+ 		familyName: aName;
+ 		pixelSize: aSize;
+ 		yourself.!

Item was added:
+ ----- Method: MissingFont>>defaultAction (in category 'handling') -----
+ defaultAction
+ 	familyName ifNil: [ familyName := 'NoName' ].
+ 	pixelSize ifNil: [ pixelSize := 12 ].
+ 
+ 	^((familyName beginsWith: 'Comic')
+ 		ifTrue: [ TextStyle named: (Preferences standardEToysFont familyName) ]
+ 		ifFalse: [ TextStyle default ]) fontOfSize: pixelSize.!

Item was added:
+ ----- Method: MissingFont>>familyName (in category 'accessing') -----
+ familyName
+ 	"Answer the value of familyName"
+ 
+ 	^ familyName!

Item was added:
+ ----- Method: MissingFont>>familyName: (in category 'accessing') -----
+ familyName: anObject
+ 	"Set the value of familyName"
+ 
+ 	familyName := anObject!

Item was added:
+ ----- Method: MissingFont>>pixelSize (in category 'accessing') -----
+ pixelSize
+ 	"Answer the value of pixelSize"
+ 
+ 	^ pixelSize!

Item was added:
+ ----- Method: MissingFont>>pixelSize: (in category 'accessing') -----
+ pixelSize: anObject
+ 	"Set the value of pixelSize"
+ 
+ 	pixelSize := anObject!

Item was added:
+ ----- Method: MissingFont>>printOn: (in category 'printing') -----
+ printOn: aStream
+ 	super printOn: aStream.
+ 	aStream nextPut: $(;
+ 		nextPutAll: familyName;
+ 		nextPut: $-;
+ 		print: pixelSize;
+ 		nextPut: $).!

Item was changed:
  AbstractFont subclass: #StrikeFont
  	instanceVariableNames: 'characterToGlyphMap xTable glyphs name type minAscii maxAscii maxWidth strikeLength ascent descent xOffset raster subscript superscript emphasis derivativeFonts pointSize fallbackFont charIndexCompatibilitySlot'
  	classVariableNames: 'DefaultStringScanner'
  	poolDictionaries: 'TextConstants'
  	category: 'Graphics-Fonts'!
  
+ !StrikeFont commentStamp: 'fbs 11/28/2013 08:50' prior: 0!
- !StrikeFont commentStamp: '<historical>' prior: 0!
  I represent a compact encoding of a set of Forms corresponding to characters in the ASCII character set. All the forms are placed side by side in a large form whose height is the font height, and whose width is the sum of all the character widths. The xTable variable gives the left-x coordinates of the subforms corresponding to the glyphs. Characters are mapped to glyphs by using the characterToGyphMap.
  
  Subclasses can have non-trivial mapping rules as well as different representations for glyphs sizes (e.g., not using an xTable). If so, these classes should return nil when queried for xTable and/or the characterToGlyphMap. This will cause the CharacterScanner primitive to fail and query the font for the width of a character (so that a more programatical approach can be implemented).
  
  For display, fonts need to implement two messages:
  	#installOn: aDisplayContext foregroundColor: foregroundColor backgroundColor: backgroundColor
+ This method installs the receiver (a font) on the given DisplayContext (which may be an instance of BitBlt or Canvas (or any of its subclasses). The font should take the appropriate action to initialize the display context so that further display operations can be optimized.
- This method installs the receiver (a font) on the given DisplayContext (which may be an instance of BitBlt or Canvas (or any of it's subclasses). The font should take the appropriate action to initialize the display context so that further display operations can be optimized.
  	#displayString: aString on: aDisplayContext from: startIndex to: stopIndex at: aPoint kern: kernDelta
  This method is called for each subsequent run of characters in aString which is to be displayed with the (previously installed) settings.
  !

Item was changed:
  ----- Method: StrikeFont class>>familyName:size: (in category 'accessing') -----
  familyName: aName size: aSize
  	"Answer a font (or the default font if the name is unknown) in the specified size."
  	| style |
  	style := TextStyle named: aName asSymbol.
+ 	style ifNil: [^(MissingFont forFamilyName: aName pixelSize: aSize)
- 	style ifNil: [^(FontSubstitutionDuringLoading forFamilyName: aName pixelSize: aSize)
  			signal: 'missing font' ].
  	^style fontOfSize: aSize!



More information about the Squeak-dev mailing list