GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Improve output of dvi debug parsing. by anntzer · Pull Request #29828 · matplotlib/matplotlib

Conversation

@anntzer

@anntzer anntzer commented Mar 29, 2025

Copy link
Copy Markdown
Contributor

Again, mostly maintenance work in preparation for #29807.

To test, run e.g.

from pylab import *
set_loglevel("debug")
figtext(.5, .5, r"gff\textwon$\frac12$", usetex=True)
show()

Grab the path of the dvi file that appears last in the log, then run

python -mmatplotlib.dviread /path/to/dvi

Prior to this patch, the output was

=== new page === (w: 1668654, h: 553676, d: 225994)
font: 'cmss10'	scale: 0.625
x	y	glyph	chr	w	(glyphs)
983040	1441792	103	g	327681
1310721	1441792	11	.	382295
font: 'tcss1000'	scale: 0.625
x	y	glyph	chr	w	(glyphs)
1693016	1441792	142	.	618800
font: 'cmr7'	scale: 0.4375
x	y	glyph	chr	w	(glyphs)
2390459	1183756	49	1	261235
2390459	1667786	50	2	261235
x	y	h	w		(boxes)
2390459	1291058	26213	261235

With this patch, the output is

=== NEW PAGE === (w: 1668654, h: 553676, d: 225994)
--- GLYPHS ---
font: cmss10 (scale: 0.625) at /usr/local/texlive/2025/texmf-dist/fonts/type1/public/amsfonts/cm/cmss10.pfb
          x           y       glyph         chr           w
     983040     1441792         103           g      327681
    1310721     1441792          11           ff      382295
font: tcss1000 (scale: 0.625) at /usr/local/texlive/2025/texmf-dist/fonts/type1/public/cm-super/sfss1000.pfb
          x           y       glyph         chr           w
    1693016     1441792         142           ₩      618800
font: cmr7 (scale: 0.4375) at /usr/local/texlive/2025/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb
          x           y       glyph         chr           w
    2390459     1183756          49           1      261235
    2390459     1667786          50           2      261235
--- BOXES ---
          x           y           h           w
    2390459     1291058       26213      261235

Most importantly, glyphs are now resolved to their unicode representation (essentially by resolving the glyph name, similarly to the process described in Text.glyph_name_or_index), whereas many complex glyphs were just output as "." before. Furthermore, full font paths are printed, and the output is slightly better aligned.

These improvements will be more significant with the future support for {xe,lua}tex, which can load a much wider variety of glyphs.

PR summary

PR checklist

  • "closes #0000" is in the body of the PR description to link the related issue
  • new and changed code is tested
  • Plotting related features are demonstrated in an example
  • New Features and API Changes are noted with a directive and release note
  • Documentation complies with general and docstring guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@anntzer
Improve output of dvi debug parsing.
829dcaa
To test, run e.g.
```python
from pylab import *
set_loglevel("debug")
figtext(.5, .5, r"gff\textwon$\frac12$", usetex=True)
show()
```
Grab the path of the dvi file that appears last in the log, then run
```bash
python -mmatplotlib.dviread /path/to/dvi
```

Prior to this patch, the output was
```
=== new page === (w: 1668654, h: 553676, d: 225994)
font: 'cmss10'	scale: 0.625
x	y	glyph	chr	w	(glyphs)
983040	1441792	103	g	327681
1310721	1441792	11	.	382295
font: 'tcss1000'	scale: 0.625
x	y	glyph	chr	w	(glyphs)
1693016	1441792	142	.	618800
font: 'cmr7'	scale: 0.4375
x	y	glyph	chr	w	(glyphs)
2390459	1183756	49	1	261235
2390459	1667786	50	2	261235
x	y	h	w		(boxes)
2390459	1291058	26213	261235
```

With this patch, the output is
```
=== NEW PAGE === (w: 1668654, h: 553676, d: 225994)
--- GLYPHS ---
font: cmss10 (scale: 0.625) at /usr/local/texlive/2025/texmf-dist/fonts/type1/public/amsfonts/cm/cmss10.pfb
          x           y       glyph         chr           w
     983040     1441792         103           g      327681
    1310721     1441792          11           ff      382295
font: tcss1000 (scale: 0.625) at /usr/local/texlive/2025/texmf-dist/fonts/type1/public/cm-super/sfss1000.pfb
          x           y       glyph         chr           w
    1693016     1441792         142           ₩      618800
font: cmr7 (scale: 0.4375) at /usr/local/texlive/2025/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb
          x           y       glyph         chr           w
    2390459     1183756          49           1      261235
    2390459     1667786          50           2      261235
--- BOXES ---
          x           y           h           w
    2390459     1291058       26213      261235
```

Most importantly, glyphs are now resolved to their unicode
representation (essentially by resolving the glyph name, similarly to
the process described in Text.glyph_name_or_index), whereas many complex
glyphs were just output as "." before.  Furthermore, full font paths are
printed, and the output is slightly better aligned.

These improvements will be more significant with the future support for
{xe,lua}tex, which can load a much wider variety of glyphs.
@anntzer anntzer added the topic: text/usetex label Mar 29, 2025
timhoffm
timhoffm approved these changes Mar 29, 2025
View reviewed changes
@jklymak
jklymak merged commit dc05767 into matplotlib:main Mar 30, 2025
@anntzer
anntzer deleted the dvitype branch March 30, 2025 15:17
@QuLogic QuLogic added this to the v3.11.0 milestone Mar 31, 2025
@anntzer anntzer mentioned this pull request Apr 1, 2025
Multivariate plotting in imshow, pcolor and pcolormesh #29221
Closed
2 of 5 tasks
@QuLogic QuLogic added this to Font and text overhaul Jun 5, 2025
@QuLogic QuLogic moved this to Done in Font and text overhaul Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@timhoffm timhoffm timhoffm approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic: text/usetex

Projects

Font and text overhaul
Status: Done

Milestone

v3.11.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@anntzer @timhoffm @QuLogic @jklymak
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.