Example #1
0
def create_layout(pcr, text, width):
    lyt = pcr.create_layout()
    lyt.set_font_description(settings.default_font)
    lyt.set_text(text)
    lyt.set_width(pango.units_from_double(width))
    lyt.set_wrap(pango.WRAP_WORD_CHAR)
    return lyt
Example #2
0
 def draw_pango_text(self, cr):
     cr.set_source_rgba(*self.stroke_color)
     pcr = pangocairo.CairoContext(cr)
     lyt = pcr.create_layout()
     lyt.set_font_description(pango.FontDescription("Sans 9"))
     lyt.set_text(self.text)
     lyt.set_width(pango.units_from_double(self.width))
     lyt.set_wrap(pango.WRAP_WORD_CHAR)
     func(cr, lyt, self.x, self.y, self.width, self.height)
     pcr.show_layout(lyt)
     return lyt