Hi all;
This is not an iText question but it's Java fonts and so I figure someone here
is likely to know the answer.
When I request a font under Java, if that font does not exist, I need to
determine what font it maps to (so I can log the mapping in use). Under Java
1.6 I could use:
Font logicalFont = new java.awt.Font(fontname, java.awt.Font.PLAIN, 12);
for (int i = 0; i < FontManager.getRegisteredFonts().length; i++) {
Font2D font2D = FontManager.getRegisteredFonts()[i];
if (font2D instanceof CompositeFont &&
font2D.getFontName(Locale.getDefault()).equals(logicalFont.getFontName())) {
PhysicalFont physicalFont = ((CompositeFont) font2D).getSlotFont(0);
log.warn("The requested font '" + fontname + "' does not exist on this
system. Substituting the font '" +
physicalFont.getFamilyName(Locale.getDefault()) + "'");
return;
}
}
But in Java 1.7 FontManager has no getRegisteredFonts() static member (I think
it's actually an interface now). So how can I get the mapping?
thanks - dave
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php