XWorkstation.st
changeset 7706 58502053b67b
parent 7699 8c953a0bca19
child 7723 620e91f9b082
child 7756 e85e23f3b476
--- a/XWorkstation.st	Thu Nov 24 09:52:40 2016 +0100
+++ b/XWorkstation.st	Thu Nov 24 09:54:39 2016 +0100
@@ -37,6 +37,13 @@
 	category:'Interface-Graphics'
 !
 
+Object subclass:#PseudoDeviceWithoutXFTSupport
+	instanceVariableNames:'realDevice'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:XWorkstation
+!
+
 Object subclass:#SelectionFetcher
 	instanceVariableNames:'sema message display drawableID selectionID propertyID targetID
 		buffer done incremental'
@@ -1017,6 +1024,15 @@
     ^ nil
 !
 
+asPseudoDeviceWithoutXFTSupport
+    "return a pseudo device to be used when drawing into pixmaps
+     on a device where xft-drawing into pixmaps is broken.
+     This is a temporary hack, to be removed when that problem is fixed in xft;
+     then, we should return self here."
+     
+    ^ PseudoDeviceWithoutXFTSupport basicNew realDevice:self
+!
+
 blackpixel
     "return the colornumber of black"
 
@@ -13279,6 +13295,45 @@
     ^ false "/ or true or what ?
 ! !
 
+!XWorkstation::PseudoDeviceWithoutXFTSupport class methodsFor:'documentation'!
+
+documentation
+"
+    this is a proxy device, which forwards its messages to a real device,
+    possibly overriding some messages.
+    It is currently only used as a hack (workaround) a bug in the XWindows
+    interface, which cannot draw strings into pixmaps using XFT fonts.
+    For this, a pseudoDevice instance is set as device into the pixmap's GC,
+    so it will draw using non-xft fonts.
+    This should vanish, once the xft drawing works.
+    
+    [author:]
+        cg
+"
+! !
+
+!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'accessing'!
+
+realDevice:aDevice
+    realDevice := aDevice.
+! !
+
+!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'message forwarding'!
+
+doesNotUnderstand:aMessage
+    ^ aMessage sendTo:realDevice
+! !
+
+!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'queries'!
+
+deviceFonts
+    ^ realDevice deviceFonts keys reject:[:f | f isXftFont ]
+!
+
+supportsXftFonts
+    ^ false.
+! !
+
 !XWorkstation::SelectionFetcher class methodsFor:'documentation'!
 
 documentation