Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-09-19 13:37:22 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-09-20 16:03:39 (GMT)
commitd46c181abb618dfd68308f97d519e46e35935a4b (patch)
tree347abf46f69bbfbd73b5d595bc9b42152c36c948
parent1e1cee456956e7df512f805514273c0e7ff71983 (diff)
Text in XO is at the wrong size - SL #3850
Needed set the dpi with PangoCairo Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r--Area.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Area.py b/Area.py
index 5055c12..082b026 100644
--- a/Area.py
+++ b/Area.py
@@ -67,6 +67,7 @@ from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import GObject
from gi.repository import Pango
+from gi.repository import PangoCairo
import logging
import os
@@ -95,6 +96,11 @@ TARGET_URI = 0
MAX_UNDO_STEPS = 12
RESIZE_ARROW_SIZE = style.GRID_CELL_SIZE / 2
+def _get_screen_dpi():
+ xft_dpi = Gtk.Settings.get_default().get_property('gtk-xft-dpi')
+ dpi = float(xft_dpi / 1024)
+ logging.error('Setting dpi to: %f', dpi)
+ return dpi
class Area(Gtk.DrawingArea):
@@ -178,6 +184,8 @@ class Area(Gtk.DrawingArea):
self.keep_aspect_ratio = False
self.keep_shape_ratio = False
+ self._set_screen_dpi()
+
self._font_description = None
self.set_font_description(
Pango.FontDescription(self.tool['font_description']))
@@ -195,6 +203,11 @@ class Area(Gtk.DrawingArea):
self.x_cursor = 0
self.y_cursor = 0
+ def _set_screen_dpi(self):
+ dpi = _get_screen_dpi()
+ font_map_default = PangoCairo.font_map_get_default()
+ font_map_default.set_resolution(dpi)
+
def set_font_description(self, fd):
self._font_description = fd
self.activity.textview.modify_font(fd)