Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/globos.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2013-04-11 17:53:16 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2013-04-11 17:53:16 (GMT)
commit0dfc0796ab2ee77cc23543fe8e28077b2e552fe5 (patch)
treea8aaca02d308ea3fc7bfbc7b1e3c8d16ed74bcb2 /globos.py
parenta4c765a0cecf34b42ea86a1aad5f03cf49227d2a (diff)
Set the screen resoulution to get the right font size in the xo - SL #3436
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'globos.py')
-rw-r--r--globos.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/globos.py b/globos.py
index 1528e21..3512d4e 100644
--- a/globos.py
+++ b/globos.py
@@ -23,6 +23,20 @@ DIR_DER = "der"
DEFAULT_FONT = 'Sans'
+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
+
+
+def _set_screen_dpi():
+ dpi = _get_screen_dpi()
+ font_map_default = PangoCairo.font_map_get_default()
+ font_map_default.set_resolution(dpi)
+
+_set_screen_dpi()
+
class Globo:
def __init__(self, box, x, y, ancho=50, alto=30, modo="normal",
@@ -792,11 +806,6 @@ class CuadroTexto:
self._in_edition = False
self._size_alloc_id = 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, parse=True):
self.font_description = fd
if self._in_edition: