'From etoys3.0 of 24 February 2008 [latest update: #2100] on 27 August 2008 at 5:00:21 pm'! "Change Set: MenuItemPango-yo Date: 27 August 2008 Author: Yoshiki Ohshima When pango is enabled, take a different path to render menu items properly."! !MenuItemMorph methodsFor: 'drawing' stamp: 'yo 8/27/2008 16:58'! drawOn: aCanvas "Draw the menu item, including icons, markers; apply appropriate color and centering." | stringColor stringBounds leftEdge outerBounds stringWidth oldColor | isSelected & isEnabled ifTrue: [ aCanvas fillRectangle: self bounds fillStyle: self selectionFillStyle. stringColor := color negated] ifFalse: [stringColor := color]. leftEdge := 0. self hasIcon ifTrue: [| iconForm | iconForm := isEnabled ifTrue:[self icon] ifFalse:[self icon asGrayScale]. aCanvas paintImage: iconForm at: self left @ (self top + (self height - iconForm height // 2)). leftEdge := iconForm width + 2]. self hasMarker ifTrue: [ leftEdge := leftEdge + self submorphBounds width + 8 ]. outerBounds := bounds left: bounds left + leftEdge. stringWidth := Preferences standardMenuFont widthOfString: contents. stringBounds := (self hasProperty: #centered) ifFalse: [outerBounds] ifTrue: [outerBounds insetBy: (((outerBounds width - stringWidth) max: 0) // 2) @ 0]. self usePango ifTrue: [ oldColor := color. color _ stringColor. aCanvas translateBy: (leftEdge@0) during: [:cc | super drawOn: cc]. color _ oldColor. ] ifFalse: [ aCanvas drawString: contents in: stringBounds font: self fontToUse color: stringColor. ]. stringBounds := stringBounds origin extent: (stringWidth+ 3) @ stringBounds height. self drawExtraIconOn: aCanvas forStringBounds: stringBounds. subMenu ifNotNil: [aCanvas paintImage: SubMenuMarker at: self right - 8 @ (self top + self bottom - SubMenuMarker height // 2)]! !