OpenPDF icon indicating copy to clipboard operation
OpenPDF copied to clipboard

Bold fonts not working

Open nikosdimitrakas opened this issue 3 years ago • 5 comments

Up until version 1.3.17 bold fonts were working fine. From version 1.3.18 all the way to 1.3 26 they are not. Here is an example of two fonts that became identical in version 1.3.18: new Font(Font.HELVETICA, 16f, Font.BOLD) new Font(Font.HELVETICA, 16f) Just in case it matters, the fonts above were used in a chunk in a paragraph. No special characters and nothing special otherwise.

nikosdimitrakas avatar Feb 15 '22 17:02 nikosdimitrakas

Thanks for reporting this issue. Do you think this PR is related to this bug? https://github.com/LibrePDF/OpenPDF/pull/374

andreasrosdal avatar Feb 16 '22 07:02 andreasrosdal

Of all the things included in the release notes of 1.3.18, this is probably the one that relates to this.

nikosdimitrakas avatar Feb 16 '22 08:02 nikosdimitrakas

using new Font(baseFont, size, style, color) bold fonts do work in OPenPdf 1.3.26

arnthom avatar Feb 17 '22 08:02 arnthom

After some more testing, I have identified that the problem with bold not working depends on whether or not the string in the chunk or paragraph contains a new line character \n. When there is a \n in the string, bold does not work. I hope this helps identify the issue in the code.

nikosdimitrakas avatar Feb 24 '22 20:02 nikosdimitrakas