XftFontDescription.st
changeset 7567 7e14edffaf21
parent 7563 3555a447b0aa
child 7571 ba05e480c941
--- a/XftFontDescription.st	Tue Sep 13 18:30:05 2016 +0200
+++ b/XftFontDescription.st	Wed Sep 14 15:05:23 2016 +0200
@@ -30,8 +30,7 @@
 		FC_RGBA_VBGR FC_RGBA_NONE FC_HINT_NONE FC_HINT_SLIGHT
 		FC_HINT_MEDIUM FC_HINT_FULL FC_LCD_NONE FC_LCD_DEFAULT
 		FC_LCD_LIGHT FC_LCD_LEGACY StXFace2FCWeightMap
-		StXStyle2FCSlantMap CachedFontList RecentlyUsedFonts Lobby
-		FirstTimeCalled'
+		StXStyle2FCSlantMap Lobby FirstTimeCalled CachedFontList'
 	poolDictionaries:''
 	category:'Graphics-Support'
 !
@@ -304,46 +303,6 @@
 
 !XftFontDescription class methodsFor:'instance creation'!
 
-family:familyString face:faceString style:styleString size:size sizeUnit:sizeUnit encoding:encoding
-    "returns a font for given family, face, style, size and the specified encoding.
-     The returned font is not associated to a specific device"
-
-    |proto|
-
-    RecentlyUsedFonts notNil ifTrue:[
-	proto := RecentlyUsedFonts
-		detect:[:fn |
-		    fn family = familyString
-		    and:[ fn size = size and:[fn sizeUnit = sizeUnit
-		    and:[ fn face = faceString
-		    and:[ (fn style = styleString
-			  or:[ (fn style = 'oblique' and:[styleString = 'italic'])
-			  or:[ (fn style = 'italic' and:[styleString = 'oblique']) ]]) ]]]]]
-		ifNone:nil.
-	proto notNil ifTrue:[
-	    ^ proto
-	].
-    ].
-
-    CachedFontList notNil ifTrue:[
-	proto := CachedFontList
-		detect:[:fn |
-		    fn family = familyString
-		    and:[ fn face = faceString
-		    and:[ (fn style = styleString
-			  or:[ (fn style = 'oblique' and:[styleString = 'italic'])
-			  or:[ (fn style = 'italic' and:[styleString = 'oblique']) ]]) ]]]
-		ifNone:nil.
-	proto notNil ifTrue:[
-	    ^ (proto shallowCopy)
-		setDevice: nil patternId: nil fontId: nil;
-		family:familyString face:faceString style:styleString size:size sizeUnit:sizeUnit encoding:encoding
-	].
-    ].
-    ^ super
-	family:familyString face:faceString style:styleString size:size sizeUnit:sizeUnit encoding:encoding
-!
-
 for:aFontOrFontDescription
     ^ self
 	family:aFontOrFontDescription family
@@ -364,11 +323,12 @@
     "a view is going to be destroyed.
      Have to disassociate the XftDrawId from  the drawableId aWindowId"
 
-    Lobby do:[:eachXftFont|
-	eachXftFont graphicsDevice == aDevice ifTrue:[
-	    eachXftFont disassociateXftDrawableFrom:aWindowId.
-	].
-    ].
+"/ no longer used...
+"/    Lobby do:[:eachXftFont|
+"/        eachXftFont graphicsDevice == aDevice ifTrue:[
+"/            eachXftFont disassociateXftDrawableFrom:aWindowId.
+"/        ].
+"/    ].
 ! !
 
 !XftFontDescription class methodsFor:'examples'!
@@ -459,7 +419,7 @@
     "uses fc-list to get a list of available fontDescriptions"
 
     CachedFontList isNil ifTrue:[
-	CachedFontList := FCFontListParser new listOfAvailableFonts
+        CachedFontList := FCFontListParser new listOfAvailableFonts
     ].
     ^ CachedFontList
 
@@ -920,36 +880,12 @@
     aGraphicsDevice supportsXftFonts ifFalse:[
         ^ self asNonXftFont onDevice:aGraphicsDevice.
     ].
-    RecentlyUsedFonts isNil ifTrue:[
-        RecentlyUsedFonts := OrderedCollection new:20.
+
+    deviceFont := aGraphicsDevice deviceFonts detect:[:eachFont | self sameDeviceFontAs:eachFont] ifNone:[].
+    deviceFont notNil ifTrue:[
+        ^ deviceFont.
     ].
 
-    RecentlyUsedFonts keysAndValuesDo:[:index :aFont |
-        ((aFont class == self class) 
-         and:[(self sameDeviceFontAs:aFont) 
-         and:[device == aGraphicsDevice
-         and:[aFont getXftFontId notNil]]]) ifTrue:[
-            "/ Transcript showCR:'hit'.
-            RecentlyUsedFonts
-                removeIndex:index;
-                addFirst:aFont.
-            ^ aFont
-        ]
-    ].
-
-    RecentlyUsedFonts size >= 20 ifTrue:[
-        RecentlyUsedFonts removeLast.
-    ].
-
-    aGraphicsDevice deviceFonts do:[:aFont |
-        (self sameDeviceFontAs:aFont) ifTrue:[
-            RecentlyUsedFonts addFirst:aFont.
-            ^ aFont
-        ].
-    ].
-
-"/    ^ self asNonXftFont onDevice:aGraphicsDevice.
-
     computedWeight := weight.
     computedWeight isNil ifTrue:[
         computedWeight := StXFace2FCWeightMap at:(face ? '') asLowercase ifAbsent:[FC_WEIGHT_REGULAR].
@@ -988,7 +924,6 @@
                 closestPatternHandle := nil.
                 deviceFont setDevice:aGraphicsDevice patternId:nil fontId:newFontId.
                 aGraphicsDevice registerFont:deviceFont.
-                RecentlyUsedFonts addFirst:deviceFont.
                 ^ deviceFont.
             ].
         ].
@@ -1004,10 +939,6 @@
 
     "Modified: / 14-04-1997 / 18:22:31 / cg"
     "Modified: / 02-01-2014 / 23:43:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-sameDeviceFontAs:aFont
-    ^ (super sameDeviceFontAs:aFont) and:[device == aFont graphicsDevice]
 ! !
 
 !XftFontDescription methodsFor:'initialization'!