当前位置: 首页>>代码示例>>Java>>正文


Java GlyphVector.getGlyphPixelBounds方法代码示例

本文整理汇总了Java中java.awt.font.GlyphVector.getGlyphPixelBounds方法的典型用法代码示例。如果您正苦于以下问题:Java GlyphVector.getGlyphPixelBounds方法的具体用法?Java GlyphVector.getGlyphPixelBounds怎么用?Java GlyphVector.getGlyphPixelBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.font.GlyphVector的用法示例。


在下文中一共展示了GlyphVector.getGlyphPixelBounds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGlyphMetrics

import java.awt.font.GlyphVector; //导入方法依赖的package包/类
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};
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:13,代码来源:BMFontUtil.java

示例2: runTest

import java.awt.font.GlyphVector; //导入方法依赖的package包/类
public void runTest(Object ctx, int numReps) {
    GVContext gvctx = (GVContext)ctx;
    GlyphVector gv = gvctx.gv;
    Rectangle2D r;
    do {
        for (int i = 0, e = gv.getNumGlyphs(); i < e; ++i) {
            r = gv.getGlyphPixelBounds(i, null, 0, 0); // !!! add opt to provide different frc?
        }
    } while (--numReps >= 0);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:TextMeasureTests.java

示例3: getGlyphBounds

import java.awt.font.GlyphVector; //导入方法依赖的package包/类
/**
 * Returns the bounds of the specified glyph.\
 * 
 * @param vector The vector the glyph is part of
 * @param index The index of the glyph within the vector
 * @param codePoint The code point associated with the glyph
 */
private Rectangle getGlyphBounds (GlyphVector vector, int index, int codePoint) {
	Rectangle bounds = vector.getGlyphPixelBounds(index, GlyphPage.renderContext, 0, 0);
	if (codePoint == ' ') bounds.width = spaceWidth;
	return bounds;
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:13,代码来源:UnicodeFont.java


注:本文中的java.awt.font.GlyphVector.getGlyphPixelBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。