private Rectangle getGlyphBounds (GlyphVector vector, int index, int codePoint) { Rectangle bounds; bounds = vector.getGlyphPixelBounds(index, GlyphPage.renderContext, 0, 0); if (renderType == RenderType.Native) { if (bounds.width == 0 || bounds.height == 0) bounds = new Rectangle(); else bounds = metrics.getStringBounds("" + (char)codePoint, GlyphPage.scratchGraphics).getBounds(); } if (codePoint == ' ') bounds.width = spaceWidth; return bounds; }
private Rectangle getGlyphBounds (GlyphVector vector, int index, int codePoint) { Rectangle bounds; bounds = vector.getGlyphPixelBounds(index, GlyphPage.renderContext, 0, 0); if (renderType == RenderType.Native) { if (bounds.width == 0 || bounds.height == 0) bounds = new Rectangle(); else bounds = metrics.getStringBounds("" + (char)codePoint, GlyphPage.scratchGraphics).getBounds(); } if (codePoint == ' ') bounds.width = spaceWidth; return bounds; }
if (numberHeight == 0) { numberHeight = getFont().layoutGlyphVector(g.getFontRenderContext(), new char[] {'0'}, 0, 1, Font.LAYOUT_LEFT_TO_RIGHT) .getGlyphPixelBounds(0, g.getFontRenderContext(), 0, 0).height;
/** @return May be null. */ private Glyph getGlyph (char c) { char[] chars = {c}; GlyphVector vector = unicodeFont.getFont().layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); Rectangle bounds = vector.getGlyphPixelBounds(0, GlyphPage.renderContext, 0, 0); return unicodeFont.getGlyph(vector.getGlyphCode(0), c, bounds, vector, 0); }
/** @return May be null. */ private Glyph getGlyph (char c) { char[] chars = {c}; GlyphVector vector = unicodeFont.getFont().layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); Rectangle bounds = vector.getGlyphPixelBounds(0, GlyphPage.renderContext, 0, 0); return unicodeFont.getGlyph(vector.getGlyphCode(0), c, bounds, vector, 0); }
if (numberHeight == 0) { numberHeight = getFont().layoutGlyphVector(g.getFontRenderContext(), new char[] {'0'}, 0, 1, Font.LAYOUT_LEFT_TO_RIGHT) .getGlyphPixelBounds(0, g.getFontRenderContext(), 0, 0).height;
Font.LAYOUT_LEFT_TO_RIGHT); GlyphMetrics charMetrics = charVector.getGlyphMetrics(0); xOffset = charVector.getGlyphPixelBounds(0, GlyphPage.renderContext, 0, 0).x - unicodeFont.getPaddingLeft(); xAdvance = (int)(metrics.getAdvanceX() + unicodeFont.getPaddingAdvanceX() + unicodeFont.getPaddingLeft() + unicodeFont.getPaddingRight());
Font.LAYOUT_LEFT_TO_RIGHT); GlyphMetrics charMetrics = charVector.getGlyphMetrics(0); xOffset = charVector.getGlyphPixelBounds(0, GlyphPage.renderContext, 0, 0).x - unicodeFont.getPaddingLeft(); xAdvance = (int)(metrics.getAdvanceX() + unicodeFont.getPaddingAdvanceX() + unicodeFont.getPaddingLeft() + unicodeFont.getPaddingRight());
/** * 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; }
private Rectangle getGlyphBounds (GlyphVector vector, int index, int codePoint) { Rectangle bounds; bounds = vector.getGlyphPixelBounds(index, GlyphPage.renderContext, 0, 0); if (renderType == RenderType.Native) { if (bounds.width == 0 || bounds.height == 0) bounds = new Rectangle(); else bounds = metrics.getStringBounds("" + (char)codePoint, GlyphPage.scratchGraphics).getBounds(); } if (codePoint == ' ') bounds.width = spaceWidth; return bounds; }
public Rectangle getGlyphBounds(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector, int index, float x, float y) { Object prevHint = null; Graphics2D graphics = ((Java2DOutputDevice)outputDevice).getGraphics(); Font awtFont = ((AWTFSFont)font).getAWTFont(); if (awtFont.getSize() > threshold ) { prevHint = graphics.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING); graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, antiAliasRenderingHint ); } GlyphVector vector = ((AWTFSGlyphVector)fsGlyphVector).getGlyphVector(); Rectangle result = vector.getGlyphPixelBounds(index, graphics.getFontRenderContext(), x, y); if (awtFont.getSize() > threshold ) { graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, prevHint ); } return result; }
public Rectangle getGlyphBounds(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector, int index, float x, float y) { Object prevHint = null; Graphics2D graphics = ((Java2DOutputDevice)outputDevice).getGraphics(); Font awtFont = ((AWTFSFont)font).getAWTFont(); if (awtFont.getSize() > threshold ) { prevHint = graphics.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING); graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, antiAliasRenderingHint ); } GlyphVector vector = ((AWTFSGlyphVector)fsGlyphVector).getGlyphVector(); Rectangle result = vector.getGlyphPixelBounds(index, graphics.getFontRenderContext(), x, y); if (awtFont.getSize() > threshold ) { graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, prevHint ); } return result; }
public Rectangle getGlyphBounds(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector, int index, float x, float y) { Object prevHint = null; Graphics2D graphics = ((Java2DOutputDevice)outputDevice).getGraphics(); Font awtFont = ((AWTFSFont)font).getAWTFont(); if (awtFont.getSize() > threshold ) { prevHint = graphics.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING); graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, antiAliasRenderingHint ); } GlyphVector vector = ((AWTFSGlyphVector)fsGlyphVector).getGlyphVector(); Rectangle result = vector.getGlyphPixelBounds(index, graphics.getFontRenderContext(), x, y); if (awtFont.getSize() > threshold ) { graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, prevHint ); } return result; }
/** * This method gets glyph bounds for purposes of selecting text. WE are not too worried about selecting text * at this point so we just use the first font available. */ @Override public Rectangle getGlyphBounds(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector, int index, float x, float y) { Object aaHint = null; Object fracHint = null; Graphics2D graphics = ((Java2DOutputDevice)outputDevice).getGraphics(); Font awtFont = ((AWTFSFont)font).getAWTFonts().get(0); if (awtFont.getSize() > threshold ) { aaHint = graphics.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING); graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, antiAliasRenderingHint ); } fracHint = graphics.getRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS); graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, fractionalFontMetricsHint); GlyphVector vector = ((AWTFSGlyphVector)fsGlyphVector).getGlyphVector(); Rectangle result = vector.getGlyphPixelBounds(index, graphics.getFontRenderContext(), x, y); if (awtFont.getSize() > threshold ) { graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, aaHint ); } graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, fracHint); return result; }
if (numberHeight == 0) { numberHeight = getFont().layoutGlyphVector(g.getFontRenderContext(), new char[] {'0'}, 0, 1, Font.LAYOUT_LEFT_TO_RIGHT) .getGlyphPixelBounds(0, g.getFontRenderContext(), 0, 0).height;
/** @return May be null. */ private Glyph getGlyph (char c) { char[] chars = {c}; GlyphVector vector = unicodeFont.getFont().layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); Rectangle bounds = vector.getGlyphPixelBounds(0, GlyphPage.renderContext, 0, 0); return unicodeFont.getGlyph(vector.getGlyphCode(0), c, bounds, vector, 0); }
pixelBounds = currGlyph.getGlyphPixelBounds(0, frc, 0, 0);
Font.LAYOUT_LEFT_TO_RIGHT); GlyphMetrics charMetrics = charVector.getGlyphMetrics(0); xOffset = charVector.getGlyphPixelBounds(0, GlyphPage.renderContext, 0, 0).x - unicodeFont.getPaddingLeft(); xAdvance = (int)(metrics.getAdvanceX() + unicodeFont.getPaddingAdvanceX() + unicodeFont.getPaddingLeft() + unicodeFont.getPaddingRight());