Next / Previous / Contents / Shipman's homepage

22.5. OutBlock.renderLine(): Render text

This method adds an XSL-FO rendering of the text to a parent block. Each character is rendered by Section 22.6, “OutBlock.renderChar(): Translate one character to XSL-FO”.

# - - -   O u t B l o c k . r e n d e r L i n e

    def renderLine(self, parent):
        '''Translate self.text to XSL-FO.

          [ parent is an et.Element ->
              parent  :=  parent with self.text added, rendered as
                          XSL-FO ]

It is essential that empty lines (and empty overflow lines) appear in the listing, but when xep translates FO into PDF, it ignores a block with no content. Hence, we substitute a single space if line is the empty string.

        #-- 1
        if len(self.text) > 0:
            for c in self.text:
                self.renderChar(parent, c)
            self.renderChar(parent, ' ')