In case of not configured but installed Xft Fonts convert XftFonts
authorab
Wed, 12 Nov 2014 13:14:33 +0100
changeset 6587 c1790bb9af59
parent 6586 9d16907daea8
child 6588 7410e4592c1d
In case of not configured but installed Xft Fonts convert XftFonts to default fonts added: #asNonXftFont changed: #onDevice:
XftFontDescription.st
--- a/XftFontDescription.st	Mon Nov 10 23:24:12 2014 +0100
+++ b/XftFontDescription.st	Wed Nov 12 13:14:33 2014 +0100
@@ -529,6 +529,22 @@
     "Created: / 02-01-2014 / 23:29:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!XftFontDescription methodsFor:'converting'!
+
+asNonXftFont
+    |newFont|
+
+    newFont := FontDescription 
+                    family:family 
+                    face:face 
+                    style:style 
+                    size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) 
+                    sizeUnit:sizeUnit
+                    encoding:encoding.
+
+    ^ newFont 
+! !
+
 !XftFontDescription methodsFor:'displaying'!
 
 displayString:aString from:index1 to:index2Arg x:xArg y:yArg in:aGC opaque:opaque
@@ -799,7 +815,11 @@
     ].
 
     [
-        myPatternId := self xftPatternCreate.
+        Error handle:[:ex |
+            ^ self asNonXftFont onDevice:aGraphicsDevice
+        ] do:[
+            myPatternId := self xftPatternCreate.
+        ].
         self xftPatternAdd: myPatternId attribute: FC_FAMILY  value: family.
         pixelSize notNil ifTrue:[
             self xftPatternAdd: myPatternId attribute: FC_PIXEL_SIZE value: pixelSize.
@@ -2045,11 +2065,11 @@
 !XftFontDescription class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/XftFontDescription.st,v 1.60 2014-07-09 02:56:41 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/XftFontDescription.st,v 1.61 2014-11-12 12:14:33 ab Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/XftFontDescription.st,v 1.60 2014-07-09 02:56:41 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/XftFontDescription.st,v 1.61 2014-11-12 12:14:33 ab Exp $'
 ! !