コード例 #1
0
  @Override
  public void renderContents(
      Canvas canvas,
      Vector2i startPos,
      ContainerRenderSpace containerRenderSpace,
      int leftIndent,
      int rightIndent,
      ParagraphRenderStyle defaultStyle,
      HorizontalAlign horizontalAlign,
      HyperlinkRegister hyperlinkRegister) {
    FallbackParagraphRenderStyle fallbackStyle =
        new FallbackParagraphRenderStyle(paragraphRenderStyle, defaultStyle);
    int containerWidth = containerRenderSpace.getContainerWidth();
    int leftIndents =
        fallbackStyle.getParagraphMarginLeft().getValue(containerWidth)
            + fallbackStyle.getParagraphPaddingLeft().getValue(containerWidth);
    int rightIndents =
        fallbackStyle.getParagraphPaddingRight().getValue(containerWidth)
            + fallbackStyle.getParagraphMarginRight().getValue(containerWidth);
    int topIndents =
        fallbackStyle.getParagraphMarginTop().getValue(containerWidth)
            + fallbackStyle.getParagraphPaddingTop().getValue(containerWidth);

    DocumentRenderer.renderParagraphs(
        canvas,
        hyperlinkRegister,
        fallbackStyle,
        startPos.x,
        startPos.y + topIndents,
        leftIndent + leftIndents,
        rightIndent + rightIndents,
        paragraphs,
        containerRenderSpace);
  }
コード例 #2
0
 @Override
 public int getContentsMinWidth(ParagraphRenderStyle defaultStyle) {
   FallbackParagraphRenderStyle fallbackStyle =
       new FallbackParagraphRenderStyle(paragraphRenderStyle, defaultStyle);
   int paragraphIndents =
       fallbackStyle.getParagraphMarginLeft().getValue(0)
           + fallbackStyle.getParagraphPaddingLeft().getValue(0)
           + fallbackStyle.getParagraphPaddingRight().getValue(0)
           + fallbackStyle.getParagraphMarginRight().getValue(0);
   return paragraphIndents
       + DocumentRenderer.getParagraphsMinimumWidth(0, fallbackStyle, paragraphs);
 }
コード例 #3
0
 @Override
 public int getPreferredContentsHeight(
     ParagraphRenderStyle defaultStyle,
     int yStart,
     ContainerRenderSpace containerRenderSpace,
     int sideIndents) {
   FallbackParagraphRenderStyle fallbackStyle =
       new FallbackParagraphRenderStyle(paragraphRenderStyle, defaultStyle);
   int containerWidth = containerRenderSpace.getContainerWidth();
   int topIndent =
       fallbackStyle.getParagraphMarginTop().getValue(containerWidth)
           + fallbackStyle.getParagraphPaddingTop().getValue(containerWidth);
   int paragraphIndents =
       topIndent
           + fallbackStyle.getParagraphPaddingBottom().getValue(containerWidth)
           + fallbackStyle.getParagraphMarginBottom().getValue(containerWidth);
   return paragraphIndents
       + DocumentRenderer.getParagraphsPreferredHeight(
           fallbackStyle, paragraphs, containerRenderSpace, yStart + topIndent);
 }