Package org.pentaho.reporting.libraries.fonts.registry

Examples of org.pentaho.reporting.libraries.fonts.registry.BaselineInfo


    if (fontMetrics == null)
    {
      throw new NullPointerException("FontMetrics cannot be null");
    }

    final BaselineInfo baselineInfo = fontMetrics.getBaselines(codepoint, reusableBaselineInfo);
    final int dominantBaseline = TextUtility.translateBaselines(baselineInfo.getDominantBaseline());
    final long underlinePosition = fontMetrics.getUnderlinePosition();
    final long strikeThroughPosition = fontMetrics.getStrikeThroughPosition();
    return new DefaultExtendedBaselineInfo
        (dominantBaseline, baselineInfo, 0, 0, fontMetrics.getMaxHeight(),
            fontMetrics.getMaxHeight(), underlinePosition, strikeThroughPosition);
View Full Code Here


  {
    if (cachedBaselineInfo != null)
    {
      if (info == null)
      {
        info = new BaselineInfo();
      }
      info.update(cachedBaselineInfo);
      return info;
    }

    if (info == null)
    {
      info = new BaselineInfo();
    }

    // If we had more data, we could surely create something better. Well, this has to be enough ..
    final long maxAscent = getMaxAscent();
    info.setBaseline(BaselineInfo.MATHEMATICAL, maxAscent - getXHeight());
    info.setBaseline(BaselineInfo.IDEOGRAPHIC, getMaxHeight());
    info.setBaseline(BaselineInfo.MIDDLE, maxAscent / 2);
    info.setBaseline(BaselineInfo.ALPHABETIC, maxAscent);
    info.setBaseline(BaselineInfo.CENTRAL, maxAscent / 2);
    info.setBaseline(BaselineInfo.HANGING, maxAscent - getXHeight());
    info.setDominantBaseline(BaselineInfo.ALPHABETIC);

    final BaselineInfo cached = new BaselineInfo();
    cached.update(info);
    cachedBaselineInfo = cached;
    return info;
  }
View Full Code Here

   */
  public BaselineInfo getBaselines(final int codePoint, BaselineInfo info)
  {
    if (info == null)
    {
      info = new BaselineInfo();
    }


    info.setBaseline(BaselineInfo.HANGING, 0);
    info.setBaseline(BaselineInfo.MATHEMATICAL, charHeight / 2);
View Full Code Here

    if (fontMetrics == null)
    {
      throw new NullPointerException("FontMetrics cannot be null");
    }

    final BaselineInfo baselineInfo = fontMetrics.getBaselines(codepoint, reusableBaselineInfo);
    final int dominantBaseline = TextUtility.translateBaselines(baselineInfo.getDominantBaseline());
    final long underlinePosition = fontMetrics.getUnderlinePosition();
    final long strikeThroughPosition = fontMetrics.getStrikeThroughPosition();
    return new DefaultExtendedBaselineInfo
        (dominantBaseline, baselineInfo, 0, 0, fontMetrics.getMaxHeight(),
            fontMetrics.getMaxHeight(), underlinePosition, strikeThroughPosition);
View Full Code Here

  public BaselineInfo getBaselines(final int codePoint, BaselineInfo info)
  {
    if (info == null)
    {
      info = new BaselineInfo();
    }

    // If we had more data, we could surely create something better. Well, this has to be enough ..
    final long maxAscent = getMaxAscent();
    info.setBaseline(BaselineInfo.MATHEMATICAL, maxAscent - getXHeight());
    info.setBaseline(BaselineInfo.IDEOGRAPHIC, getMaxHeight());
    info.setBaseline(BaselineInfo.MIDDLE, maxAscent / 2);
    info.setBaseline(BaselineInfo.ALPHABETIC, maxAscent);
    info.setBaseline(BaselineInfo.CENTRAL, maxAscent / 2);
    info.setBaseline(BaselineInfo.HANGING, maxAscent - getXHeight());
    info.setDominantBaseline(BaselineInfo.ALPHABETIC);

    final BaselineInfo cached = new BaselineInfo();
    cached.update(info);
    return info;
  }
View Full Code Here

    return (long) (size * base.getAscent() / 1000f);
  }

  public BaselineInfo getBaselines(final int codePoint, final BaselineInfo info)
  {
    final BaselineInfo baselines = base.getBaselines(codePoint, info);
    if (baselines == null)
    {
      return null;
    }
    final long[] b = baselines.getBaselines();
    for (int i = 0; i < b.length; i++)
    {
      b[i] = (long) (size * b[i] / 1000f);
    }
    baselines.setBaselines(b);
    return baselines;
  }
