本文整理匯總了Java中java.awt.font.GlyphMetrics.STANDARD屬性的典型用法代碼示例。如果您正苦於以下問題:Java GlyphMetrics.STANDARD屬性的具體用法?Java GlyphMetrics.STANDARD怎麽用?Java GlyphMetrics.STANDARD使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.font.GlyphMetrics
的用法示例。
在下文中一共展示了GlyphMetrics.STANDARD屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getGlyphMetrics
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;
}
示例2: getGlyphMetrics
@Override
public GlyphMetrics getGlyphMetrics(){
if (glMetrics == null) {
float[] metrics = getGlyphMetrics(glyphPointer);
this.glMetrics = new GlyphMetrics(
true,
Math.round(metrics[0]),//metrics[0],
Math.round(metrics[1]),//metrics[1],
//new Rectangle2D.Double(initOutline().getBounds2D().getMinX(), initOutline().getBounds2D().getMinY(), initOutline().getBounds2D().getMaxX() + 5, initOutline().getBounds2D().getMaxY()),
initOutline().getBounds2D(),//new Rectangle2D.Float(metrics[2], -metrics[5]-1,metrics[4]- metrics[2] + 1, metrics[5] - metrics[3] + 1),
GlyphMetrics.STANDARD);
}
return glMetrics;
}
示例3: getGlyphMetrics
/**
* Returns the metrics of the glyph at the specified index into this
* GVTGlyphVector.
*/
public GVTGlyphMetrics getGlyphMetrics(int glyphIndex) {
if (glyphMetrics[glyphIndex] != null)
return glyphMetrics[glyphIndex];
// -- start glyph cache code --
Point2D glyphPos = defaultGlyphPositions[glyphIndex];
char c = ci.setIndex(ci.getBeginIndex()+glyphIndex);
ci.setIndex(ci.getBeginIndex());
AWTGlyphGeometryCache.Value v = AWTGVTFont.getGlyphGeometry
(gvtFont, c, awtGlyphVector, glyphIndex, glyphPos);
Rectangle2D gmB = v.getBounds2D();
// -- end glyph cache code --
Rectangle2D bounds = new Rectangle2D.Double
(gmB.getX() * scaleFactor, gmB.getY() * scaleFactor,
gmB.getWidth() * scaleFactor, gmB.getHeight() * scaleFactor);
// defaultGlyphPositions has one more entry than glyphs
// the last entry stores the total advance for the
// glyphVector.
float adv = (float)(defaultGlyphPositions[glyphIndex+1].getX()-
defaultGlyphPositions[glyphIndex] .getX());
glyphMetrics[glyphIndex] = new GVTGlyphMetrics
((float)(adv*scaleFactor), (ascent+descent),
bounds, GlyphMetrics.STANDARD);
return glyphMetrics[glyphIndex];
}
示例4: getGlyphMetrics
/**
* Returns the metrics of the glyph at the specified index into this
* GVTGlyphVector.
*/
public GVTGlyphMetrics getGlyphMetrics(int glyphIndex) {
if (glyphMetrics[glyphIndex] != null)
return glyphMetrics[glyphIndex];
// -- start glyph cache code --
Point2D glyphPos = defaultGlyphPositions[glyphIndex];
char c = ci.setIndex(ci.getBeginIndex()+glyphIndex);
ci.setIndex(ci.getBeginIndex());
AWTGlyphGeometryCache.Value v = AWTGVTFont.getGlyphGeometry
(gvtFont, c, awtGlyphVector, glyphIndex, glyphPos);
Rectangle2D gmB = v.getBounds2D();
// -- end glyph cache code --
Rectangle2D bounds = new Rectangle2D.Double
(gmB.getX() * scaleFactor, gmB.getY() * scaleFactor,
gmB.getWidth() * scaleFactor, gmB.getHeight() * scaleFactor);
// defaultGlyphPositions has one more entry than glyphs
// the last entry stores the total advance for the
// glyphVector.
float adv = (float)(defaultGlyphPositions[glyphIndex+1].getX()-
defaultGlyphPositions[glyphIndex] .getX());
glyphMetrics[glyphIndex] = new GVTGlyphMetrics
(adv*scaleFactor, (ascent+descent),
bounds, GlyphMetrics.STANDARD);
return glyphMetrics[glyphIndex];
}