[squeak-dev] The Trunk: TrueType-tpr.26.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Sep 3 23:59:22 UTC 2013


tim Rowledge uploaded a new version of TrueType to project The Trunk:
http://source.squeak.org/trunk/TrueType-tpr.26.mcz

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

Name: TrueType-tpr.26
Author: tpr
Time: 3 September 2013, 4:59:10.251 pm
UUID: 964516e1-f994-408b-9cc1-0a5b7408ad3a
Ancestors: TrueType-fbs.25

Add some comments to a few important methods to, y'know, actually help readers understand WTF is going on.
Part of fixing Mantis-01781 7 years after it was reported.

=============== Diff against TrueType-fbs.25 ===============

Item was changed:
  ----- Method: MultiTTCFont>>glyphInfoOf:into: (in category 'as yet unclassified') -----
  glyphInfoOf: char into: glyphInfoArray
+ "return glyph info for char; I may have cached info to work from"
- 
  	| newForm |
  	self hasCached: char ifTrue: [:form :index |
  		self access: char at: index.
  		glyphInfoArray at: 1 put: form;
  			at: 2 put: 0;
  			at: 3 put: form width;
  			at: 4 put: (self ascentOf: char);
  			at: 5 put: self.
  		^ glyphInfoArray.
  	].
  
  	newForm := self computeForm: char.
  	self at: char put: newForm.
  
  	glyphInfoArray at: 1 put: newForm;
  		at: 2 put: 0;
  		at: 3 put: newForm width;
  		at: 4 put: (self ascentOf: char);
  		at: 5 put: self.
  	^ glyphInfoArray.
  !

Item was changed:
  ----- Method: TTCFont>>glyphInfoOf:into: (in category 'private') -----
  glyphInfoOf: aCharacter into: glyphInfoArray
+ 	"return the glyph info for aCharacter; if I don't have such a character, try my fallback font"
- 	"Answer the width of the argument as a character in the receiver."
  
  	| form |
  	(self hasGlyphOf: aCharacter) ifFalse: [
  		^ self fallbackFont glyphInfoOf: aCharacter into: glyphInfoArray.
  	].
  	form := self formOf: aCharacter.
  	glyphInfoArray at: 1 put: form;
  		at: 2 put: 0;
  		at: 3 put: form width;
  		at: 4 put: ascent "(self ascentOf: aCharacter)";
  		at: 5 put: self.
  	^ glyphInfoArray.
  !

Item was changed:
  ----- Method: TTCFontSet>>glyphInfoOf:into: (in category 'private') -----
  glyphInfoOf: aCharacter into: glyphInfoArray
+ "return glyph info for the character; it can get complicated."
- 
  	| index f code |
+ 	"the leadingChar gives us an encoding. if that is outside the range of fonts in my fontArray, just return the default glyphInfo for a question-mark"
  	index := aCharacter leadingChar + 1.
  	fontArray size < index ifTrue: [^ self questionGlyphInfoInto: glyphInfoArray].
  	(f := fontArray at: index) ifNil: [^ self questionGlyphInfoInto: glyphInfoArray].
  
+ 	"if the actual character is not in the range supported by the chosen font, return that default question-mark info "
  	code := aCharacter charCode.
  	((code between: f minAscii and: f maxAscii) not) ifTrue: [
  		^ self questionGlyphInfoInto: glyphInfoArray.
  	].
+ 	"finally, we have an ok font and character to return glyph info about - note that the font may have other ideas. "
  	f glyphInfoOf: aCharacter into: glyphInfoArray.
  	glyphInfoArray at: 5 put: self.
  	^ glyphInfoArray.
  !

Item was changed:
  ----- Method: TTCFontSet>>questionGlyphInfoInto: (in category 'private') -----
  questionGlyphInfoInto: glyphInfoArray
+ "return glyph info for the question mark character in the first font of the fontArray -sort of a default set of info"
- 
  	| f form |
  	f := fontArray at: 1.
  	form := f formOf: $?.
  	glyphInfoArray at: 1 put: form;
  		at: 2 put: 0;
  		at: 3 put: form width;
  		at: 4 put: self.
  	^ glyphInfoArray.
  !



More information about the Squeak-dev mailing list