#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Wed, 23 Nov 2016 21:12:49 +0100
changeset 7701 8ec4585fa762
parent 7700 8a7791c4bceb
child 7702 2c1397577aa2
#REFACTORING by cg class: Font added: #onDevice:xFontsOnly:xftFontsOnly:ifAbsent: removed: #onDevice:ifAbsent:
Font.st
--- a/Font.st	Wed Nov 23 21:12:30 2016 +0100
+++ b/Font.st	Wed Nov 23 21:12:49 2016 +0100
@@ -436,20 +436,26 @@
     "Modified: 14.4.1997 / 18:22:31 / cg"
 !
 
-onDevice:aDevice ifAbsent:exceptionBlock 
-    "create a new Font representing the same font as
-     myself on aDevice. This does NOT try to look for existing
+onDevice:aDevice xFontsOnly:xFontsOnly xftFontsOnly:xftFontsOnly ifAbsent:exceptionBlock 
+    "create a new Font representing the same font as myself on aDevice. 
+     The xFontsOnly/xftFontsOnly are only relevant for XWindow devices;
+     xFontsOnly will suppress xft fonts, whereas xftFontsOnly will suppress x fonts
+     (the first is useful if ST/X has a slow remote X connection for display,
+      on which xft fonts are very slow. Yes, this is actually a reasonable setup
+      in use at one of our customers)
+     This does NOT try to look for existing
      or replacement fonts (i.e. can be used to get physical fonts)."
 
     |id xftFont|
 
     "receiver was not associated - do it now"
     device isNil ifTrue:[
-        (aDevice supportsXftFonts 
-        and:[ UserPreferences current useXFontsOnly not ]) ifTrue:[
-            xftFont := (XftFontDescription for:self) onDevice:aDevice ifAbsent:[nil].
-            xftFont notNil ifTrue:[^ xftFont].
-            UserPreferences current useXftFontsOnly ifTrue:[^ nil].
+        aDevice supportsXftFonts ifTrue:[
+            xFontsOnly ifFalse:[
+                xftFont := (XftFontDescription for:self) onDevice:aDevice ifAbsent:[nil].
+                xftFont notNil ifTrue:[^ xftFont].
+                xftFontsOnly ifTrue:[^ nil].
+            ].    
         ].    
         
         "ask that device for the font"