java.awt.font.GlyphMetrics Java Examples

The following examples show how to use java.awt.font.GlyphMetrics. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StandardGlyphVector.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #2
Source File: StandardGlyphVector.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #3
Source File: StandardGlyphVector.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #4
Source File: StandardGlyphVector.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #5
Source File: StandardGlyphVector.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #6
Source File: StandardGlyphVector.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #7
Source File: StandardGlyphVector.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #8
Source File: StandardGlyphVector.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #9
Source File: StandardGlyphVector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #10
Source File: StandardGlyphVector.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #11
Source File: StandardGlyphVector.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #12
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
private static GlyphVector getWrappedGlyphVector(String str, double width, Font font, FontRenderContext frc) {
  Point2D gmPos = new Point2D.Float();
  GlyphVector gv = font.createGlyphVector(frc, str);
  float lineHeight = (float) gv.getLogicalBounds().getHeight();
  float pos = 0f;
  int lineCount = 0;
  GlyphMetrics gm;
  for (int i = 0; i < gv.getNumGlyphs(); i++) {
    gm = gv.getGlyphMetrics(i);
    float advance = gm.getAdvance();
    if (pos < width && width <= pos + advance) {
      lineCount++;
      pos = 0f;
    }
    gmPos.setLocation(pos, lineHeight * lineCount);
    gv.setGlyphPosition(i, gmPos);
    pos += advance;
  }
  return gv;
}
 
Example #13
Source File: StandardGlyphVector.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #14
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
private static GlyphVector getWrappedGlyphVector(String str, double width, Font font, FontRenderContext frc) {
  Point2D gmPos = new Point2D.Float();
  GlyphVector gv = font.createGlyphVector(frc, str);
  float lineHeight = (float) gv.getLogicalBounds().getHeight();
  float pos = 0f;
  int lineCount = 0;
  GlyphMetrics gm;
  for (int i = 0; i < gv.getNumGlyphs(); i++) {
    gm = gv.getGlyphMetrics(i);
    float advance = gm.getAdvance();
    if (pos < width && width <= pos + advance) {
      lineCount++;
      pos = 0f;
    }
    gmPos.setLocation(pos, lineHeight * lineCount);
    gv.setGlyphPosition(i, gmPos);
    pos += advance;
  }
  return gv;
}
 
Example #15
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
private static GlyphVector makeJustifiedGlyphVector(GlyphVector gv, int width) {
  Rectangle2D r = gv.getVisualBounds();
  float jw = (float) width;
  float vw = (float) r.getWidth();
  if (jw > vw) {
    int num = gv.getNumGlyphs();
    float xx = (jw - vw) / (num - 1f);
    float pos = num == 1 ? (jw - vw) * .5f : 0f;
    Point2D gmPos = new Point2D.Float();
    for (int i = 0; i < num; i++) {
      GlyphMetrics gm = gv.getGlyphMetrics(i);
      gmPos.setLocation(pos, 0f);
      gv.setGlyphPosition(i, gmPos);
      pos += gm.getAdvance() + xx;
    }
  }
  return gv;
}
 
Example #16
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
protected MarqueePanel() {
  super();
  addHierarchyListener(e -> {
    if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0 && !e.getComponent().isDisplayable()) {
      animator.stop();
    }
  });

  String text = "abcdefghijklmnopqrstuvwxyz";
  Font font = new Font(Font.SERIF, Font.PLAIN, 100);
  FontRenderContext frc = new FontRenderContext(null, true, true);

  gv = font.createGlyphVector(frc, text);
  lm = font.getLineMetrics(text, frc);

  GlyphMetrics xgm = gv.getGlyphMetrics(23);
  corpusSize = (float) xgm.getBounds2D().getHeight();
  animator.start();
}
 
Example #17
Source File: StandardGlyphVector.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #18
Source File: StandardGlyphVector.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public GlyphMetrics getGlyphMetrics(int ix) {
    if (ix < 0 || ix >= glyphs.length) {
        throw new IndexOutOfBoundsException("ix = " + ix);
    }

    Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D();
    Point2D pt = getGlyphPosition(ix);
    vb.setRect(vb.getMinX() - pt.getX(),
               vb.getMinY() - pt.getY(),
               vb.getWidth(),
               vb.getHeight());
    Point2D.Float adv =
        getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]);
    GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y,
                                       vb,
                                       GlyphMetrics.STANDARD);
    return gm;
}
 
