I'm trying to use a custom font, I don't get any error but it doesn't take it into account.
Rectangle pageSize = basePdf.getPageSize(i);
PdfContentByte pdfContentByte = stamper.getOverContent(i);
// Use custom font
if (!FontFactory.isRegistered(FUTURA_LIGHT)) {
FileHelper.copyFileFromAssetsToInternalStorage(mContext, FONT_PATH_IN_ASSETS);
FontFactory.register(mContext.getFilesDir() + "/" + FONT_PATH_IN_ASSETS, FUTURA_LIGHT);
}
Font myFont = FontFactory.getFont(FUTURA_LIGHT);
BaseFont font = myFont.getBaseFont();
pdfContentByte.saveState();
pdfContentByte.stroke();
pdfContentByte.restoreState();
// Start to add text
pdfContentByte.beginText();
pdfContentByte.setFontAndSize(font, 6);
if (fontColor != null) {
pdfContentByte.setColorFill(fontColor);
}
pdfContentByte.showTextAligned(PdfContentByte.ALIGN_CENTER, message, pageSize.getWidth() / 2, 40, 0);
pdfContentByte.endText();
I've checked and the font is indeed registered, it just doesn't apply it to the PDF.