protected void finishInlineBox(final InlineRenderBox box) {
    if (box.getStaticBoxLayoutProperties().isVisible() == false) {
      return;
    }

    textExtractorHelper.finishBox(box.getInstanceId(), box.getAttributes());
  }
  protected void drawComplexText(final RenderableComplexText renderableComplexText) {
    try {

      if (renderableComplexText.getRichText().isEmpty()) {
        // This text is empty.
        return;
      }
      if (renderableComplexText.isNodeVisible(getParagraphBounds(), isOverflowX(), isOverflowY())
          == false) {
        return;
      }

      // iterate through all inline elements
      for (final RichTextSpec.StyledChunk styledChunk :
          renderableComplexText.getRichText().getStyleChunks()) {
        RenderNode node = styledChunk.getOriginatingTextNode();
        InstanceID dummy = node.getInstanceId();
        textExtractorHelper.startInlineBox(
            dummy,
            styledChunk.getOriginalAttributes(),
            styledChunk.getStyleSheet(),
            BoxDefinition.EMPTY);
        if (node instanceof RenderableReplacedContentBox) {
          processRenderableContent((RenderableReplacedContentBox) node);
          result = true;
        } else {
          String text = styledChunk.getText();
          xmlWriter.writeText(characterEntityParser.encodeEntities(text));
          if (text.trim().length() > 0) {
            result = true;
          }
        }
        textExtractorHelper.finishBox(dummy, styledChunk.getOriginalAttributes());
        clearText();
      }
    } catch (final IOException ioe) {
      throw new InvalidReportStateException("Failed to write text", ioe);
    }
  }