Example #19
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
private static GlyphVector getWrappedGlyphVector(String str, double width, Font font, FontRenderContext frc) {
  Point2D gmPos = new Point2D.Float();
  GlyphVector gv = font.createGlyphVector(frc, str);
  float lineHeight = (float) gv.getLogicalBounds().getHeight();
  float pos = 0f;
  int lineCount = 0;
  GlyphMetrics gm;

  for (int i = 0; i < gv.getNumGlyphs(); i++) {
    // TEST: gv.setGlyphTransform(i, at);
    gm = gv.getGlyphMetrics(i);
    float advance = gm.getAdvance();
    if (pos < width && width <= pos + advance) {
      lineCount++;
      pos = 0f;
    }
    gmPos.setLocation(pos, lineHeight * lineCount);
    gv.setGlyphPosition(i, gmPos);
    pos += advance;
  }
  return gv;
}
 
Example #20
Source File: BMFontUtil.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private int[] getGlyphMetrics (Font font, int codePoint) {
	// xOffset and xAdvance will be incorrect for unicode characters such as combining marks or non-spacing characters
	// (eg Pnujabi's "\u0A1C\u0A47") that require the context of surrounding glyphs to determine spacing, but thisis the
	// best we can do with the BMFont format.
	char[] chars = Character.toChars(codePoint);
	GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT);
	GlyphMetrics metrics = vector.getGlyphMetrics(0);
	int xOffset = vector.getGlyphPixelBounds(0, null, 0, 0).x - unicodeFont.getPaddingLeft();
	int xAdvance = (int)(metrics.getAdvanceX() + unicodeFont.getPaddingAdvanceX() + unicodeFont.getPaddingLeft() + unicodeFont
		.getPaddingRight());
	return new int[] {xOffset, xAdvance};
}
 
Example #21
Source File: Glyph.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Create a new glyph
 * 
 * @param codePoint The code point in which this glyph can be found
 * @param bounds The bounds that this glrph can fill
 * @param vector The vector this glyph is part of
 * @param index The index of this glyph within the vector
 * @param unicodeFont The font this glyph forms part of
 */
public Glyph(int codePoint, Rectangle bounds, GlyphVector vector, int index, UnicodeFont unicodeFont) {
	this.codePoint = codePoint;

	GlyphMetrics metrics = vector.getGlyphMetrics(index);
	int lsb = (int)metrics.getLSB();
	if (lsb > 0) lsb = 0;
	int rsb = (int)metrics.getRSB();
	if (rsb > 0) rsb = 0;

	int glyphWidth = bounds.width - lsb - rsb;
	int glyphHeight = bounds.height;
	if (glyphWidth > 0 && glyphHeight > 0) {
		int padTop = unicodeFont.getPaddingTop();
		int padRight = unicodeFont.getPaddingRight();
		int padBottom = unicodeFont.getPaddingBottom();
		int padLeft = unicodeFont.getPaddingLeft();
		int glyphSpacing = 1; // Needed to prevent filtering problems.
		width = (short)(glyphWidth + padLeft + padRight + glyphSpacing);
		height = (short)(glyphHeight + padTop + padBottom + glyphSpacing);
		yOffset = (short)(unicodeFont.getAscent() + bounds.y - padTop);
	}

	shape = vector.getGlyphOutline(index, -bounds.x + unicodeFont.getPaddingLeft(), -bounds.y + unicodeFont.getPaddingTop());

	isMissing = !unicodeFont.getFont().canDisplay((char)codePoint);
}
 
Example #22
Source File: TextMeasureTests.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    GVContext gvctx = (GVContext)ctx;
    GlyphVector gv = gvctx.gv;
    GlyphMetrics gm;
    do {
        for (int i = 0, e = gv.getNumGlyphs(); i < e; ++i) {
            gm = gv.getGlyphMetrics(i);
        }
    } while (--numReps >= 0);
}
 
Example #23
Source File: GlyphMetricsSerializationWrapper.java    From pumpernickel with MIT License 5 votes vote down vote up
@Override
public SerializationWrapper<?> filter(Object object) {
	if (object instanceof GlyphMetrics) {
		GlyphMetrics gm = (GlyphMetrics) object;
		return new GlyphMetricsSerializationWrapper(gm);
	}
	return null;
}
 
