Italic variant not selected but defined in style
Categories
(Core :: Layout: Text and Fonts, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox90 | --- | affected |
People
(Reporter: calixte, Unassigned)
Details
Attachments
(1 file)
1.24 MB,
text/html
|
Details |
The attached html contains 2 fonts Arial:
- one with property
font-style: oblique -12deg
; - one with property
font-style: oblique 0deg
.
and at the end <span style="font-family: Arial; font-style: italic;">Hello world</span>
.
The text is rendered with the normal variant and not the italic one.
It works correctly in Chrome (unstable at least).
I met this bug when implementing XFA stuff in pdf.js.
:jfkthame, could help here ?
Reporter | ||
Comment 1•4 years ago
|
||
If an info is missing in the font itself, please tell me, it's likely caused by an issue in pdf.js where fonts are parsed and rewrote.
Comment 2•4 years ago
|
||
This looks like correct behavior, according to the CSS font-matching algorithm.
oblique -12deg
is a poor match for italic
; the face with oblique: 0deg
is preferred. If the <span>
were actually styled with a negative oblique style, then the oblique -12deg
face would be used.
I think the root of this is a misunderstanding in handling the mapping between italic/oblique angles as found in the OpenType font and the values used in CSS. OpenType measures the angle counter-clockwise, so that a "normal" right-leaning italic font has a negative angle; but CSS measures clockwise, so the default oblique angle is 14deg
, and a negative angle would represent a left-leaning font. See https://drafts.csswg.org/css-fonts-4/#valdef-font-style-oblique-angle.
Reporter | ||
Comment 3•4 years ago
|
||
And adding a minus to the angle fixes the issue, thanks a lot.
Description
•