diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2013-04-11 17:53:16 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2013-04-11 17:53:16 (GMT) |
commit | 0dfc0796ab2ee77cc23543fe8e28077b2e552fe5 (patch) | |
tree | a8aaca02d308ea3fc7bfbc7b1e3c8d16ed74bcb2 /globos.py | |
parent | a4c765a0cecf34b42ea86a1aad5f03cf49227d2a (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.py | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -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: |