View Full Code Here

  public BaselineInfo getBaselines(final int c, BaselineInfo info)
  {
    final boolean cacheable = (c >= 32 && c < 256);
    if (cacheable)
    {
      final BaselineInfo fromCache = cachedBaselines[c - 32];
      if (fromCache != null)
      {
        if (info == null)
        {
          info = new BaselineInfo();
        }
        info.update(fromCache);
        return info;
      }
    }

    cpBuffer[0] = (char) (c & 0xFFFF);
    final LineMetrics lm = font.getLineMetrics(cpBuffer, 0, 1, frc);
    final float[] bls = lm.getBaselineOffsets();
    final int idx = lm.getBaselineIndex();

    if (info == null)
    {
      info = new BaselineInfo();
    }

    // The ascent is local - but we need the global baseline, relative to the
    // MaxAscent.
    final long maxAscent = getMaxAscent();
    final long ascent = FontStrictGeomUtility.toInternalValue(lm.getAscent());
    final long delta = maxAscent - ascent;
    info.setBaseline(BaselineInfo.MATHEMATICAL, delta + maxAscent - getXHeight());
    info.setBaseline(BaselineInfo.IDEOGRAPHIC, getMaxHeight());
    info.setBaseline(BaselineInfo.MIDDLE, maxAscent / 2);

    final long base = delta + ascent;

    switch (idx)
    {
      case Font.CENTER_BASELINE:
      {
        info.setBaseline(BaselineInfo.CENTRAL, base);
        info.setBaseline(BaselineInfo.ALPHABETIC, base + FontStrictGeomUtility.toInternalValue(bls[Font.ROMAN_BASELINE]));
        info.setBaseline(BaselineInfo.HANGING, base + FontStrictGeomUtility.toInternalValue(bls[Font.HANGING_BASELINE]));
        info.setDominantBaseline(BaselineInfo.CENTRAL);
        break;
      }
      case Font.HANGING_BASELINE:
      {
        info.setBaseline(BaselineInfo.CENTRAL, base + FontStrictGeomUtility.toInternalValue(bls[Font.CENTER_BASELINE]));
        info.setBaseline(BaselineInfo.ALPHABETIC, base + FontStrictGeomUtility.toInternalValue(bls[Font.ROMAN_BASELINE]));
        info.setBaseline(BaselineInfo.HANGING, base);
        info.setDominantBaseline(BaselineInfo.HANGING);
        break;
      }
      default: // ROMAN Base-line
      {
        info.setBaseline(BaselineInfo.ALPHABETIC, base);
        info.setBaseline(BaselineInfo.CENTRAL, base + FontStrictGeomUtility.toInternalValue(bls[Font.CENTER_BASELINE]));
        info.setBaseline(BaselineInfo.HANGING, base + FontStrictGeomUtility.toInternalValue(bls[Font.HANGING_BASELINE]));
        info.setDominantBaseline(BaselineInfo.ALPHABETIC);
        break;
      }
    }

    if (cacheable)
    {
      final BaselineInfo cached = new BaselineInfo();
      cached.update(info);
      cachedBaselines[c - 32] = cached;
    }

    return info;
  }
