/** * Checks if a character exists in this font. * @param c the character to check * @return <CODE>true</CODE> if the character has a glyph, * <CODE>false</CODE> otherwise */ public boolean charExists(int c) { byte b[] = convertToBytes(c); return b.length > 0; }
/** * Checks if a character exists in this font. * * @param c * the character to check * @return <CODE>true</CODE> if the character has a glyph, * <CODE>false</CODE> otherwise */ public boolean charExists(int c) { byte[] b = convertToBytes(c); return b.length > 0; }
/** * Checks if a character exists in this font. * @param c the character to check * @return <CODE>true</CODE> if the character has a glyph, * <CODE>false</CODE> otherwise */ public boolean charExists(int c) { byte b[] = convertToBytes(c); return b.length > 0; }
/** * Sets the character advance. * @param c the character * @param advance the character advance normalized to 1000 units * @return <CODE>true</CODE> if the advance was set, * <CODE>false</CODE> otherwise */ public boolean setCharAdvance(int c, int advance) { byte b[] = convertToBytes(c); if (b.length == 0) return false; widths[0xff & b[0]] = advance; return true; }
/** * Gets the smallest box enclosing the character contours. It will return * <CODE>null</CODE> if the font has not the information or the character has no * contours, as in the case of the space, for example. Characters with no contours may * also return [0,0,0,0]. * @param c the character to get the contour bounding box from * @return an array of four floats with the bounding box in the format [llx,lly,urx,ury] or * <code>null</code> */ public int[] getCharBBox(int c) { byte b[] = convertToBytes(c); if (b.length == 0) return null; else return charBBoxes[b[0] & 0xff]; }
/** * Sets the character advance. * @param c the character * @param advance the character advance normalized to 1000 units * @return <CODE>true</CODE> if the advance was set, * <CODE>false</CODE> otherwise */ public boolean setCharAdvance(int c, int advance) { byte b[] = convertToBytes(c); if (b.length == 0) return false; widths[0xff & b[0]] = advance; return true; }
/** * Sets the character advance. * * @param c * the character * @param advance * the character advance normalized to 1000 units * @return <CODE>true</CODE> if the advance was set, <CODE>false</CODE> * otherwise */ public boolean setCharAdvance(int c, int advance) { byte[] b = convertToBytes(c); if (b.length == 0) { return false; } widths[0xff & b[0]] = advance; return true; }
/** * Gets the smallest box enclosing the character contours. It will return * <CODE>null</CODE> if the font has not the information or the character has no * contours, as in the case of the space, for example. Characters with no contours may * also return [0,0,0,0]. * @param c the character to get the contour bounding box from * @return an array of four floats with the bounding box in the format [llx,lly,urx,ury] or * <code>null</code> */ public int[] getCharBBox(int c) { byte b[] = convertToBytes(c); if (b.length == 0) return null; else return charBBoxes[b[0] & 0xff]; }
/** * Gets the smallest box enclosing the character contours. It will return * <CODE>null</CODE> if the font has not the information or the character * has no contours, as in the case of the space, for example. Characters * with no contours may also return [0,0,0,0]. * * @param c * the character to get the contour bounding box from * @return an array of four floats with the bounding box in the format * [llx,lly,urx,ury] or <code>null</code> */ public int[] getCharBBox(int c) { byte[] b = convertToBytes(c); if (b.length == 0) { return null; } else { return charBBoxes[b[0] & 0xff]; } }
/** * 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 (fastWinansi) { if (char1 < 128 || (char1 >= 160 && char1 <= 255)) return widths[char1]; else return widths[PdfEncodings.winansi.get(char1)]; } else { int total = 0; byte mbytes[] = convertToBytes((char)char1); for (int k = 0; k < mbytes.length; ++k) total += widths[0xff & mbytes[k]]; return total; } }
/** * 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 (fastWinansi) { if (char1 < 128 || char1 >= 160 && char1 <= 255) { return widths[char1]; } else { return widths[PdfEncodings.winansi.get(char1)]; } } else { int total = 0; byte[] mbytes = convertToBytes((char) char1); for (byte mbyte : mbytes) { total += widths[0xff & mbyte]; } return total; } }
/** * 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 (fastWinansi) { if (char1 < 128 || (char1 >= 160 && char1 <= 255)) return widths[char1]; else return widths[PdfEncodings.winansi.get(char1)]; } else { int total = 0; byte mbytes[] = convertToBytes((char)char1); for (int k = 0; k < mbytes.length; ++k) total += widths[0xff & mbytes[k]]; return total; } }
/** * Gets the width of a <CODE>String</CODE> in normalized 1000 units. * * @param text * the <CODE>String</CODE> to get the width of * @return the width in normalized 1000 units */ public int getWidth(String text) { int total = 0; if (fastWinansi) { int len = text.length(); for (int k = 0; k < len; ++k) { char char1 = text.charAt(k); if (char1 < 128 || char1 >= 160 && char1 <= 255) { total += widths[char1]; } else { total += widths[PdfEncodings.winansi.get(char1)]; } } return total; } else { byte[] mbytes = convertToBytes(text); for (byte mbyte : mbytes) { total += widths[0xff & mbyte]; } } return total; }
/** * Gets the width of a <CODE>String</CODE> in normalized 1000 units. * @param text the <CODE>String</CODE> to get the width of * @return the width in normalized 1000 units */ public int getWidth(String text) { int total = 0; if (fastWinansi) { int len = text.length(); for (int k = 0; k < len; ++k) { char char1 = text.charAt(k); if (char1 < 128 || (char1 >= 160 && char1 <= 255)) total += widths[char1]; else total += widths[PdfEncodings.winansi.get(char1)]; } return total; } else { byte mbytes[] = convertToBytes(text); for (int k = 0; k < mbytes.length; ++k) total += widths[0xff & mbytes[k]]; } return total; }
/** * Gets the width of a <CODE>String</CODE> in normalized 1000 units. * @param text the <CODE>String</CODE> to get the width of * @return the width in normalized 1000 units */ public int getWidth(String text) { int total = 0; if (fastWinansi) { int len = text.length(); for (int k = 0; k < len; ++k) { char char1 = text.charAt(k); if (char1 < 128 || (char1 >= 160 && char1 <= 255)) total += widths[char1]; else total += widths[PdfEncodings.winansi.get(char1)]; } return total; } else { byte mbytes[] = convertToBytes(text); for (int k = 0; k < mbytes.length; ++k) total += widths[0xff & mbytes[k]]; } return total; }
switch (fontType) { case BaseFont.FONT_TYPE_T3: return baseFont.convertToBytes(text); case BaseFont.FONT_TYPE_T1: case BaseFont.FONT_TYPE_TT: { b = baseFont.convertToBytes(text); int len = b.length; for (int k = 0; k < len; ++k) for (int k = 0; k < len; ++k) cjkTag.put(cjkFont.getCidCode(text.charAt(k)), 0); b = baseFont.convertToBytes(text); break; b = baseFont.convertToBytes(text); break;
switch (fontType) { case BaseFont.FONT_TYPE_T3: return baseFont.convertToBytes(text); case BaseFont.FONT_TYPE_T1: case BaseFont.FONT_TYPE_TT: { b = baseFont.convertToBytes(text); int len = b.length; for (int k = 0; k < len; ++k) for (int k = 0; k < len; ++k) cjkTag.put(cjkFont.getCidCode(text.charAt(k)), 0); b = baseFont.convertToBytes(text); break; b = baseFont.convertToBytes(text); break;
switch (fontType) { case BaseFont.FONT_TYPE_T3: return baseFont.convertToBytes(text); case BaseFont.FONT_TYPE_T1: case BaseFont.FONT_TYPE_TT: { b = baseFont.convertToBytes(text); int len = b.length; for (int k = 0; k < len; ++k) for (int k = 0; k < len; ++k) cjkTag.put(cjkFont.getCidCode(text.charAt(k)), 0); b = baseFont.convertToBytes(text); break; b = baseFont.convertToBytes(text); break;