Typeface font = (Typeface)usedFonts.get(f);
//Check if the font actually had any mapping operations. If not, it is an indication
//that it has never actually been used and therefore doesn't have to be embedded.
if (font.hadMappingOperations()) {
FontDescriptor desc = null;
if (font instanceof FontDescriptor) {
desc = (FontDescriptor)font;
}
addFont(doc.getFactory().makeFont(
f, font.getEmbedFontName(), font.getEncoding(), font, desc));