-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Expand file tree
/
Copy pathdviread.pyi
More file actions
128 lines (112 loc) · 3.29 KB
/
dviread.pyi
File metadata and controls
128 lines (112 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import dataclasses
from pathlib import Path
import io
import os
from enum import Enum
from collections.abc import Generator
from typing import NamedTuple
from typing import Self
from .ft2font import CharacterCodeType, GlyphIndexType
class _dvistate(Enum):
pre = ...
outer = ...
inpage = ...
post_post = ...
finale = ...
class Page(NamedTuple):
text: list[Text]
boxes: list[Box]
height: int
width: int
descent: int
class Box(NamedTuple):
x: int
y: int
height: int
width: int
class Text(NamedTuple):
x: int
y: int
font: DviFont
glyph: CharacterCodeType
width: int
@property
def font_path(self) -> Path: ...
@property
def font_size(self) -> float: ...
@property
def font_effects(self) -> dict[str, float]: ...
@property
def index(self) -> GlyphIndexType: ... # type: ignore[override]
@property
def glyph_name_or_index(self) -> GlyphIndexType | str: ...
class Dvi:
file: io.BufferedReader
dpi: float | None
fonts: dict[int, DviFont]
state: _dvistate
def __init__(self, filename: str | os.PathLike, dpi: float | None) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, etype, evalue, etrace) -> None: ...
def __iter__(self) -> Generator[Page, None, None]: ...
def close(self) -> None: ...
class DviFont:
texname: bytes
def __init__(
self, scale: float, metrics: Tfm | TtfMetrics, texname: bytes, vf: Vf | None
) -> None: ...
@classmethod
def from_luatex(cls, scale: float, texname: bytes) -> DviFont: ...
@classmethod
def from_xetex(
cls, scale: float, texname: bytes, subfont: int, effects: dict[str, float]
) -> DviFont: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
@property
def size(self) -> float: ...
@property
def widths(self) -> list[int]: ...
@property
def fname(self) -> str: ...
@property
def face_index(self) -> int: ...
def resolve_path(self) -> Path: ...
@property
def subfont(self) -> int: ...
@property
def effects(self) -> dict[str, float]: ...
class Vf(Dvi):
def __init__(self, filename: str | os.PathLike) -> None: ...
def __getitem__(self, code: int) -> Page: ...
@dataclasses.dataclass(frozen=True, kw_only=True)
class TexMetrics:
tex_width: int
tex_height: int
tex_depth: int
# work around mypy not respecting kw_only=True in stub files
__match_args__ = ()
class Tfm:
checksum: int
design_size: int
def __init__(self, filename: str | os.PathLike) -> None: ...
def get_metrics(self, idx: int) -> TexMetrics | None: ...
@property
def width(self) -> dict[int, int]: ...
@property
def height(self) -> dict[int, int]: ...
@property
def depth(self) -> dict[int, int]: ...
class TtfMetrics:
def __init__(self, filename: str | os.PathLike) -> None: ...
def get_metrics(self, idx: int) -> TexMetrics: ...
class PsFont(NamedTuple):
texname: bytes
psname: bytes
effects: dict[str, float]
encoding: None | bytes
filename: str
class PsfontsMap:
def __new__(cls, filename: str | os.PathLike) -> Self: ...
def __getitem__(self, texname: bytes) -> PsFont: ...
def find_tex_file(filename: str | os.PathLike) -> str: ...