Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1a639e2

Browse filesBrowse files
authored
Merge pull request #20165 from anntzer/dvidebug
Slightly improve output of dvi debug utilities, and tiny cleanups.
2 parents 84e0fab + 3fb9d07 commit 1a639e2
Copy full SHA for 1a639e2

File tree

Expand file treeCollapse file tree

1 file changed

+12
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-7
lines changed

‎lib/matplotlib/dviread.py

Copy file name to clipboardExpand all lines: lib/matplotlib/dviread.py
+12-7Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ def _output(self):
260260
for elt in self.text + self.boxes:
261261
if isinstance(elt, Box):
262262
x, y, h, w = elt
263-
e = 0 # zero depth
264-
else: # glyph
263+
e = 0 # zero depth
264+
else: # glyph
265265
x, y, font, g, w = elt
266266
h, e = font._height_depth_of(g)
267267
minx = min(minx, x)
@@ -1053,14 +1053,19 @@ def _fontfile(cls, suffix, texname):
10531053
with Dvi(args.filename, args.dpi) as dvi:
10541054
fontmap = PsfontsMap(find_tex_file('pdftex.map'))
10551055
for page in dvi:
1056-
print('=== new page ===')
1056+
print(f"=== new page === "
1057+
f"(w: {page.width}, h: {page.height}, d: {page.descent})")
10571058
for font, group in itertools.groupby(
10581059
page.text, lambda text: text.font):
1059-
print('font', font.texname, 'scaled', font._scale / 2 ** 20)
1060+
print(f"font: {font.texname.decode('latin-1')!r}\t"
1061+
f"scale: {font._scale / 2 ** 20}")
1062+
print("x", "y", "glyph", "chr", "w", "(glyphs)", sep="\t")
10601063
for text in group:
10611064
print(text.x, text.y, text.glyph,
10621065
chr(text.glyph) if chr(text.glyph).isprintable()
10631066
else ".",
1064-
text.width)
1065-
for x, y, w, h in page.boxes:
1066-
print(x, y, 'BOX', w, h)
1067+
text.width, sep="\t")
1068+
if page.boxes:
1069+
print("x", "y", "w", "h", "", "(boxes)", sep="\t")
1070+
for x, y, w, h in page.boxes:
1071+
print(x, y, w, h, sep="\t")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.