danfickle / danfickle/openhtmltopdf

'font' CSS shorthand property doesn't work

Open
#682 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

[version: 1.0.9-SNAPSHOT; commit: [ccd29f03ede2aecadac9c39fda95a5fedfb23645](https://github.com/danfickle/openhtmltopdf/tree/ccd29f03ede2aecadac9c39fda95a5fedfb23645)]

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


CssFont

[CssFont.pdf](https://github.com/danfickle/openhtmltopdf/files/6237287/CssFont.pdf)
[CssFont.html.txt](https://github.com/danfickle/openhtmltopdf/files/6237286/CssFont.html.txt)

Here are the declarations used:

```html
/* 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]`).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.