Beispiel #1
0
    def typeset(self, parent_box, x, y, w, h):
        left_width, right_width = self.widths(w)

        line_spacing = ( self.style.line_height * self.style.font_size ) - \
                       self.style.font_size


        tb = textbox(parent_box, x, y, left_width, h, border=debug.verbose)
        parent_box.append(tb)

        tb.set_font(font = self.style.font,
                    font_size = self.style.font_size,
                    kerning = True,
                    alignment = self.style.text_align,
                    char_spacing = self.style.char_spacing,
                    line_spacing = line_spacing)


        if self.style.color is not None:
            print(self.style.color, file=tb)

        tb.typeset(self.left)

        tb = textbox(parent_box,
                     left_width, y, right_width, h,
                     border=debug.verbose)
        parent_box.append(tb)

        tb.set_font(font = self.style.font,
                    font_size = self.style.font_size,
                    kerning = True,
                    alignment = self.style.text_align,
                    char_spacing = self.style.char_spacing,
                    line_spacing = line_spacing)


        if self.style.color is not None:
            print(self.style.color, file=tb)

        tb.typeset(self.right)

        return ""
Beispiel #2
0
    def typeset(self, parent_box, x, y, w, h):
        left_width, right_width = self.widths(w)

        line_spacing = ( self.style.line_height * self.style.font_size ) - \
                       self.style.font_size

        tb = textbox(parent_box, x, y, left_width, h, border=debug.verbose)
        parent_box.append(tb)

        tb.set_font(font=self.style.font,
                    font_size=self.style.font_size,
                    kerning=True,
                    alignment=self.style.text_align,
                    char_spacing=self.style.char_spacing,
                    line_spacing=line_spacing)

        if self.style.color is not None:
            print(self.style.color, file=tb)

        tb.typeset(self.left)

        tb = textbox(parent_box,
                     left_width,
                     y,
                     right_width,
                     h,
                     border=debug.verbose)
        parent_box.append(tb)

        tb.set_font(font=self.style.font,
                    font_size=self.style.font_size,
                    kerning=True,
                    alignment=self.style.text_align,
                    char_spacing=self.style.char_spacing,
                    line_spacing=line_spacing)

        if self.style.color is not None:
            print(self.style.color, file=tb)

        tb.typeset(self.right)

        return ""
Beispiel #3
0
    def typeset(self, parent_box, x, y, w, h):
        line_spacing = ( self.style.line_height * self.style.font_size ) - \
                       self.style.font_size

        tb = textbox(parent_box, x, y, w, h, border=debug.verbose)
        parent_box.append(tb)

        tb.set_font(font = self.style.font,
                    font_size = self.style.font_size,
                    kerning = True,
                    alignment = self.style.text_align,
                    char_spacing = self.style.char_spacing,
                    line_spacing = line_spacing)

        if self.style.color is not None:
            print (self.style.color, file=tb)

        return tb.typeset(" ".join(self.words()))
Beispiel #4
0
    def typeset(self, parent_box, x, y, w, h):
        line_spacing = ( self.style.line_height * self.style.font_size ) - \
                       self.style.font_size

        tb = textbox(parent_box, x, y, w, h, border=debug.verbose)
        parent_box.append(tb)

        tb.set_font(font=self.style.font,
                    font_size=self.style.font_size,
                    kerning=True,
                    alignment=self.style.text_align,
                    char_spacing=self.style.char_spacing,
                    line_spacing=line_spacing)

        if self.style.color is not None:
            print(self.style.color, file=tb)

        return tb.typeset(" ".join(self.words()))
Beispiel #5
0
def new_page(document, background, italic):
    """
    This is the generator I was talking about in the comment to the
    layout() function above.
    """
    while True:
        page = document.page("a4", None)
        page.append(background)

        left = layout_box(page, mm(40), mm(25), mm(75), mm(242.99),
                          debug.verbose)
        right = layout_box(page, mm(124.75), mm(25), mm(75), mm(242.99),
                           debug.verbose)

        stand = textbox(page, mm(40), mm(19), mm(100), 7)
        stand.set_font(italic, 7)
        page.append(stand)
        stand.typeset("Stand: " + str(now().strftime("%d.%m.%Y")))

        page.append(left)
        yield left

        page.append(right)
        yield right
Beispiel #6
0
def new_page(document, background, italic):
    """
    This is the generator I was talking about in the comment to the
    layout() function above.
    """
    while True:
        page = document.page("a4", None)
        page.append(background)

        left = layout_box(page, mm(40), mm(25), mm(75), mm(242.99),
                          debug.verbose)
        right = layout_box(page, mm(124.75), mm(25), mm(75), mm(242.99),
                           debug.verbose)

        stand = textbox(page, mm(40), mm(19), mm(100), 7)
        stand.set_font(italic, 7)
        page.append(stand)
        stand.typeset("Stand: " + str(now().strftime("%d.%m.%Y")))

        page.append(left)
        yield left

        page.append(right)
        yield right