Openpdf: Test failures on systems where Tahoma-bold font is available

Created on 18 Sep 2019  路  2Comments  路  Source: LibrePDF/OpenPDF

I just wanted to build the project but the following junit test fails:

"testStyleSettingByValue" in FontTest.java. The Problem seems to be when the Font is created via the FontFactory (line 47) the second iteration (style=1) fails.
I debugged into the FontFactoryImp.java and in the getFont() method there is a retrieval of the font families: [Tahoma, Tahoma, Tahoma Bold, Tahoma Bold]. (line 177).
Now style=1 means bold and since there is a "Tahoma Bold" font the style is reset to 0 (lines 183-188):

 // If a styled font already exists, we don't want to use the separate style-Attribut.
 // For example: Helvetica-Bold should have a normal style, because it's already bold.
 style = s == fs ? Font.NORMAL : s;

Now I have too little understanding of that area: It makes sense not to unset the bold-style since there is a tahoma-bold font available. So it could be that just the junit is not correct, which would also indicate the variable name "FONT_NAME_WITHOUT_STYLES". Because it actually does have a style

CRITICAL bug help wanted

Most helpful comment

I wrote the test. Didn't know Tahoma has a bold font too. I'll fix it. Do you know a font which has no bold or Italic styled font?

All 2 comments

Pull request welcome!

I wrote the test. Didn't know Tahoma has a bold font too. I'll fix it. Do you know a font which has no bold or Italic styled font?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andreasrosdal picture andreasrosdal  路  4Comments

erikliberal picture erikliberal  路  7Comments

jjkarppi picture jjkarppi  路  7Comments

michaelhugi picture michaelhugi  路  6Comments

literakl picture literakl  路  6Comments