@Override public Type1CharString getType1CharString(String name) throws IOException { return CFFType1Font.this.getType1CharString(name); } }
/** * Returns the Type 1 charstring for the given GID. * * @param gid GID * @throws IOException if the charstring could not be read */ @Override public Type2CharString getType2CharString(int gid) throws IOException { String name = "GID+" + gid; // for debugging only return getType2CharString(gid, name); }
private Type2CharString getType2CharString(int gid, String name) throws IOException { Type2CharString type2 = charStringCache.get(gid); if (type2 == null) { byte[] bytes = null; if (gid < charStrings.length) { bytes = charStrings[gid]; } if (bytes == null) { // .notdef bytes = charStrings[0]; } Type2CharStringParser parser = new Type2CharStringParser(fontName, name); List<Object> type2seq = parser.parse(bytes, globalSubrIndex, getLocalSubrIndex()); type2 = new Type2CharString(reader, fontName, name, gid, type2seq, getDefaultWidthX(), getNominalWidthX()); charStringCache.put(gid, type2); } return type2; }
/** * Returns the Type 1 charstring for the given PostScript glyph name. * * @param name PostScript glyph name * @throws IOException if the charstring could not be read */ public Type1CharString getType1CharString(String name) throws IOException { // lookup via charset int gid = nameToGID(name); // lookup in CharStrings INDEX return getType2CharString(gid, name); }
output.println("/NP {noaccess put} executeonly def"); output.println("/BlueValues " + formatArray(font.getPrivateDict().get("BlueValues"), true) + " ND"); output.println("/OtherBlues " + formatArray(font.getPrivateDict().get("OtherBlues"), true) + " ND"); output.println("/BlueScale " + font.getPrivateDict().get("BlueScale") + " def"); output.println("/BlueShift " + font.getPrivateDict().get("BlueShift") + " def"); output.println("/BlueFuzz " + font.getPrivateDict().get("BlueFuzz") + " def"); output.println("/StdHW " + formatArray(font.getPrivateDict().get("StdHW"), true) + " ND"); output.println("/StdVW " + formatArray(font.getPrivateDict().get("StdVW"), true) + " ND"); output.println("/ForceBold " + font.getPrivateDict().get("ForceBold") + " def"); output.println("/MinFeature {16 16} def"); output.println("/password 5839 def"); Type1CharStringFormatter formatter = new Type1CharStringFormatter(); for (int gid : gids.keySet()) { String mapping = font.getCharset().getNameForGID(gid); byte[] type1Bytes = formatter.format(font.getType1CharString(mapping).getType1Sequence()); byte[] charstringBytes = Type1FontUtil.charstringEncrypt(type1Bytes, 4); output.print("/" + mapping + " " + charstringBytes.length + " RD ");
break; font.setEncoding(encoding); for (Map.Entry<String, Object> entry : privDict.entrySet()) font.addToPrivateDict(entry.getKey(), entry.getValue()); font.addToPrivateDict("Subrs", readIndexData(input));
private int getDefaultWidthX() { Number num = (Number)getProperty("defaultWidthX"); if (num == null) { return 1000; } return num.intValue(); }
font = new CFFType1Font();
Map<String, Object> getPrivateDict() { if (font instanceof CFFType1Font) return ((CFFType1Font) font).getPrivateDict(); else { Map<String, Object> dict = new HashMap<String, Object>(); for (Map<String, Object> dictOn : ((CFFCIDFont) font).getPrivDicts()) dict.putAll(dictOn); return dict; } }
/** * Returns the Type 1 charstring for the given PostScript glyph name. * * @param name PostScript glyph name * @throws IOException if the charstring could not be read */ public Type1CharString getType1CharString(String name) throws IOException { // lookup via charset int gid = nameToGID(name); // lookup in CharStrings INDEX return getType2CharString(gid, name); }
break; font.setEncoding(encoding); for (Map.Entry<String, Object> entry : privDict.entrySet()) font.addToPrivateDict(entry.getKey(), entry.getValue()); font.addToPrivateDict("Subrs", readIndexData(input));
private int getNominalWidthX() { Number num = (Number)getProperty("nominalWidthX"); if (num == null) { return 0; } return num.intValue(); } }
font = new CFFType1Font();
@Override public GeneralPath getPath(String name) throws IOException { return getType1CharString(name).getPath(); }
/** * Returns the Type 2 charstring for the given CID, or null if the substituted font does not * contain Type 2 charstrings. * * @param cid CID * @throws IOException if the charstring could not be read */ public Type2CharString getType2CharString(int cid) throws IOException { if (cidFont != null) { return cidFont.getType2CharString(cid); } else if (t1Font instanceof CFFType1Font) { return ((CFFType1Font)t1Font).getType2CharString(cid); } else { return null; } }
/** * Returns the Type 1 charstring for the given PostScript glyph name. * * @param name PostScript glyph name * @throws IOException if the charstring could not be read */ public Type1CharString getType1CharString(String name) throws IOException { // lookup via charset int gid = nameToGID(name); // lookup in CharStrings INDEX return getType2CharString(gid, name); }
private Type2CharString getType2CharString(int gid, String name) throws IOException { Type2CharString type2 = charStringCache.get(gid); if (type2 == null) { byte[] bytes = null; if (gid < charStrings.length) { bytes = charStrings[gid]; } if (bytes == null) { // .notdef bytes = charStrings[0]; } Type2CharStringParser parser = new Type2CharStringParser(fontName, name); List<Object> type2seq = parser.parse(bytes, globalSubrIndex, getLocalSubrIndex()); type2 = new Type2CharString(reader, fontName, name, gid, type2seq, getDefaultWidthX(), getNominalWidthX()); charStringCache.put(gid, type2); } return type2; }
break; font.setEncoding(encoding); for (Map.Entry<String, Object> entry : privDict.entrySet()) font.addToPrivateDict(entry.getKey(), entry.getValue()); font.addToPrivateDict("Subrs", readIndexData(input));
private int getNominalWidthX() { Number num = (Number)getProperty("nominalWidthX"); if (num == null) { return 0; } return num.intValue(); } }
font = new CFFType1Font();