Italic angle is defined clockwise in CSS when it's counterclockwise in PDF

This commit is contained in:
Calixte Denizet 2021-05-28 11:06:11 +02:00
parent f587d5998e
commit 1b0006093d

View File

@ -901,7 +901,11 @@ class PDFDocument {
} }
const fontFamily = descriptor.get("FontFamily"); const fontFamily = descriptor.get("FontFamily");
const fontWeight = descriptor.get("FontWeight"); const fontWeight = descriptor.get("FontWeight");
const italicAngle = descriptor.get("ItalicAngle");
// Angle is expressed in degrees counterclockwise in PDF
// when it's clockwise in CSS
// (see https://drafts.csswg.org/css-fonts-4/#valdef-font-style-oblique-angle)
const italicAngle = -descriptor.get("ItalicAngle");
const cssFontInfo = { fontFamily, fontWeight, italicAngle }; const cssFontInfo = { fontFamily, fontWeight, italicAngle };
if (!validateCSSFont(cssFontInfo)) { if (!validateCSSFont(cssFontInfo)) {