/** * Add a newline to the given string. */ public void println() { write('\n'); } }
private void printFontDictionary(CFFType1Font font, DataOutput output, String iStr) throws IOException { output.println("10 dict begin"); output.println("/FontInfo 10 dict dup begin"); output.println("/version (" + font.getTopDict().get("version") + ") readonly def"); output.println("/Notice (" + font.getTopDict().get("Notice") + ") readonly def"); output.println("/FullName (" + font.getTopDict().get("FullName") + ") readonly def"); output.println("/FamilyName (" + font.getTopDict().get("FamilyName") + ") readonly def"); output.println("/Weight (" + font.getTopDict().get("Weight") + ") readonly def"); output.println("/ItalicAngle " + font.getTopDict().get("ItalicAngle") + " def"); output.println("/isFixedPitch " + font.getTopDict().get("isFixedPitch") + " def"); output.println("/UnderlinePosition " + font.getTopDict().get("UnderlinePosition") + " def"); output.println("/UnderlineThickness " + font.getTopDict().get("UnderlineThickness") + " def"); output.println("end readonly def"); output.println("/FontName /" + font.getName() + iStr + " def"); output.println("/PaintType " + font.getTopDict().get("PaintType") + " def"); output.println("/FontType 1 def"); NumberFormat matrixFormat = new DecimalFormat("0.########", new DecimalFormatSymbols(Locale.US)); output.println("/FontMatrix " + formatArray(font.getTopDict().get("FontMatrix"), matrixFormat, false) + " readonly def");
private void printEexecFontDictionary(CFFType1Font font, DataOutput output) throws IOException { output.println("dup /Private 15 dict dup begin"); output.println("/RD {string currentfile exch readstring pop} executeonly def"); output.println("/ND {noaccess def} executeonly def"); 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"); output.println("2 index /CharStrings " + gids.size() + " dict dup begin"); Type1CharStringFormatter formatter = new Type1CharStringFormatter(); for (int gid : gids.keySet()) { byte[] type1Bytes = formatter.format(font.getType1CharString(mapping).getType1Sequence()); byte[] charstringBytes = Type1FontUtil.charstringEncrypt(type1Bytes, 4); output.print("/" + mapping + " " + charstringBytes.length + " RD "); output.write(charstringBytes); output.print(" ND");
/** * Read and convert a given CFFFont. * @param font the given CFFFont * @param i * @return the Type1 font * @throws IOException if an error occurs during reading the given font */ public byte[] format(CFFType1Font font, String i) throws IOException { DataOutput output = new DataOutput(); printFont(font, output, i); return output.getBytes(); }
private void printFont(CFFType1Font font, DataOutput output, String iStr) throws IOException { output.println("%!FontType1-1.0 " + font.getName() + iStr + " " + font.getTopDict().get("version")); printFontDictionary(font, output, iStr); for (int i = 0; i < 8; i++) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < 64; j++) { sb.append("0"); } output.println(sb.toString()); } output.println("cleartomark"); }
/** * Write the given string to the buffer using the given encoding. * A newline is added after the given string * @param string the given string * @throws IOException If an error occurs during writing the data to the buffer */ public void println(String string) throws IOException { write(string.getBytes(outputEncoding)); write('\n'); }
/** * Write the given string to the buffer using the given encoding. * @param string the given string * @throws IOException If an error occurs during writing the data to the buffer */ public void print(String string) throws IOException { write(string.getBytes(outputEncoding)); }
/** * Add a newline to the given string. */ public void println() { write('\n'); } }
/** * Add a newline to the given string. */ public void println() { write('\n'); } }
/** * Write the given string to the buffer using the given encoding. * A newline is added after the given string * @param string the given string * @throws IOException If an error occurs during writing the data to the buffer */ public void println(String string) throws IOException { write(string.getBytes(outputEncoding)); write('\n'); }
/** * Write the given string to the buffer using the given encoding. * A newline is added after the given string * @param string the given string * @throws IOException If an error occurs during writing the data to the buffer */ public void println(String string) throws IOException { write(string.getBytes(outputEncoding)); write('\n'); }
/** * Write the given string to the buffer using the given encoding. * @param string the given string * @throws IOException If an error occurs during writing the data to the buffer */ public void print(String string) throws IOException { write(string.getBytes(outputEncoding)); }
/** * Write the given string to the buffer using the given encoding. * @param string the given string * @throws IOException If an error occurs during writing the data to the buffer */ public void print(String string) throws IOException { write(string.getBytes(outputEncoding)); }