Cairo__ScaledFont.st
changeset 55 c0fed31c643c
parent 43 1006839761af
child 63 054f0513ea65
--- a/Cairo__ScaledFont.st	Sun Feb 28 16:57:24 2016 +0000
+++ b/Cairo__ScaledFont.st	Mon Feb 29 06:41:02 2016 +0000
@@ -13,14 +13,27 @@
 !ScaledFont class methodsFor:'instance creation'!
 
 fromFontDescription: aFontDescription
-    ^ self fromFontFace: (FontFace fromFontDescription: aFontDescription) scale: (Screen current verticalPixelPerInch / 72) * aFontDescription size.
+    | screen vDPI |
+
+    screen := Screen current.
+    screen isX11Platform ifTrue:[ 
+        "/ XWorkstation does not properly calculate the DPI on multihead
+        "/ configurations, see:
+        "/    https://swing.fit.cvut.cz/projects/stx-jv/ticket/74
+        "/ For now, use 96 which seems to be hardcoded in various places, see:
+        "/    http://unix.stackexchange.com/questions/75344/how-does-x-server-calculate-dpi
+        vDPI := 96.
+    ] ifFalse:[ 
+        vDPI := screen verticalPixelPerInch.
+    ].
+    ^ self fromFontFace: (FontFace fromFontDescription: aFontDescription) scale: (vDPI / 72) * aFontDescription size.
 
     "
     Cairo::ScaledFont fromFontDescription: CodeView defaultFont               
     "
 
     "Created: / 17-02-2016 / 20:21:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 18-02-2016 / 08:16:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 29-02-2016 / 06:39:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 fromFontFace: face matrix: fontMatrix transformation: transformationMatrix options: options