/** * Gets the width of a <CODE>char</CODE> in points. * @param char1 the <CODE>char</CODE> to get the width of * @param fontSize the font size * @return the width in points */ public float getWidthPoint(int char1, float fontSize) { return getWidth(char1) * 0.001f * fontSize; }
/** * Gets the width of a <CODE>char</CODE> in points. * * @param char1 * the <CODE>char</CODE> to get the width of * @param fontSize * the font size * @return the width in points */ public float getWidthPoint(int char1, float fontSize) { return getWidth(char1) * 0.001f * fontSize; }
/** * Gets the width of a <CODE>char</CODE> in points. * @param char1 the <CODE>char</CODE> to get the width of * @param fontSize the font size * @return the width in points */ public float getWidthPoint(int char1, float fontSize) { return getWidth(char1) * 0.001f * fontSize; }
/** * Gets the width of a <CODE>String</CODE> in points. * @param text the <CODE>String</CODE> to get the width of * @param fontSize the font size * @return the width in points */ public float getWidthPoint(String text, float fontSize) { return getWidth(text) * 0.001f * fontSize; }
/** * Gets the width of a <CODE>String</CODE> in points. * * @param text * the <CODE>String</CODE> to get the width of * @param fontSize * the font size * @return the width in points */ public float getWidthPoint(String text, float fontSize) { return getWidth(text) * 0.001f * fontSize; }
/** * Gets the width of a <CODE>String</CODE> in points. * @param text the <CODE>String</CODE> to get the width of * @param fontSize the font size * @return the width in points */ public float getWidthPoint(String text, float fontSize) { return getWidth(text) * 0.001f * fontSize; }
public int getWidth(String text) { if (cjkMirror != null) { return cjkMirror.getWidth(text); } else if (isType0) { char[] chars = text.toCharArray(); int total = 0; for (char aChar : chars) { int[] ws = metrics.get(aChar); if (ws != null) { total += ws[1]; } } return total; } else { return super.getWidth(text); } }
/** * Gets the width of a <CODE>char</CODE> in normalized 1000 units. * * @param char1 the unicode <CODE>char</CODE> to get the width of * @return the width in normalized 1000 units */ public int getWidth(int char1) { if (cjkMirror != null) { return cjkMirror.getWidth(char1); } else if (isType0) { int[] ws = metrics.get(char1); if (ws != null) { return ws[1]; } else { return 0; } } else { return super.getWidth(char1); } }
/** * Gets the width of a <CODE>char</CODE> in normalized 1000 units. * @param char1 the unicode <CODE>char</CODE> to get the width of * @return the width in normalized 1000 units */ public int getWidth(int char1) { if (cjkMirror != null) return cjkMirror.getWidth(char1); else if (isType0) { int[] ws = (int[])metrics.get(new Integer(char1)); if (ws != null) return ws[1]; else return 0; } else return super.getWidth(char1); }
public int getWidth(String text) { if (cjkMirror != null) return cjkMirror.getWidth(text); else if (isType0) { char[] chars = text.toCharArray(); int len = chars.length; int total = 0; for (int k = 0; k < len; ++k) { int[] ws = (int[])metrics.get(new Integer(chars[k])); if (ws != null) total += ws[1]; } return total; } else return super.getWidth(text); }
/** * Gets the width of a <CODE>char</CODE> in normalized 1000 units. * @param char1 the unicode <CODE>char</CODE> to get the width of * @return the width in normalized 1000 units */ public int getWidth(int char1) { if (cjkMirror != null) return cjkMirror.getWidth(char1); else if (isType0) { int[] ws = (int[])metrics.get(new Integer(char1)); if (ws != null) return ws[1]; else return 0; } else return super.getWidth(char1); }
public int getWidth(String text) { if (cjkMirror != null) return cjkMirror.getWidth(text); else if (isType0) { char[] chars = text.toCharArray(); int len = chars.length; int total = 0; for (int k = 0; k < len; ++k) { int[] ws = (int[])metrics.get(new Integer(chars[k])); if (ws != null) total += ws[1]; } return total; } else return super.getWidth(text); }
final char char1 = cpBuffer[ 0 ]; if ( char1 < 128 || ( char1 >= 160 && char1 <= 255 ) ) { final long width = (long) ( baseFont.getWidth( char1 ) * size ); cachedWidths[ index ] = width; return width; final long width = (long) ( baseFont.getWidth( new String( cpBuffer, 0, retval ) ) * size ); cachedWidths[ index ] = width; return width; final char char1 = cpBuffer[ 0 ]; if ( char1 < 128 || ( char1 >= 160 && char1 <= 255 ) ) { return (long) ( baseFont.getWidth( char1 ) * size ); return (long) ( baseFont.getWidth( new String( cpBuffer, 0, retval ) ) * size );
/** * Gets the width of a <CODE>String</CODE> in points taking kerning * into account. * @param text the <CODE>String</CODE> to get the width of * @param fontSize the font size * @return the width in points */ public float getWidthPointKerned(String text, float fontSize) { float size = getWidth(text) * 0.001f * fontSize; if (!hasKernPairs()) return size; int len = text.length() - 1; int kern = 0; char c[] = text.toCharArray(); for (int k = 0; k < len; ++k) { kern += getKerning(c[k], c[k + 1]); } return size + kern * 0.001f * fontSize; }
@Override public int stringWidth(String text) { return (int)(font.getBaseFont().getWidth(text)*font.getSize()/100); }
/** * Gets the width of a <CODE>String</CODE> in points taking kerning * into account. * @param text the <CODE>String</CODE> to get the width of * @param fontSize the font size * @return the width in points */ public float getWidthPointKerned(String text, float fontSize) { float size = getWidth(text) * 0.001f * fontSize; if (!hasKernPairs()) return size; int len = text.length() - 1; int kern = 0; char c[] = text.toCharArray(); for (int k = 0; k < len; ++k) { kern += getKerning(c[k], c[k + 1]); } return size + kern * 0.001f * fontSize; }
/** * Gets the width of a <CODE>String</CODE> in points taking kerning into * account. * * @param text * the <CODE>String</CODE> to get the width of * @param fontSize * the font size * @return the width in points */ public float getWidthPointKerned(String text, float fontSize) { float size = getWidth(text) * 0.001f * fontSize; if (!hasKernPairs()) { return size; } int len = text.length() - 1; int kern = 0; char[] c = text.toCharArray(); for (int k = 0; k < len; ++k) { kern += getKerning(c[k], c[k + 1]); } return size + kern * 0.001f * fontSize; }