/** * Converts a unicode symbol or font specific code * to {@code byte} according to the encoding. * * @param unicode a unicode symbol or FontSpecif code to be converted. * @return a {@code byte} representing the conversion according to the encoding */ public int convertToByte(int unicode) { return unicodeToCode.get(unicode); }
private static void fillDifferences(DocFontEncoding fontEncoding, CMapToUnicode toUnicode) { IntHashtable byte2uni = toUnicode.createDirectMapping(); for(Integer code : byte2uni.getKeys()) { int unicode = byte2uni.get((int) code); String glyphName = AdobeGlyphList.unicodeToName(unicode); fontEncoding.codeToUnicode[(int) code] = unicode; fontEncoding.unicodeToCode.put(unicode, (int) code); fontEncoding.differences[(int) code] = glyphName; fontEncoding.unicodeDifferences.put(unicode, unicode); } } }
public byte[] charToByte(char char1, String encoding) { if (char1 < 128) return new byte[]{(byte)char1}; else { byte v = (byte)c2b.get(char1); if (v != 0) return new byte[]{v}; else return new byte[0]; } }
public byte[] charToByte(char char1, String encoding) { if (char1 < 128) return new byte[]{(byte)char1}; else { byte v = (byte)c2b.get(char1); if (v != 0) return new byte[]{v}; else return new byte[0]; } }
public byte[] charToByte(char char1, String encoding) { byte v = (byte)translation.get(char1); if (v != 0) return new byte[]{v}; else return new byte[0]; }
/** * Converts a unicode symbol or font specific code * to {@code byte} according to the encoding. * * @param unicode a unicode symbol or FontSpecif code to be converted. * @return a {@code byte} representing the conversion according to the encoding */ public int convertToByte(int unicode) { return unicodeToCode.get(unicode); }
public int getCidCode(int cmapCode) { if (isDirect) { return cmapCode; } else { return code2Cid.get(cmapCode); } }
public byte[] charToByte(char char1, String encoding) { byte v = (byte)translation.get(char1); if (v != 0) return new byte[]{v}; else return new byte[0]; }
/** * Gets the reference number in the xref table based on the index in the * indirect object list. * * @param i the index of an object in the indirect object list * @return the corresponding reference number in the xref table */ public int getRefByIndex(int i) { return idxToRef.get(i); }
public int getCidCode(int cmapCode) { if (isDirect) { return cmapCode; } else { return code2Cid.get(cmapCode); } }
/** * Gets the index of an object based on its number in the xref table. * * @param ref a number in the xref table * @return the index in the list of indirect objects */ public int getIndexByRef(int ref) { return refToIdx.get(ref); }
public int lookup(int character) { return map.get(character); }
public int getUnicodeDifference(int index) { return unicodeDifferences.get(index); }
public int lookup(int character) { return map.get(character); }
public int getOtfClass(int glyph) { return mapClass.get(glyph); }
/** * Gets the kerning between two glyphs. * * @param first the first glyph * @param second the second glyph * @return the kerning to be applied */ @Override public int getKerning(Glyph first, Glyph second) { if (first == null || second == null) { return 0; } return kerning.get((first.getCode() << 16) + second.getCode()); }
public CMapToUnicode exportToUnicode() { CMapToUnicode uni = new CMapToUnicode(); int[] keys = map.toOrderedKeys(); for (int key : keys) { uni.addChar(map.get(key), TextUtil.convertFromUtf32(key)); } int spaceCid = lookup(32); if (spaceCid != 0) { uni.addChar(spaceCid, TextUtil.convertFromUtf32(32)); } return uni; } }
public CMapToUnicode exportToUnicode() { CMapToUnicode uni = new CMapToUnicode(); int[] keys = map.toOrderedKeys(); for (int key : keys) { uni.addChar(map.get(key), TextUtil.convertFromUtf32(key)); } int spaceCid = lookup(32); if (spaceCid != 0) { uni.addChar(spaceCid, TextUtil.convertFromUtf32(32)); } return uni; } }