/** * Get glyph's width. * * @param unicode a unicode symbol or FontSpecif code. * @return Gets width in normalized 1000 units. */ public int getWidth(int unicode) { Glyph glyph = getGlyph(unicode); return glyph != null ? glyph.getWidth() : 0; }
@Override public Glyph getGlyph(int unicode) { if (fontEncoding.canEncode(unicode)) { Glyph glyph = getFontProgram().getGlyph(fontEncoding.getUnicodeDifference(unicode)); //TODO TrueType what if font is specific? if (glyph == null && (glyph = notdefGlyphs.get(unicode)) == null) { Glyph notdef = getFontProgram().getGlyphByCode(0); if (notdef != null) { glyph = new Glyph(getFontProgram().getGlyphByCode(0), unicode); notdefGlyphs.put(unicode, glyph); } } return glyph; } return null; }
@Override public boolean containsGlyph(int unicode) { if (fontEncoding.isFontSpecific()) { return fontProgram.getGlyphByCode(unicode) != null; } else { return fontEncoding.canEncode(unicode) && getFontProgram().getGlyph(fontEncoding.getUnicodeDifference(unicode)) != null; } }
/** * Get glyph's bbox. * * @param unicode a unicode symbol or FontSpecif code. * @return Gets bbox in normalized 1000 units. */ public int[] getCharBBox(int unicode) { Glyph glyph = getGlyph(unicode); return glyph != null ? glyph.getBbox() : null; }
@Override public boolean containsGlyph(int unicode) { if (cidFontType == CID_FONT_TYPE_0) { if (cmapEncoding.isDirect()) { return fontProgram.getGlyphByCode(unicode) != null; } else { return getFontProgram().getGlyph(unicode) != null; } } else if (cidFontType == CID_FONT_TYPE_2) { if (fontProgram.isFontSpecific()) { byte[] b = PdfEncodings.convertToBytes((char) unicode, "symboltt"); return b.length > 0 && fontProgram.getGlyph(b[0] & 0xff) != null; } else { return getFontProgram().getGlyph(unicode) != null; } } else { throw new PdfException("Invalid CID font type: " + cidFontType); } }
/** * Get glyph's bbox. * * @param unicode a unicode symbol or FontSpecif code. * @return Gets bbox in normalized 1000 units. */ public int[] getCharBBox(int unicode) { Glyph glyph = getGlyph(unicode); return glyph != null ? glyph.getBbox() : null; }
@Override public Glyph getGlyph(int unicode) { // TODO handle unicode value with cmap and use only glyphByCode Glyph glyph = getFontProgram().getGlyph(unicode); if (glyph == null && (glyph = notdefGlyphs.get(unicode)) == null) { // Handle special layout characters like sfthyphen (00AD). // This glyphs will be skipped while converting to bytes Glyph notdef = getFontProgram().getGlyphByCode(0); if (notdef != null) { glyph = new Glyph(notdef, unicode); } else { glyph = new Glyph(-1, 0, unicode); } notdefGlyphs.put(unicode, glyph); } return glyph; }
/** * Get glyph's width. * * @param unicode a unicode symbol or FontSpecif code. * @return Gets width in normalized 1000 units. */ public int getWidth(int unicode) { Glyph glyph = getGlyph(unicode); return glyph != null ? glyph.getWidth() : 0; }
@Override public boolean containsGlyph(int unicode) { if (fontEncoding.canEncode(unicode)) { if (fontEncoding.isFontSpecific()) { return getFontProgram().getGlyphByCode(unicode) != null; } else { return getFontProgram().getGlyph(fontEncoding.getUnicodeDifference(unicode)) != null; } } else { return false; } }
@Override public Glyph getGlyph(int unicode) { if (fontEncoding.canEncode(unicode) || unicode < 33) { Glyph glyph = getFontProgram().getGlyph(fontEncoding.getUnicodeDifference(unicode)); if (glyph == null && (glyph = notdefGlyphs.get(unicode)) == null) { // Handle special layout characters like sfthyphen (00AD). // This glyphs will be skipped while converting to bytes glyph = new Glyph(-1, 0, unicode); notdefGlyphs.put(unicode, glyph); } return glyph; } return null; }
@Override public Glyph getGlyph(int unicode) { if (fontEncoding.canEncode(unicode)) { Glyph glyph; if (fontEncoding.isFontSpecific()) { glyph = getFontProgram().getGlyphByCode(unicode); } else { glyph = getFontProgram().getGlyph(fontEncoding.getUnicodeDifference(unicode)); if (glyph == null && (glyph = notdefGlyphs.get(unicode)) == null) { // Handle special layout characters like sfthyphen (00AD). // This glyphs will be skipped while converting to bytes glyph = new Glyph(-1, 0, unicode); notdefGlyphs.put(unicode, glyph); } } return glyph; } return null; }
@Override public boolean containsGlyph(int unicode) { return (fontEncoding.canEncode(unicode) || unicode < 33) && getFontProgram().getGlyph(fontEncoding.getUnicodeDifference(unicode)) != null; }
int processed = 0; for (int k = from; k <= to; k++) { Glyph glyph = fontProgram.getGlyph(text.charAt(k) & 0xff); if (glyph != null && (isAppendableGlyph(glyph))) { glyphs.add(glyph);
len = b.length; for (int k = 0; k < len; ++k) { Glyph glyph = fontProgram.getGlyph(b[k] & 0xff); if (glyph != null) { convertToBytes(glyph, buffer);
len = b.length; for (int k = 0; k < len; ++k) { Glyph glyph = fontProgram.getGlyph(b[k] & 0xff); if (glyph != null) { glyphs.add(glyph);
byte[] b = PdfEncodings.convertToBytes(text, "symboltt"); if (b.length > 0) { Glyph glyph = fontProgram.getGlyph(b[0] & 0xff); if (glyph != null) { glyphs.add(glyph);
if (shortTag[k] != 0) { int uni = fontEncoding.getUnicode(k); Glyph glyph = uni > -1 ? fontProgram.getGlyph(uni) : fontProgram.getGlyphByCode(k); if (glyph != null) { glyphs.add(glyph.getCode());