gnujpdf code clean

This commit is contained in:
Jindra Petřík
2021-02-20 10:07:44 +01:00
parent 82372d15e8
commit 70e8d132b0

View File

@@ -9,9 +9,8 @@ import java.io.OutputStream;
*/
public class PDFEmbeddedFont extends PDFFont {
private String name;
private String font;
private String type;
private final String name;
private final String font;
private final String descendantFont;
private final String toUnicode;
@@ -19,45 +18,19 @@ public class PDFEmbeddedFont extends PDFFont {
super(name, "/TrueType", font, style);
this.name = name;
this.font = font;
this.type = "/TrueType";
this.descendantFont = descendantFont;
this.toUnicode = toUnicode;
}
@Override
public void write(OutputStream os) throws IOException {
// Write the object header
writeStart(os);
// now the objects body
os.write("/Subtype /Type0\n".getBytes());
os.write(("/BaseFont " + font + "\n").getBytes());
os.write(("/Name " + name + "\n").getBytes());
os.write("/Encoding /Identity-H\n".getBytes());
//System.err.println("descendantFont=" + descendantFont);
os.write(("/ToUnicode " + toUnicode + "\n").getBytes());
os.write(("/DescendantFonts [" + descendantFont + "]\n").getBytes());
/*int cnt = 300;
os.write(("/FirstChar 0\n").getBytes());
os.write(("/LastChar " + (cnt - 1) + "\n").getBytes());
os.write(("/Widths [").getBytes());
for (int i = 0; i < cnt; i++) {
os.write((" " + i).getBytes());
}
os.write(("]\n").getBytes());
*/
//os.write("/Widths [500 583 587 796]".getBytes());
/*os.write("/FontDescriptor ".getBytes());
os.write(descriptor.getBytes());
os.write("\n".getBytes());*/
/*os.write("/ToUnicode ".getBytes());
os.write(toUnicode.getBytes());
os.write("\n".getBytes());*/
// finish off with its footer
writeEnd(os);
}