def __init__(self, fobj, width, height, format='pdf', pixels=False): """ width (horizontal) and height (vertical) in mm """ GraphicsInterface.__init__(self, (width / DPMM_IMG if pixels else width), (height / DPMM_IMG if pixels else height)) self.fobj = fobj self.format = format self.surface = None self.context = None self.sfc_width = None self.sfc_height = None self.set_origin(self.gi_width / 2.0, self.gi_height / 2.0)
def set_font(self, font='Arial', fontsize=12 * POINT): GraphicsInterface.set_font(self, font, fontsize) self.context.set_font_size(self.gi_fontsize) self.context.select_font_face(self.gi_font, cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
def restore(self): GraphicsInterface.restore(self) self.context.restore()
def save(self): GraphicsInterface.save(self) self.context.save()
def set_dashed_line(self, on, off, start=0.0): GraphicsInterface.set_dashed_line(self, on, off, start)
def set_solid_line(self): GraphicsInterface.set_solid_line(self)
def set_linewidth(self, linewidth): GraphicsInterface.set_linewidth(self, linewidth) self.context.set_line_width(linewidth)