[squeak-dev] Re: Problem with TrueTypeFonts

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: Problem with TrueTypeFonts

Steve Moffitt
Esteban -- If you need it later here ir is --


'From Squeak3.10alpha of 30 March 2007 [latest update: #7121] on 4  
September 2007 at 9:25:13 am'!

!FreeTypeFont methodsFor: 'as yet unclassified' stamp: 'tween 9/1/2007  
10:32'!
displayLineGlyphOn: aDisplayContext from: startPoint to: endPoint
        |  oldCombinationRule oldHalftoneForm originalColorMap clr depth  
foreColorVal foreColorAlpha glyph width height
        startPointX startPointY endPointX endPointY foreColor |
        oldCombinationRule := aDisplayContext combinationRule .
        oldHalftoneForm := aDisplayContext halftoneForm .
        originalColorMap := aDisplayContext colorMap.
        clr := (foreColor := aDisplayContext lastFontForegroundColor ifNil:
[Color black asNontranslucentColor])
                pixelValueForDepth: 32.
        depth := aDisplayContext destForm depth.
        foreColorVal := clr bitAnd: 16rFFFFFF.
        foreColorAlpha := (clr bitAnd: 16rFF000000) >> 24.
        depth <= 8
                ifTrue:[
                        aDisplayContext colorMap: (aDisplayContext cachedFontColormapFrom:
32 to: depth)]
                ifFalse:[
                        aDisplayContext colorMap: nil].
        startPointX := startPoint x truncated.
        startPointY := startPoint y.
        endPointX := endPoint x ceiling.
        endPointY := endPoint y.
        width := endPointX - startPointX.
        height := endPointY - startPointY.
        glyph := (Form extent: width@height depth: 32) fillWhite. "we could  
cache a big white glyph somewhere to save having to create this.  
Clipping will make only a part of it display"
        aDisplayContext sourceForm: glyph.
        aDisplayContext destOrigin: startPointX@startPointY.
        aDisplayContext width: width.
        aDisplayContext height: height.
        aDisplayContext
                sourceOrigin: 0@0;
                halftoneForm: nil.
        (FreeTypeSettings current bitBltSubPixelAvailable and: [depth >= 8])
                ifTrue:[
                        aDisplayContext
                                combinationRule: 41.
                        aDisplayContext
                                copyBitsColor: foreColorVal
                                alpha: foreColorAlpha
                                gammaTable: FreeTypeSettings current gammaTable
                                ungammaTable: FreeTypeSettings current gammaInverseTable]
                ifFalse:[
                        glyph fillWithColor: foreColor.
                        aDisplayContext combinationRule: (depth <= 8 ifTrue: [Form paint]  
ifFalse: [34]).
                        aDisplayContext copyBits].
        aDisplayContext
                colorMap: originalColorMap;
                combinationRule: oldCombinationRule;
                halftoneForm: oldHalftoneForm.
       
        ! !


Steve