def __init__(self, dc=None): self.dc = dc or cairo.Context( cairo.ImageSurface(cairo.FORMAT_RGB24, 1, 1)) self.pc = pangocairo.CairoContext(self.dc) self.layout = self.pc.create_layout()