Skip to content

Commit 2061f82

Browse files
committed
ENH: Font dataclass
This patch adds a new Font dataclass. Its initial use, for now, is to act as a dataclass for the font metrics of the 14 Adobe core fonts. These fonts are usually not embedded in PDF documents, while PDF readers are expected to carry that information themselves.
1 parent 5e6c41d commit 2061f82

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pypdf/_font.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from dataclasses import dataclass
2+
from typing import Dict, Tuple
3+
4+
5+
@dataclass(frozen=True)
6+
class Font:
7+
name: str
8+
family: str
9+
weight: str
10+
11+
ascent: float
12+
descent: float
13+
cap_height: float
14+
x_height: float
15+
italic_angle: float
16+
flags: int
17+
bbox: Tuple[float, float, float, float]
18+
19+
character_widths: Dict[str, int]

0 commit comments

Comments
 (0)