Browse code

Improved textlayout creation.

Timo Vanwynsberghe authored on 03/04/2013 23:06:18 • Jose Fonseca committed on 14/07/2015 21:19:28
Showing 1 changed files

  • xdot.py index fdb3a00..08300d8 100755
... ...
@@ -120,11 +120,11 @@ class TextShape(Shape):
120 120
         try:
121 121
             layout = self.layout
122 122
         except AttributeError:
123
-            context = Gdk.pango_context_get()
124
-            layout = Pango.Layout(context)
123
+            layout = PangoCairo.create_layout(cr)
125 124
 
126 125
             # set font options
127 126
             # see http://lists.freedesktop.org/archives/cairo/2007-February/009688.html
127
+            context = layout.get_context()
128 128
             fo = cairo.FontOptions()
129 129
             fo.set_antialias(cairo.ANTIALIAS_DEFAULT)
130 130
             fo.set_hint_style(cairo.HINT_STYLE_NONE)