[squeak-dev] The Trunk: Multilingual-tpr.167.mcz

H. Hirzel hannes.hirzel at gmail.com
Wed Sep 4 04:16:58 UTC 2013


In addition to these method comments fixed here

StrikeFontSet>>characterToGlyphMap
StrikeFontSet>>displayMultiString:on:from:to:at:kern:baselineY:
StrikeFontSet>>glyphInfoOf:into:
StrikeFontSet>>questionGlyphInfoInto:


With http://source.squeak.org/trunk/TrueType-tpr.26.mcz

comments added to

TTCFontSet>>questionGlyphInfoInto:
TTCFontSet>>glyphInfoOf:into:
TTCFont>>glyphInfoOf:into:
MultiTTCFont>>glyphInfoOf:into:


With http://source.squeak.org/trunk/Graphics-tpr.222.mcz
comments added to

FixedFaceFont>>glyphInfoOf:into:
StrikeFont>>displayMultiString:on:from:to:at:kern:baselineY:
StrikeFont>>glyphInfoOf:into:


On 9/4/13, H. Hirzel <hannes.hirzel at gmail.com> wrote:
> Great to have these additional comments on the methods
>
> StrikeFontSet>>characterToGlyphMap
> StrikeFontSet>>displayMultiString:on:from:to:at:kern:baselineY:
> StrikeFontSet>>glyphInfoOf:into:
> StrikeFontSet>>questionGlyphInfoInto:
>
> --Hannes
>
> On Wed, 4 Sep 2013 00:02:21.542 0000, commits at source.squeak.org
> <commits at source.squeak.org> wrote:
>> tim Rowledge uploaded a new version of Multilingual to project The Trunk:
>> http://source.squeak.org/trunk/Multilingual-tpr.167.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Multilingual-tpr.167
>> Author: tpr
>> Time: 3 September 2013, 5:02:14.904 pm
>> UUID: 370d09db-992b-4348-9062-79cfaacf0e5e
>> Ancestors: Multilingual-fbs.166
>>
>> Provide a sensible implementation of #characterToGlyphMap to allow the
>> intended primitive to do what it primitively does.
>> 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 Multilingual-fbs.166 ===============
>>
>> Item was added:
>> + ----- Method: StrikeFontSet>>characterToGlyphMap (in category
>> 'accessing')
>> -----
>> + characterToGlyphMap
>> + 	"return the mapping for my first font; this follows the general form
>> of
>> all the other accessing methods but since we can't specifically find a
>> font
>> for a particualr character her we devolve to the first font in the
>> fontArray
>> - just like the other non-character-specific messages (#ascent etc).
>> + 	This is only sent by the BitBlt>primDisplayString:from:to:map:xTable:
>> method (other than internally by StrikeFont)"
>> + 	^fontArray first characterToGlyphMap!
>>
>> Item was changed:
>>   ----- Method:
>> StrikeFontSet>>displayMultiString:on:from:to:at:kern:baselineY: (in
>> category
>> 'displaying') -----
>>   displayMultiString: aString on: aBitBlt from: startIndex to: stopIndex
>> at:
>> aPoint kern: kernDelta baselineY: baselineY
>> + "display a multi-byte characterset string; each character may require
>> swapping to a new strikefont as discovered by glyphInfoOf:"
>> -
>>   	| destPoint leftX rightX glyphInfo g destY |
>>   	destPoint := aPoint.
>>   	glyphInfo := Array new: 5.
>>   	startIndex to: stopIndex do: [:charIndex |
>>   		self glyphInfoOf: (aString at: charIndex) into: glyphInfo.
>>   		g := glyphInfo at:1.
>>   		leftX := glyphInfo at:2.
>>   		rightX := glyphInfo at:3.
>>   		((glyphInfo at:5) ~= aBitBlt lastFont) ifTrue: [
>>   			(glyphInfo at:5) installOn: aBitBlt.
>>   		].
>>   		aBitBlt sourceForm: g.
>>   		destY := baselineY - (glyphInfo at:4).
>>   		aBitBlt destX: (destPoint x) destY: destY width: (rightX - leftX)
>> height: (self height).
>>   		aBitBlt sourceOrigin: leftX @ 0.
>>   		aBitBlt copyBits.
>>   		destPoint := destPoint x + (rightX - leftX + kernDelta) @ destPoint
>> y.
>>   	].
>>   	^ destPoint.!
>>
>> Item was changed:
>>   ----- Method: StrikeFontSet>>glyphInfoOf:into: (in category 'private')
>> -----
>>   glyphInfoOf: aCharacter into: glyphInfoArray
>> + "return glyph info for the character; it can get complicated."
>> -
>>   	| index f code leftX |
>> + 	"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.
>>   	].
>> +
>> + 	"if the xTable doesn't like the character, return that question-mark
>> default info"
>>   	leftX := f xTable at: code + 1.
>>   	leftX < 0 ifTrue: [
>>   		^ self questionGlyphInfoInto: glyphInfoArray.
>>   	].
>> +
>> + 	"finally, we have an ok font and character to return glyph info about"
>>   	glyphInfoArray at: 1 put: f glyphs;
>>   		at: 2 put: leftX;
>>   		at: 3 put: (f xTable at: code + 2);
>>   		at: 4 put: (f ascentOf: aCharacter);
>>   		at: 5 put: self.
>>   	^ glyphInfoArray.
>>   !
>>
>> Item was changed:
>>   ----- Method: StrikeFontSet>>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 ascii |
>>   	f := fontArray at: 1.
>>   	ascii := $? asciiValue.
>>   	glyphInfoArray at: 1 put: f glyphs;
>>   		at: 2 put: (f xTable at: ascii + 1);
>>   		at: 3 put: (f xTable at: ascii + 2);
>>   		at: 4 put: (self ascentOf: $?);
>>   		at: 5 put: self.
>>   	^ glyphInfoArray.
>>   !
>>
>>
>>
>


More information about the Squeak-dev mailing list