Closed Bug 1713199 Opened 4 years ago Closed 4 years ago

Italic variant not selected but defined in style

Categories

(Core :: Layout: Text and Fonts, defect)

defect

Tracking

()

RESOLVED INVALID
Tracking Status
firefox90 --- affected

People

(Reporter: calixte, Unassigned)

Details

Attachments

(1 file)

Attached file toto.html

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 ?

Flags: needinfo?(jfkthame)

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.

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.

Flags: needinfo?(jfkthame)

And adding a minus to the angle fixes the issue, thanks a lot.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: