8000 Fix width/height inversion in dviread debug helper. by anntzer · Pull Request #23087 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix width/height inversion in dviread debug helper. #23087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2022

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented May 21, 2022

python -mmatplotlib.dviread is useful to verify how matplotlib parses
dvi constructs, but the output inverted the width and height of boxes.

PR Summary

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

`python -mmatplotlib.dviread` is useful to verify how matplotlib parses
dvi constructs, but the output inverted the width and height of boxes.
Copy link
Member
@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't claim to understand anything of dvi.

This currently prints a list and the header ("w", "h") is consistent with the content. However I agree that it's inverse to the definition in boxes. So the question is: Are these boxes and their order a known concept? If they are only an implementation detail, I would not change this. The order (width, height) is more common and we need a good reason to not use that for display.

@anntzer
Copy link
Contributor Author
anntzer commented May 21, 2022

Right now the main problem is that the headers ("w", "h") don't match the contents, because the unpack (for x, y, w, h in box:) is incorrect: it should be for x, y, h, w in box: -- but we may just as well used named fields instead to avoid any such confusion.

As for whether to print width or height first, it's probably not a huge deal either way but note that dvi specifies the height of boxes first (https://tug.org/TUGboat/Articles/tb03-2/tb06software.pdf opcode 132 set_rule).

Copy link < 8000 div aria-live="polite" aria-atomic="true" class="sr-only" data-clipboard-copy-feedback>
Member
@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation.

@oscargus oscargus merged commit b5fc36e into matplotlib:main May 22, 2022
@anntzer anntzer deleted the dviwh branch May 22, 2022 12:33
@QuLogic QuLogic added this to the v3.6.0 milestone May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0