Example #24
Source File: BMFontUtil.java    From gdx-skineditor with Apache License 2.0 5 votes vote down vote up
private int[] getGlyphMetrics (Font font, int codePoint) {
	// xOffset and xAdvance will be incorrect for unicode characters such as combining marks or non-spacing characters
	// (eg Pnujabi's "\u0A1C\u0A47") that require the context of surrounding glyphs to determine spacing, but thisis the
	// best we can do with the BMFont format.
	char[] chars = Character.toChars(codePoint);
	GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT);
	GlyphMetrics metrics = vector.getGlyphMetrics(0);
	int xOffset = vector.getGlyphPixelBounds(0, GlyphPage.renderContext, 0.5f, 0).x - unicodeFont.getPaddingLeft();
	int xAdvance = (int)(metrics.getAdvanceX() + unicodeFont.getPaddingAdvanceX() + unicodeFont.getPaddingLeft() + unicodeFont
		.getPaddingRight());
	return new int[] {xOffset, xAdvance};
}
 
Example #25
Source File: GlyphMetricsSerializationWrapper.java    From pumpernickel with MIT License 5 votes vote down vote up
public GlyphMetricsSerializationWrapper(GlyphMetrics gm) {
	// when in doubt, we're just going to guess that this is true. I don't
	// see a clear way to identify this property without reflection?
	boolean horizontal = gm.getAdvanceX() == gm.getAdvanceY() ? true
			: gm.getAdvanceX() == gm.getAdvance();
	map.put(KEY_HORIZONTAL, horizontal);
	map.put(KEY_ADVANCE_X, gm.getAdvanceX());
	map.put(KEY_ADVANCE_Y, gm.getAdvanceY());
	map.put(KEY_BOUNDS,
			new Rectangle2DSerializationWrapper(gm.getBounds2D()));
	map.put(KEY_GLYPH_TYPE, (byte) gm.getType());
}
 
Example #26
Source File: GlyphMetricsSerializationWrapper.java    From pumpernickel with MIT License 5 votes vote down vote up
@Override
public GlyphMetrics create() {
	boolean horizontal = (Boolean) map.get(KEY_HORIZONTAL);
	float advanceX = ((Number) map.get(KEY_ADVANCE_X)).floatValue();
	float advanceY = ((Number) map.get(KEY_ADVANCE_Y)).floatValue();
	Rectangle2DSerializationWrapper boundsWrapper = (Rectangle2DSerializationWrapper) map
			.get(KEY_BOUNDS);
	Rectangle2D boundsRect = boundsWrapper.create();
	byte glyphType = ((Number) map.get(KEY_GLYPH_TYPE)).byteValue();

	return new GlyphMetrics(horizontal, advanceX, advanceY, boundsRect,
			glyphType);
}
 
Example #27
Source File: TextMeasureTests.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    GVContext gvctx = (GVContext)ctx;
    GlyphVector gv = gvctx.gv;
    GlyphMetrics gm;
    do {
        for (int i = 0, e = gv.getNumGlyphs(); i < e; ++i) {
            gm = gv.getGlyphMetrics(i);
        }
    } while (--numReps >= 0);
}
 
Example #28
Source File: TextMeasureTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    GVContext gvctx = (GVContext)ctx;
    GlyphVector gv = gvctx.gv;
    GlyphMetrics gm;
    do {
        for (int i = 0, e = gv.getNumGlyphs(); i < e; ++i) {
            gm = gv.getGlyphMetrics(i);
        }
    } while (--numReps >= 0);
}
 
Example #29
Source File: TextMeasureTests.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    GVContext gvctx = (GVContext)ctx;
    GlyphVector gv = gvctx.gv;
    GlyphMetrics gm;
    do {
        for (int i = 0, e = gv.getNumGlyphs(); i < e; ++i) {
            gm = gv.getGlyphMetrics(i);
        }
    } while (--numReps >= 0);
}
 
Example #30
Source File: TextMeasureTests.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    GVContext gvctx = (GVContext)ctx;
    GlyphVector gv = gvctx.gv;
    GlyphMetrics gm;
    do {
        for (int i = 0, e = gv.getNumGlyphs(); i < e; ++i) {
            gm = gv.getGlyphMetrics(i);
        }
    } while (--numReps >= 0);
}