Example #1
0
 def draw_image(self, x, y, width, height, imgref):
     name = self.current_page.add_image(imgref)
     self.current_page.write(
         'q %s 0 0 %s %s %s cm ' %
         (fmtnum(width), fmtnum(-height), fmtnum(x), fmtnum(y + height)))
     serialize(Name(name), self.current_page)
     self.current_page.write_line(' Do Q')
Example #2
0
 def draw_glyph_run(self, transform, size, font_metrics, glyphs):
     glyph_ids = {x[-1] for x in glyphs}
     fontref = self.font_manager.add_font(font_metrics, glyph_ids)
     name = self.current_page.add_font(fontref)
     self.current_page.write(b'BT ')
     serialize(Name(name), self.current_page)
     self.current_page.write(' %s Tf '%fmtnum(size))
     self.current_page.write('%s Tm '%' '.join(map(fmtnum, transform)))
     for x, y, glyph_id in glyphs:
         self.current_page.write_raw(('%s %s Td <%04X> Tj '%(
             fmtnum(x), fmtnum(y), glyph_id)).encode('ascii'))
     self.current_page.write_line(b' ET')
Example #3
0
 def draw_glyph_run(self, transform, size, font_metrics, glyphs):
     glyph_ids = {x[-1] for x in glyphs}
     fontref = self.font_manager.add_font(font_metrics, glyph_ids)
     name = self.current_page.add_font(fontref)
     self.current_page.write(b'BT ')
     serialize(Name(name), self.current_page)
     self.current_page.write(' %s Tf '%fmtnum(size))
     self.current_page.write('%s Tm '%' '.join(map(fmtnum, transform)))
     for x, y, glyph_id in glyphs:
         self.current_page.write_raw(('%s %s Td <%04X> Tj '%(
             fmtnum(x), fmtnum(y), glyph_id)).encode('ascii'))
     self.current_page.write_line(b' ET')
Example #4
0
 def write_path(self, path):
     for i, op in enumerate(path.ops):
         if i != 0:
             self.current_page.write_line()
         for x in op:
             self.current_page.write(
                 (fmtnum(x) if isinstance(x, numbers.Number) else x) + ' ')
Example #5
0
 def write_path(self, path):
     for i, op in enumerate(path.ops):
         if i != 0:
             self.current_page.write_line()
         for x in op:
             self.current_page.write(
             (fmtnum(x) if isinstance(x, (int, long, float)) else x) + ' ')
Example #6
0
 def write_path(self, path):
     for i, op in enumerate(path.ops):
         if i != 0:
             self.current_page.write_line()
         for x in op:
             self.current_page.write(
             (fmtnum(x) if isinstance(x, (int, long, float)) else x) + ' ')
Example #7
0
 def write_path(self, path):
     for i, op in enumerate(path.ops):
         if i != 0:
             self.current_page.write_line()
         for x in op:
             self.current_page.write(
             (fmtnum(x) if isinstance(x, numbers.Number) else x) + ' ')
Example #8
0
 def draw_image(self, x, y, width, height, imgref):
     name = self.current_page.add_image(imgref)
     self.current_page.write('q %s 0 0 %s %s %s cm '%(fmtnum(width),
                         fmtnum(-height), fmtnum(x), fmtnum(y+height)))
     serialize(Name(name), self.current_page)
     self.current_page.write_line(' Do Q')