openhtmltopdf icon indicating copy to clipboard operation
openhtmltopdf copied to clipboard

'font' CSS shorthand property doesn't work

Open stechio opened this issue 3 years ago • 0 comments

[version: 1.0.9-SNAPSHOT; commit: ccd29f03ede2aecadac9c39fda95a5fedfb23645]

I noticed that font CSS shorthand property doesn't work, while the corresponding font-* CSS properties do:

CssFont

CssFont.pdf CssFont.html.txt

Here are the declarations used:

/* This one DOESN'T WORK */
p.shorthand {
    font: monospace bold 16pt;
}

/* This one works */
p.plain {
    font-family: monospace;
    font-weight: bold;
    font-size: 16pt;
}

Debugging com.openhtmltopdf.pdfboxout.PdfBoxFontResolver.resolveFont(SharedContext, String[], float, IdentValue, IdentValue, IdentValue), its families argument for CSS shorthand class contains the default value ([serif]) instead of the correct one ([monospace]).

stechio avatar Mar 31 '21 14:03 stechio