Skip to content

Commit eaccd6e

Browse files
committed
ROB: font_metrics: Add font aliases
Version 1.7 of the PDF reference lists various alternatives names as accepted for the 14 core fonts, such as Arial for Helvetica and CourierNew for Courier. Add these alternative names to the font metrics.
1 parent 0fcced7 commit eaccd6e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pypdf/_codecs/core_fontmetrics.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4427,3 +4427,17 @@
44274427
),
44284428
}
44294429

4430+
4431+
# Add aliases per table H.3 on pp. 1109-1110 of the PDF 1.7 reference
4432+
FONT_METRICS["Arial"] = FONT_METRICS["Helvetica"]
4433+
FONT_METRICS["Arial,Italic"] = FONT_METRICS["Helvetica-Oblique"]
4434+
FONT_METRICS["Arial,Bold"] = FONT_METRICS["Helvetica-Bold"]
4435+
FONT_METRICS["Arial,BoldItalic"] = FONT_METRICS["Helvetica-BoldOblique"]
4436+
FONT_METRICS["CourierNew"] = FONT_METRICS["Courier"]
4437+
FONT_METRICS["CourierNew,Italic"] = FONT_METRICS["Courier-Oblique"]
4438+
FONT_METRICS["CourierNew,Bold"] = FONT_METRICS["Courier-Bold"]
4439+
FONT_METRICS["CourierNew,BoldItalic"] = FONT_METRICS["Courier-BoldOblique"]
4440+
FONT_METRICS["TimesNewRoman"] = FONT_METRICS["Times-Roman"]
4441+
FONT_METRICS["TimesNewRoman,Italic"] = FONT_METRICS["Times-Italic"]
4442+
FONT_METRICS["TimesNewRoman,Bold"] = FONT_METRICS["Times-Bold"]
4443+
FONT_METRICS["TimesNewRoman,BoldItalic"] = FONT_METRICS["Times-BoldItalic"]

0 commit comments

Comments
 (0)