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

commits at source.squeak.org commits at source.squeak.org
Fri May 4 13:57:36 UTC 2018


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

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

Name: Graphics-mt.397
Author: mt
Time: 4 May 2018, 3:57:07.881404 pm
UUID: 3dce1413-6ad1-a249-8115-0bbb3bd2a241
Ancestors: Graphics-nice.396

Avoid the creation of strange-looking fonts. If that font already exhibits the requested emphasis, do not try to do further magic.

=============== Diff against Graphics-nice.396 ===============

Item was changed:
  ----- Method: StrikeFont>>emphasized: (in category 'emphasis') -----
  emphasized: code 
  	"Answer a copy of the receiver with emphasis set to include code."
  	| derivative addedEmphasis base safeCode |
  	code = 0 ifTrue: [^ self].
+ 	code = self emphasis ifTrue: [^ self].
  	(derivativeFonts == nil or: [derivativeFonts size = 0]) ifTrue: [^ self].
  	derivative := derivativeFonts at: (safeCode := code min: derivativeFonts size).
  	derivative == nil ifFalse: [^ derivative].  "Already have this style"
  
  	"Dont have it -- derive from another with one with less emphasis"
  	addedEmphasis := 1 bitShift: safeCode highBit - 1.
  	base := self emphasized: safeCode - addedEmphasis.  "Order is Bold, Ital, Under, Narrow"
  	addedEmphasis = 1 ifTrue:   "Compute synthetic bold version of the font"
  		[derivative := (base copy ensureCleanBold name: base name , 'B') makeBoldGlyphs].
  	addedEmphasis = 2 ifTrue:   "Compute synthetic italic version of the font"
  		[ derivative := (base copy name: base name , 'I') makeItalicGlyphs].
  	addedEmphasis = 4 ifTrue:   "Compute underlined version of the font"
  		[derivative := (base copy name: base name , 'U') makeUnderlinedGlyphs].
  	addedEmphasis = 8 ifTrue:   "Compute narrow version of the font"
  		[derivative := (base copy name: base name , 'N') makeCondensedGlyphs].
  	addedEmphasis = 16 ifTrue:   "Compute struck-out version of the font"
  		[derivative := (base copy name: base name , 'X') makeStruckOutGlyphs].
  	derivative emphasis: safeCode.
  	derivativeFonts at: safeCode put: derivative.
  	^ derivative!



More information about the Squeak-dev mailing list