Example #1
0
 def render(self, box):
     # first pass to calculate size
     ship(self, 0, 0, box)
     
     minx = min(self.xvalues) - 1
     maxx = max(self.xvalues) + 1
     miny = min(self.yvalues) - 1
     maxy = max(self.yvalues) + 1
     
     width = maxx - minx
     height = maxy - miny - box.depth
     depth =  maxy - miny - box.height
     
     image = ft.FT2Image(math.ceil(width), math.ceil(height + depth))
     
     # second pass
     self.calcsize = False
     ship(self, -minx, -miny, box)
     
     for ox, oy, info in self.glyps:
         thetext = unichr_safe(info.num)
         ccode = ord(thetext)
         
         info.font.set_size(info.fontsize, 72)
         glyph = info.font.load_char(ccode)
         
         info.font.draw_glyph_to_bitmap(image, ox, oy - info.metrics.iceberg, glyph)
     
     for x1, y1, x2, y2 in self.rects:
         image.draw_rect_filled(x1, y1, x2, y2)
     
     return image
Example #2
0
    def render(self, box):
        # first pass to calculate size
        ship(self, 0, 0, box)

        minx = min(self.xvalues) - 1
        maxx = max(self.xvalues) + 1
        miny = min(self.yvalues) - 1
        maxy = max(self.yvalues) + 1

        width = maxx - minx
        height = maxy - miny - box.depth
        depth = maxy - miny - box.height

        image = ft.FT2Image(math.ceil(width), math.ceil(height + depth))

        # second pass
        self.calcsize = False
        ship(self, -minx, -miny, box)

        for ox, oy, info in self.glyps:
            thetext = unichr_safe(info.num)
            ccode = ord(thetext)

            info.font.set_size(info.fontsize, 72)
            glyph = info.font.load_char(ccode)

            info.font.draw_glyph_to_bitmap(image, ox,
                                           oy - info.metrics.iceberg, glyph)

        for x1, y1, x2, y2 in self.rects:
            image.draw_rect_filled(x1, y1, x2, y2)

        return image
Example #3
0
 def render(self, box):
     self.set_canvas_size(box.width, box.height, box.depth)
     
     self.canvas.setLineWidth(0)
     self.canvas.setDash([])
     ship(self, 0, -self.depth, box)
     
     return self.width, self.height + self.depth, self.depth
Example #4
0
    def render(self, box):
        self.set_canvas_size(box.width, box.height, box.depth)

        self.canvas.setLineWidth(0)
        self.canvas.setDash([])
        ship(self, 0, -self.depth, box)

        return self.width, self.height + self.depth, self.depth
Example #5
0
 def render(self, box):
     self.set_canvas_size(box.width, box.height, box.depth)
     ship(self, 0, -self.depth, box)
     return self.width, self.height + self.depth, self.depth
Example #6
0
 def render(self, box):
     self.set_canvas_size(box.width, box.height, box.depth)
     ship(self, 0, -self.depth, box)
     return self.width, self.height + self.depth, self.depth