public static void embedFont(PSGenerator gen, Typeface tf, PSResource fontRes)
throws IOException {
boolean embeddedFont = false;
if (FontType.TYPE1 == tf.getFontType()) {
if (tf instanceof CustomFont) {
CustomFont cf = (CustomFont)tf;
if (isEmbeddable(cf)) {
InputStream in = getInputStreamOnFont(gen, cf);
if (in != null) {
gen.writeDSCComment(DSCConstants.BEGIN_RESOURCE,
fontRes);
embedType1Font(gen, in);
gen.writeDSCComment(DSCConstants.END_RESOURCE);
gen.getResourceTracker().registerSuppliedResource(fontRes);
embeddedFont = true;
} else {
gen.commentln("%WARNING: Could not embed font: " + cf.getFontName());
log.warn("Font " + cf.getFontName() + " is marked as supplied in the"
+ " PostScript file but could not be embedded!");
}
}
}
}