def get_pixel_size(self): width = ffi.new("int[1]") height = ffi.new("int[1]") pango.pango_layout_get_pixel_size(self._pointer, width, height) return width[0], height[0]
def parse_markup(value, accel_marker=0): attr_list = ffi.new("PangoAttrList**") text = ffi.new("char**") error = ffi.new("GError**") value = value.encode() ret = pango.pango_parse_markup(value, -1, accel_marker, attr_list, text, ffi.NULL, error) if ret == 0: raise Exception("parse_markup() failed for %s" % value) return attr_list[0], ffi.string(text[0]), chr(accel_marker)