public static Map determineSuppliedFonts(ResourceTracker resTracker,
FontInfo fontInfo, Map<String, Typeface> fonts) {
Map fontResources = new java.util.HashMap();
for (String key : fonts.keySet()) {
Typeface tf = getTypeFace(fontInfo, fonts, key);
PSResource fontRes = new PSResource("font", tf.getEmbedFontName());
fontResources.put(key, fontRes);
FontType fontType = tf.getFontType();
if (fontType == FontType.TYPE1 || fontType == FontType.TRUETYPE
|| fontType == FontType.TYPE0) {
if (tf instanceof CustomFont) {
CustomFont cf = (CustomFont)tf;
if (isEmbeddable(cf)) {
if (fontType == FontType.TYPE0) {
resTracker.registerSuppliedResource(
new PSResource(PSResource.TYPE_CIDFONT, tf.getEmbedFontName()));
resTracker.registerSuppliedResource(
new PSResource(PSResource.TYPE_CMAP, "Identity-H"));
}
resTracker.registerSuppliedResource(fontRes);
}
if (tf instanceof SingleByteFont) {
SingleByteFont sbf = (SingleByteFont)tf;
for (int i = 0, c = sbf.getAdditionalEncodingCount(); i < c; i++) {
SingleByteEncoding encoding = sbf.getAdditionalEncoding(i);
PSResource encodingRes = new PSResource(
PSResource.TYPE_ENCODING, encoding.getName());
resTracker.registerSuppliedResource(encodingRes);
PSResource derivedFontRes = new PSResource(
PSResource.TYPE_FONT, tf.getEmbedFontName() + "_" + (i + 1));
resTracker.registerSuppliedResource(derivedFontRes);
}
}
}