View Full Code Here

   */
  public BaselineInfo getBaselines(final int codePoint, BaselineInfo info)
  {
    if (info == null)
    {
      info = new BaselineInfo();
    }


    info.setBaseline(BaselineInfo.HANGING, 0);
    info.setBaseline(BaselineInfo.MATHEMATICAL, charHeight / 2);
View Full Code Here

  {
    if (cachedBaselineInfo != null)
    {
      if (info == null)
      {
        info = new BaselineInfo();
      }
      info.update(cachedBaselineInfo);
      return info;
    }

    if (info == null)
    {
      info = new BaselineInfo();
    }

    // If we had more data, we could surely create something better. Well, this has to be enough ..
    final long maxAscent = getMaxAscent();
    info.setBaseline(BaselineInfo.MATHEMATICAL, maxAscent - getXHeight());
    info.setBaseline(BaselineInfo.IDEOGRAPHIC, getMaxHeight());
    info.setBaseline(BaselineInfo.MIDDLE, maxAscent / 2);
    info.setBaseline(BaselineInfo.ALPHABETIC, maxAscent);
    info.setBaseline(BaselineInfo.CENTRAL, maxAscent / 2);
    info.setBaseline(BaselineInfo.HANGING, maxAscent - getXHeight());
    info.setDominantBaseline(BaselineInfo.ALPHABETIC);

    final BaselineInfo cached = new BaselineInfo();
    cached.update(info);
    cachedBaselineInfo = cached;
    return info;
  }
View Full Code Here

  public BaselineInfo getBaselines(final int c, BaselineInfo info)
  {
    final boolean cacheable = (c >= 32 && c < 256);
    if (cacheable)
    {
      final BaselineInfo fromCache = cachedBaselines[c - 32];
      if (fromCache != null)
      {
        if (info == null)
        {
          info = new BaselineInfo();
        }
        info.update(fromCache);
        return info;
      }
    }

    cpBuffer[0] = (char) (c & 0xFFFF);
    final LineMetrics lm = font.getLineMetrics(cpBuffer, 0, 1, frc);
    final float[] bls = lm.getBaselineOffsets();
    final int idx = lm.getBaselineIndex();

    if (info == null)
    {
      info = new BaselineInfo();
    }

    // The ascent is local - but we need the global baseline, relative to the
    // MaxAscent.
    final long maxAscent = getMaxAscent();
    final long ascent = StrictGeomUtility.toInternalValue(lm.getAscent());
    final long delta = maxAscent - ascent;
    info.setBaseline(BaselineInfo.MATHEMATICAL, delta + maxAscent - getXHeight());
    info.setBaseline(BaselineInfo.IDEOGRAPHIC, getMaxHeight());
    info.setBaseline(BaselineInfo.MIDDLE, maxAscent / 2);

    final long base = delta + ascent;

    switch (idx)
    {
      case Font.CENTER_BASELINE:
      {
        info.setBaseline(BaselineInfo.CENTRAL, base);
        info.setBaseline(BaselineInfo.ALPHABETIC, base + StrictGeomUtility.toInternalValue(bls[Font.ROMAN_BASELINE]));
        info.setBaseline(BaselineInfo.HANGING, base + StrictGeomUtility.toInternalValue(bls[Font.HANGING_BASELINE]));
        info.setDominantBaseline(BaselineInfo.CENTRAL);
        break;
      }
      case Font.HANGING_BASELINE:
      {
        info.setBaseline(BaselineInfo.CENTRAL, base + StrictGeomUtility.toInternalValue(bls[Font.CENTER_BASELINE]));
        info.setBaseline(BaselineInfo.ALPHABETIC, base + StrictGeomUtility.toInternalValue(bls[Font.ROMAN_BASELINE]));
        info.setBaseline(BaselineInfo.HANGING, base);
        info.setDominantBaseline(BaselineInfo.HANGING);
        break;
      }
      default: // ROMAN Base-line
      {
        info.setBaseline(BaselineInfo.ALPHABETIC, base);
        info.setBaseline(BaselineInfo.CENTRAL, base + StrictGeomUtility.toInternalValue(bls[Font.CENTER_BASELINE]));
        info.setBaseline(BaselineInfo.HANGING, base + StrictGeomUtility.toInternalValue(bls[Font.HANGING_BASELINE]));
        info.setDominantBaseline(BaselineInfo.ALPHABETIC);
        break;
      }
    }

    if (cacheable)
    {
      final BaselineInfo cached = new BaselineInfo();
      cached.update(info);
      cachedBaselines[c - 32] = cached;
    }

    return info;
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.fonts.registry.BaselineInfo

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.