當前位置: 首頁>>代碼示例>>Java>>正文


Java GlyphMetrics.getRSB方法代碼示例

本文整理匯總了Java中java.awt.font.GlyphMetrics.getRSB方法的典型用法代碼示例。如果您正苦於以下問題:Java GlyphMetrics.getRSB方法的具體用法?Java GlyphMetrics.getRSB怎麽用?Java GlyphMetrics.getRSB使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.font.GlyphMetrics的用法示例。


在下文中一共展示了GlyphMetrics.getRSB方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Glyph

import java.awt.font.GlyphMetrics; //導入方法依賴的package包/類
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);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:27,代碼來源:Glyph.java

示例2: Glyph

import java.awt.font.GlyphMetrics; //導入方法依賴的package包/類
/**
 * 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);
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:36,代碼來源:Glyph.java

示例3: Glyph

import java.awt.font.GlyphMetrics; //導入方法依賴的package包/類
/**
 * 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, @Nonnull Rectangle bounds, @Nonnull GlyphVector vector, int index, @Nonnull 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);
}
 
開發者ID:FOShameDotOrg,項目名稱:fuzzy-octo-shame,代碼行數:36,代碼來源:Glyph.java


注:本文中的java.awt.font.GlyphMetrics.getRSB方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。