Package org.jfree.layouting.renderer.text

Examples of org.jfree.layouting.renderer.text.ExtendedBaselineInfo


  private long baselineShift;

  public TextElementAlignContext(final RenderableText text)
  {
    super(text);
    final ExtendedBaselineInfo baselineInfo = text.getBaselineInfo();
    this.baselines = baselineInfo.getBaselines();
    setDominantBaseline(baselineInfo.getDominantBaseline());
  }
View Full Code Here


  public BoxAlignContext(final RenderBox box)
  {
    super(box);

    ExtendedBaselineInfo baselineInfo = box.getBaselineInfo();
    if (baselineInfo == null)
    {
      baselineInfo = box.getNominalBaselineInfo();
    }

    final CSSValue dominantBaselineValue = box.getDominantBaseline();
    setDominantBaseline(TextUtility.translateDominantBaseline
        (dominantBaselineValue, baselineInfo.getDominantBaseline()));

    final ComputedLayoutProperties blp = box.getComputedLayoutProperties();
    insetsTop = blp.getBorderTop() + blp.getPaddingTop();
    insetsBottom = blp.getBorderBottom() + blp.getPaddingBottom();

    baselines = (long[]) baselineInfo.getBaselines().clone();
    for (int i = 1; i < baselines.length; i++)
    {
      baselines[i] += insetsTop;
    }
    baselines[ExtendedBaselineInfo.AFTER_EDGE] =
View Full Code Here

  private long baselineShift;

  public InlineBlockAlignContext(final RenderBox box)
  {
    super(box);
    final ExtendedBaselineInfo baselineInfo = box.getBaselineInfo();
    this.baselines = baselineInfo.getBaselines();
    setDominantBaseline(baselineInfo.getDominantBaseline());
  }
View Full Code Here

    if (sequenceElement instanceof EndSequenceElement)
    {
      return offset;
    }

    final ExtendedBaselineInfo baselineInfo;
    final RenderNode node = sequenceElement.getNode();
    if (sequenceElement instanceof TextSequenceElement)
    {
      final RenderableText text = (RenderableText) node;
      baselineInfo = text.getBaselineInfo();
    }
    else
    {
      baselineInfo = null;
    }

    // This is the initial call.
    final long preferredSize = 0;
    if (baselinePositions == null)
    {
      this.height = Math.max (height, preferredSize);
      final long delta = height - preferredSize;

      if (baselineInfo == null)
      {
        // ok, no baseline info at all. Dont panic. We have recorded the
        // height and wait for the next element. Once we hit an element
        // that has a baseline, we will shift it by the delta-amount.
        return delta;
      }

      this.dominantBaseline = baselineInfo.getDominantBaseline();
      this.baselinePositions = baselineInfo.getBaselines();
      if (delta > 0)
      {
        baselineShift += delta;
      }
      //this.initialBaselinePositions = (long[]) baselinePositions.clone();
      return delta;
    }

    // now here comes the tricky part
    final CSSValue verticalAlignment = null;//node.getVerticalAlignment();
    if (baselineInfo == null ||
        VerticalAlign.TOP.equals(verticalAlignment) ||
        VerticalAlign.BOTTOM.equals(verticalAlignment) ||
        VerticalAlign.MIDDLE.equals(verticalAlignment))
    {
      return alignSimple(verticalAlignment, preferredSize);
    }

    // This is one of the baseline alignments. The alignment value tells us
    // which baseline will be used for the alignment.
    final int localBase;
    final int nodeBase;
    if (VerticalAlign.CENTRAL.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.CENTRAL;
      localBase = ExtendedBaselineInfo.CENTRAL;
    }
    else if (VerticalAlign.TEXT_BOTTOM.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.TEXT_AFTER_EDGE;
      localBase = ExtendedBaselineInfo.TEXT_AFTER_EDGE;
    }
    else if (VerticalAlign.TEXT_TOP.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.TEXT_BEFORE_EDGE;
      localBase = ExtendedBaselineInfo.TEXT_BEFORE_EDGE;
    }
    else if (VerticalAlign.SUB.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.MATHEMATICAL;
      localBase = dominantBaseline;
    }
    else if (VerticalAlign.SUPER.equals(verticalAlignment))
    {
      nodeBase = baselineInfo.getDominantBaseline();
      localBase = ExtendedBaselineInfo.MATHEMATICAL;
    }
    else if (VerticalAlign.BASELINE.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.ALPHABETHIC;
      localBase = ExtendedBaselineInfo.ALPHABETHIC;
    }
    else
    {
      nodeBase = baselineInfo.getDominantBaseline();
      localBase = baselineInfo.getDominantBaseline();
    }

    final long[] baselines = baselineInfo.getBaselines();
    final long myAscent = baselinePositions[localBase] + baselineShift;
    final long nodeAscent = baselines[nodeBase];

    if (nodeAscent > myAscent)
    {
View Full Code Here

  private long baselineShift;

  public TextElementAlignContext(final RenderableText text)
  {
    super(text);
    final ExtendedBaselineInfo baselineInfo = text.getBaselineInfo();
    this.baselines = baselineInfo.getBaselines();
    setDominantBaseline(baselineInfo.getDominantBaseline());
  }
View Full Code Here

  private long baselineShift;

  public TextElementAlignContext(final RenderableText text)
  {
    super(text);
    final ExtendedBaselineInfo baselineInfo = text.getBaselineInfo();
    this.baselines = baselineInfo.getBaselines();
    setDominantBaseline(baselineInfo.getDominantBaseline());
  }
View Full Code Here

  public BoxAlignContext(final RenderBox box)
  {
    super(box);

    ExtendedBaselineInfo baselineInfo = box.getBaselineInfo();
    if (baselineInfo == null)
    {
      baselineInfo = box.getNominalBaselineInfo();
    }

    final CSSValue dominantBaselineValue = box.getDominantBaseline();
    setDominantBaseline(TextUtility.translateDominantBaseline
        (dominantBaselineValue, baselineInfo.getDominantBaseline()));

    final ComputedLayoutProperties blp = box.getComputedLayoutProperties();
    insetsTop = blp.getBorderTop() + blp.getPaddingTop();
    insetsBottom = blp.getBorderBottom() + blp.getPaddingBottom();

    baselines = (long[]) baselineInfo.getBaselines().clone();
    for (int i = 1; i < baselines.length; i++)
    {
      baselines[i] += insetsTop;
    }
    baselines[ExtendedBaselineInfo.AFTER_EDGE] =
View Full Code Here

  private long baselineShift;

  public InlineBlockAlignContext(final RenderBox box)
  {
    super(box);
    final ExtendedBaselineInfo baselineInfo = box.getBaselineInfo();
    this.baselines = baselineInfo.getBaselines();
    setDominantBaseline(baselineInfo.getDominantBaseline());
  }
View Full Code Here

    if (sequenceElement instanceof EndSequenceElement)
    {
      return offset;
    }

    final ExtendedBaselineInfo baselineInfo;
    final RenderNode node = sequenceElement.getNode();
    if (sequenceElement instanceof TextSequenceElement)
    {
      final RenderableText text = (RenderableText) node;
      baselineInfo = text.getBaselineInfo();
    }
    else
    {
      baselineInfo = null;
    }

    // This is the initial call.
    final long preferredSize = 0;
    if (baselinePositions == null)
    {
      this.height = Math.max (height, preferredSize);
      final long delta = height - preferredSize;

      if (baselineInfo == null)
      {
        // ok, no baseline info at all. Dont panic. We have recorded the
        // height and wait for the next element. Once we hit an element
        // that has a baseline, we will shift it by the delta-amount.
        return delta;
      }

      this.dominantBaseline = baselineInfo.getDominantBaseline();
      this.baselinePositions = baselineInfo.getBaselines();
      if (delta > 0)
      {
        baselineShift += delta;
      }
      //this.initialBaselinePositions = (long[]) baselinePositions.clone();
      return delta;
    }

    // now here comes the tricky part
    final CSSValue verticalAlignment = null;//node.getVerticalAlignment();
    if (baselineInfo == null ||
        VerticalAlign.TOP.equals(verticalAlignment) ||
        VerticalAlign.BOTTOM.equals(verticalAlignment) ||
        VerticalAlign.MIDDLE.equals(verticalAlignment))
    {
      return alignSimple(verticalAlignment, preferredSize);
    }

    // This is one of the baseline alignments. The alignment value tells us
    // which baseline will be used for the alignment.
    final int localBase;
    final int nodeBase;
    if (VerticalAlign.CENTRAL.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.CENTRAL;
      localBase = ExtendedBaselineInfo.CENTRAL;
    }
    else if (VerticalAlign.TEXT_BOTTOM.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.TEXT_AFTER_EDGE;
      localBase = ExtendedBaselineInfo.TEXT_AFTER_EDGE;
    }
    else if (VerticalAlign.TEXT_TOP.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.TEXT_BEFORE_EDGE;
      localBase = ExtendedBaselineInfo.TEXT_BEFORE_EDGE;
    }
    else if (VerticalAlign.SUB.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.MATHEMATICAL;
      localBase = dominantBaseline;
    }
    else if (VerticalAlign.SUPER.equals(verticalAlignment))
    {
      nodeBase = baselineInfo.getDominantBaseline();
      localBase = ExtendedBaselineInfo.MATHEMATICAL;
    }
    else if (VerticalAlign.BASELINE.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.ALPHABETHIC;
      localBase = ExtendedBaselineInfo.ALPHABETHIC;
    }
    else
    {
      nodeBase = baselineInfo.getDominantBaseline();
      localBase = baselineInfo.getDominantBaseline();
    }

    final long[] baselines = baselineInfo.getBaselines();
    final long myAscent = baselinePositions[localBase] + baselineShift;
    final long nodeAscent = baselines[nodeBase];

    if (nodeAscent > myAscent)
    {
View Full Code Here

      return offset;
    }

    final long preferredSize = 0;

    final ExtendedBaselineInfo baselineInfo;
    final RenderNode node = sequenceElement.getNode();
    if (sequenceElement instanceof TextSequenceElement)
    {
      final RenderableText text = (RenderableText) node;
      baselineInfo = text.getBaselineInfo();
    }
    else
    {
      baselineInfo = null;
    }

    // This is the initial call.
    if (baselinePositions == null)
    {
      this.height = Math.max (height, preferredSize);
      final long delta = height - preferredSize;

      if (baselineInfo == null)
      {
        // ok, no baseline info at all. Dont panic. We have recorded the
        // height and wait for the next element. Once we hit an element
        // that has a baseline, we will shift it by the delta-amount.
        return delta;
      }

      this.dominantBaseline = baselineInfo.getDominantBaseline();
      this.baselinePositions = baselineInfo.getBaselines();
      if (delta > 0)
      {
        baselineShift += delta;
      }
      //this.initialBaselinePositions = (long[]) baselinePositions.clone();
      return delta;
    }

    // now here comes the tricky part
    final CSSValue verticalAlignment = null;//node.getVerticalAlignment();
    if (baselineInfo == null ||
        VerticalAlign.TOP.equals(verticalAlignment) ||
        VerticalAlign.BOTTOM.equals(verticalAlignment) ||
        VerticalAlign.MIDDLE.equals(verticalAlignment))
    {
      return alignSimple(verticalAlignment, preferredSize);
    }

    // This is one of the baseline alignments. The alignment value tells us
    // which baseline will be used for the alignment.
    int localBase;
    int nodeBase;
    if (VerticalAlign.CENTRAL.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.CENTRAL;
      localBase = ExtendedBaselineInfo.CENTRAL;
    }
    else if (VerticalAlign.TEXT_BOTTOM.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.TEXT_AFTER_EDGE;
      localBase = ExtendedBaselineInfo.TEXT_AFTER_EDGE;
    }
    else if (VerticalAlign.TEXT_TOP.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.TEXT_BEFORE_EDGE;
      localBase = ExtendedBaselineInfo.TEXT_BEFORE_EDGE;
    }
    else if (VerticalAlign.SUB.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.MATHEMATICAL;
      localBase = dominantBaseline;
    }
    else if (VerticalAlign.SUPER.equals(verticalAlignment))
    {
      nodeBase = baselineInfo.getDominantBaseline();
      localBase = ExtendedBaselineInfo.MATHEMATICAL;
    }
    else if (VerticalAlign.BASELINE.equals(verticalAlignment))
    {
      nodeBase = ExtendedBaselineInfo.ALPHABETHIC;
      localBase = ExtendedBaselineInfo.ALPHABETHIC;
    }
    else
    {
      nodeBase = baselineInfo.getDominantBaseline();
      localBase = baselineInfo.getDominantBaseline();
    }

    final long[] baselines = baselineInfo.getBaselines();
    long myAscent = baselinePositions[localBase] + baselineShift;
    long nodeAscent = baselines[nodeBase];

    if (nodeAscent > myAscent)
    {
View Full Code Here

TOP

Related Classes of org.jfree.layouting.renderer.text.ExtendedBaselineInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.