return fontRecord;
}
// filename is null, so no ttf file registered for the fontname, maybe this is
// one of the internal fonts ...
final BaseFont f = BaseFont.createFont(fontName, stringEncoding, embedded,
useGlobalCache, null, null);
if (f != null)
{
fontRecord = new BaseFontRecord(fontName, false, embedded, f, bold, italic);
putToCache(fontRecord);
return fontRecord;
}
}
}
// If we got to this point, then the font was not recognized as any known font. We will fall back
// to Helvetica instead ..
}
catch (Exception e)
{
if (logger.isDebugEnabled())
{
logger.debug("BaseFont.createFont failed. Key = " + fontKey + ": " + e.getMessage(), e);
}
else if (logger.isWarnEnabled())
{
logger.warn("BaseFont.createFont failed. Key = " + fontKey + ": " + e.getMessage(), e);
}
}
// fallback .. use BaseFont.HELVETICA as default
try
{
// check, whether HELVETICA is already created - yes, then return cached instance instead
BaseFontRecord fontRecord = getFromCache(BaseFont.HELVETICA, stringEncoding, embedded);
if (fontRecord != null)
{
// map all font references of the invalid font to the default font..
// this might be not very nice, but at least the report can go on..
putToCache(new BaseFontRecordKey(fontKey, encoding, embedded), fontRecord);
return fontRecord;
}
// no helvetica created, so do this now ...
final BaseFont f = BaseFont.createFont(BaseFont.HELVETICA, stringEncoding, embedded,
useGlobalCache, null, null);
if (f != null)
{
fontRecord = new BaseFontRecord
(BaseFont.HELVETICA, false, embedded, f, bold, italic);