// register font as necessary
String internalFontName = getInternalFontNameForArea(text);
Map/*<String,FontMetrics>*/ fontMetricMap = fontInfo.getFonts();
AFPFont font = (AFPFont)fontMetricMap.get(internalFontName);
AFPPageFonts pageFonts = paintingState.getPageFonts();
AFPFontAttributes fontAttributes = pageFonts.registerFont(internalFontName, font, fontSize);
Font fnt = getFontFromArea(text);
if (font.isEmbeddable()) {
CharacterSet charSet = font.getCharacterSet(fontSize);
try {
this.resourceManager.embedFont(font, charSet);
} catch (IOException ioe) {
AFPEventProducer eventProducer
= AFPEventProducer.Provider.get(userAgent.getEventBroadcaster());
eventProducer.resourceEmbeddingError(this, charSet.getName(), ioe);
}
}
// create text data info
AFPTextDataInfo textDataInfo = new AFPTextDataInfo();
int fontReference = fontAttributes.getFontReference();
textDataInfo.setFontReference(fontReference);
int x = (currentIPPosition + text.getBorderAndPaddingWidthStart());
int y = (currentBPPosition + text.getOffset() + text.getBaselineOffset());