docs: def typeset(self, container, text_align, last_line=False):
          """Typeset the line in `container` below its current cursor position.
          Advances the container's cursor to below the descender of this line.
  
          `justification` and `line_spacing` are passed on from the paragraph
          style. `last_descender` is the previous line's descender, used in the
          vertical positioning of this line. Finally, `last_line` specifies
          whether this is the last line of the paragraph.
  
          Returns the line's descender size."""
          document = container.document
  
          # drop spaces (and empty spans) at the end of the line
          while len(self) > 0:
              last_span = self[-1]
              if last_span and last_span.ends_with_space:
                  self.cursor -= last_span.space.width
                  self.pop()
              else:
                  break
          else:   # abort if the line is empty
              return
  
          for glyph_span in self:
              glyph_span.span.before_placing(container)
  
          # horizontal displacement
          left = self.indent
  
          if self._has_tab or text_align == TextAlign.JUSTIFY and last_line:
              text_align = 'left'
          extra_space = self.width - self.cursor
          if text_align == TextAlign.JUSTIFY:
              # TODO: padding added to spaces should be prop. to font size
              nr_spaces = sum(glyph_span.number_of_spaces for glyph_span in self)
              if nr_spaces > 0:
                  add_to_spaces = extra_space / nr_spaces
                  for glyph_span in self:
                      if glyph_span.number_of_spaces > 0:
                          glyph_span.space.width += add_to_spaces
          elif text_align == TextAlign.CENTER:
              left += extra_space / 2.0
          elif text_align == TextAlign.RIGHT:
              left += extra_space
  
          canvas = container.canvas
          cursor = container.cursor
          current_annotation = AnnotationState(container)
          for span, glyph_and_widths in group_spans(self):
              try:
                  width = canvas.show_glyphs(left, cursor, span, glyph_and_widths,
                                             container)
              except InlineFlowableException:
                  ascender = span.ascender(document)
                  if ascender > 0:
                      top = cursor - ascender
                  else:
                      inline_height = span.virtual_container.height
                      top = cursor - span.descender(document) - inline_height
                  span.virtual_container.place_at(container, left, top)
                  width = span.width
              current_annotation.update(span, left, width)
              left += width
          current_annotation.place_if_any()