public int getWidth (String text) { if (text == null) throw new IllegalArgumentException("text cannot be null."); if (text.length() == 0) return 0; char[] chars = text.toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); int width = 0; int extraX = 0; boolean startNewLine = false; for (int glyphIndex = 0, n = vector.getNumGlyphs(); glyphIndex < n; glyphIndex++) { int charIndex = vector.getGlyphCharIndex(glyphIndex); int codePoint = text.codePointAt(charIndex); Rectangle bounds = getGlyphBounds(vector, glyphIndex, codePoint); if (startNewLine && codePoint != '\n') extraX = -bounds.x; if (glyphIndex > 0) extraX += paddingLeft + paddingRight + paddingAdvanceX; width = Math.max(width, bounds.x + extraX + bounds.width); if (codePoint == '\n') startNewLine = true; } return width; }
public int getWidth (String text) { if (text == null) throw new IllegalArgumentException("text cannot be null."); if (text.length() == 0) return 0; char[] chars = text.toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); int width = 0; int extraX = 0; boolean startNewLine = false; for (int glyphIndex = 0, n = vector.getNumGlyphs(); glyphIndex < n; glyphIndex++) { int charIndex = vector.getGlyphCharIndex(glyphIndex); int codePoint = text.codePointAt(charIndex); Rectangle bounds = getGlyphBounds(vector, glyphIndex, codePoint); if (startNewLine && codePoint != '\n') extraX = -bounds.x; if (glyphIndex > 0) extraX += paddingLeft + paddingRight + paddingAdvanceX; width = Math.max(width, bounds.x + extraX + bounds.width); if (codePoint == '\n') startNewLine = true; } return width; }
public int getHeight (String text) { if (text == null) throw new IllegalArgumentException("text cannot be null."); if (text.length() == 0) return 0; char[] chars = text.toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); int lines = 0, height = 0; for (int i = 0, n = vector.getNumGlyphs(); i < n; i++) { int charIndex = vector.getGlyphCharIndex(i); int codePoint = text.codePointAt(charIndex); if (codePoint == ' ') continue; Rectangle bounds = getGlyphBounds(vector, i, codePoint); height = Math.max(height, ascent + bounds.y + bounds.height); if (codePoint == '\n') { lines++; height = 0; } } return lines * getLineHeight() + height; }
public int getHeight (String text) { if (text == null) throw new IllegalArgumentException("text cannot be null."); if (text.length() == 0) return 0; char[] chars = text.toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); int lines = 0, height = 0; for (int i = 0, n = vector.getNumGlyphs(); i < n; i++) { int charIndex = vector.getGlyphCharIndex(i); int codePoint = text.codePointAt(charIndex); if (codePoint == ' ') continue; Rectangle bounds = getGlyphBounds(vector, i, codePoint); height = Math.max(height, ascent + bounds.y + bounds.height); if (codePoint == '\n') { lines++; height = 0; } } return lines * getLineHeight() + height; }
/** Queues the glyphs in the specified text to be loaded. Note that the glyphs are not actually loaded until * {@link #loadGlyphs()} is called. */ public void addGlyphs (String text) { if (text == null) throw new IllegalArgumentException("text cannot be null."); char[] chars = text.toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); for (int i = 0, n = vector.getNumGlyphs(); i < n; i++) { int codePoint = text.codePointAt(vector.getGlyphCharIndex(i)); Rectangle bounds = getGlyphBounds(vector, i, codePoint); getGlyph(vector.getGlyphCode(i), codePoint, bounds, vector, i); } }
/** Queues the glyphs in the specified text to be loaded. Note that the glyphs are not actually loaded until * {@link #loadGlyphs()} is called. */ public void addGlyphs (String text) { if (text == null) throw new IllegalArgumentException("text cannot be null."); char[] chars = text.toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); for (int i = 0, n = vector.getNumGlyphs(); i < n; i++) { int codePoint = text.codePointAt(vector.getGlyphCharIndex(i)); Rectangle bounds = getGlyphBounds(vector, i, codePoint); getGlyph(vector.getGlyphCode(i), codePoint, bounds, vector, i); } }
int offsetX = 0; for (int glyphIndex = 0, n = vector.getNumGlyphs(); glyphIndex < n; glyphIndex++) { int charIndex = vector.getGlyphCharIndex(glyphIndex); if (charIndex < startIndex) continue; if (charIndex > endIndex) break;
int offsetX = 0; for (int glyphIndex = 0, n = vector.getNumGlyphs(); glyphIndex < n; glyphIndex++) { int charIndex = vector.getGlyphCharIndex(glyphIndex); if (charIndex < startIndex) continue; if (charIndex > endIndex) break;
/** Return the character corresponding to this glyphVector index */ public char getChar(LineInfo.LineComponent component, GlyphVector glyphVector, int g) { return component.getText().charAt(glyphVector.getGlyphCharIndex(g)); }
public int getWidth (String text) { if (text == null) throw new IllegalArgumentException("text cannot be null."); if (text.length() == 0) return 0; char[] chars = text.toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); int width = 0; int extraX = 0; boolean startNewLine = false; for (int glyphIndex = 0, n = vector.getNumGlyphs(); glyphIndex < n; glyphIndex++) { int charIndex = vector.getGlyphCharIndex(glyphIndex); int codePoint = text.codePointAt(charIndex); Rectangle bounds = getGlyphBounds(vector, glyphIndex, codePoint); if (startNewLine && codePoint != '\n') extraX = -bounds.x; if (glyphIndex > 0) extraX += paddingLeft + paddingRight + paddingAdvanceX; width = Math.max(width, bounds.x + extraX + bounds.width); if (codePoint == '\n') startNewLine = true; } return width; }
/** * @see org.newdawn.slick.Font#getWidth(java.lang.String) */ public int getWidth (String text) { if (text == null) throw new IllegalArgumentException("text cannot be null."); if (text.length() == 0) return 0; if (displayListCaching) { DisplayList displayList = (DisplayList)displayLists.get(text); if (displayList != null) return displayList.width; } char[] chars = text.toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); int width = 0; int extraX = 0; boolean startNewLine = false; for (int glyphIndex = 0, n = vector.getNumGlyphs(); glyphIndex < n; glyphIndex++) { int charIndex = vector.getGlyphCharIndex(glyphIndex); int codePoint = text.codePointAt(charIndex); Rectangle bounds = getGlyphBounds(vector, glyphIndex, codePoint); if (startNewLine && codePoint != '\n') extraX = -bounds.x; if (glyphIndex > 0) extraX += paddingLeft + paddingRight + paddingAdvanceX; width = Math.max(width, bounds.x + extraX + bounds.width); if (codePoint == '\n') startNewLine = true; } return width; }
public int getHeight (String text) { if (text == null) throw new IllegalArgumentException("text cannot be null."); if (text.length() == 0) return 0; char[] chars = text.toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); int lines = 0, height = 0; for (int i = 0, n = vector.getNumGlyphs(); i < n; i++) { int charIndex = vector.getGlyphCharIndex(i); int codePoint = text.codePointAt(charIndex); if (codePoint == ' ') continue; Rectangle bounds = getGlyphBounds(vector, i, codePoint); height = Math.max(height, ascent + bounds.y + bounds.height); if (codePoint == '\n') { lines++; height = 0; } } return lines * getLineHeight() + height; }
/** Queues the glyphs in the specified text to be loaded. Note that the glyphs are not actually loaded until * {@link #loadGlyphs()} is called. */ public void addGlyphs (String text) { if (text == null) throw new IllegalArgumentException("text cannot be null."); char[] chars = text.toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); for (int i = 0, n = vector.getNumGlyphs(); i < n; i++) { int codePoint = text.codePointAt(vector.getGlyphCharIndex(i)); Rectangle bounds = getGlyphBounds(vector, i, codePoint); getGlyph(vector.getGlyphCode(i), codePoint, bounds, vector, i); } }
/** * @see org.newdawn.slick.Font#getHeight(java.lang.String) */ public int getHeight (String text) { if (text == null) throw new IllegalArgumentException("text cannot be null."); if (text.length() == 0) return 0; if (displayListCaching) { DisplayList displayList = (DisplayList)displayLists.get(text); if (displayList != null) return displayList.height; } char[] chars = text.toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); int lines = 0, height = 0; for (int i = 0, n = vector.getNumGlyphs(); i < n; i++) { int charIndex = vector.getGlyphCharIndex(i); int codePoint = text.codePointAt(charIndex); if (codePoint == ' ') continue; Rectangle bounds = getGlyphBounds(vector, i, codePoint); height = Math.max(height, ascent + bounds.y + bounds.height); if (codePoint == '\n') { lines++; height = 0; } } return lines * getLineHeight() + height; }
/** * Queues the glyphs in the specified text to be loaded. Note that the glyphs are not actually loaded until * {@link #loadGlyphs()} is called. * * @param text The text containing the glyphs to be added */ public void addGlyphs(String text) { if (text == null) throw new IllegalArgumentException("text cannot be null."); char[] chars = text.toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); for (int i = 0, n = vector.getNumGlyphs(); i < n; i++) { int codePoint = text.codePointAt(vector.getGlyphCharIndex(i)); Rectangle bounds = getGlyphBounds(vector, i, codePoint); getGlyph(vector.getGlyphCode(i), codePoint, bounds, vector, i); } }
Texture lastBind = null; for (int glyphIndex = 0, n = vector.getNumGlyphs(); glyphIndex < n; glyphIndex++) { int charIndex = vector.getGlyphCharIndex(glyphIndex); if (charIndex < startIndex) continue; if (charIndex > endIndex) break;
for (int i = 0; i < g.getNumGlyphs(); i++) final Polygon letterPoly = output[g.getGlyphCharIndex(i)];
for (int i = 0; i < g.getNumGlyphs(); i++) final Polygon letterPoly = output[g.getGlyphCharIndex(i)];
int offsetX = 0; for (int glyphIndex = 0, n = vector.getNumGlyphs(); glyphIndex < n; glyphIndex++) { int charIndex = vector.getGlyphCharIndex(glyphIndex); if (charIndex < startIndex) continue; if (charIndex > endIndex) break;