コード例 #1
0
ファイル: caw.py プロジェクト: Roger/caw
    def _init_pango(self):
        self.layout_c = cawc.pango_cairo_create_layout(self.cairo_c)

        if self.dpi > 0:
            cawc.pango_cairo_layout_set_resolution(self.layout_c, self.dpi)

        self.fontdesc_c = cawc.pango_font_description_from_string(self.font_face + ' ' + str(self.font_size))
        cawc.pango_layout_set_font_description(self.layout_c, self.fontdesc_c)
        _, self._font_height = cawc.pango_layout_get_pixel_size(self.layout_c)
        print "Font Height:", self._font_height
コード例 #2
0
ファイル: caw.py プロジェクト: Roger/caw
 def text_width(self, text):
     cawc.pango_layout_set_text(self.layout_c, text)
     width, _ = cawc.pango_layout_get_pixel_size(self.layout_c)
     return width