-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Switch Tfm metrics to TrueType-compatible API. #29838
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
Conversation
lib/matplotlib/dviread.pyi
Outdated
def __init__(self, filename: str | os.PathLike) -> None: ... | ||
def get_metrics(self, int) -> TexMetrics | None: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def get_metrics(self, int) -> TexMetrics | None: ... | |
def get_metrics(self, idx: int) -> TexMetrics | None: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, fixed
b09d728
to
3f2c7dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one suggestion to make the dataclass keyword argument only
sure, done |
Instead of directly exposing widths, heights, depths dicts, provide a get_metrics method to access a glyph's (tex) metrics. This change is in preparation for {xe,lua}tex support, which would use an alternative metrics-loading class (`TtfMetrics`) where it would be excessive to load the metrics of all glyphs at once.
I'm a bit at loss as to how to placate mypy here, so if someone who actually uses typing could have a look, this would be very helpful :) |
Pushed a commit that fixes it locally. Look like this is a limitation in stubtests that does not correctly handle the |
Looks like it's related to (but not the same as) the fixed python/mypy#15749. Might be worth a minimal reproducer and a issue report upstream in mypy? |
I've got a minimal reproducer, will post an issue upstream |
Thanks :) |
thank you @dstansby ! |
Another small preparatory PR for #29807 ({xe,lua}tex support).
Instead of directly exposing widths, heights, depths dicts, provide a get_metrics method to access a glyph's (tex) metrics. This change is in preparation for {xe,lua}tex support, which would use an alternative metrics-loading class (
TtfMetrics
) where it would be excessive to load the metrics of all glyphs at once.PR summary
PR checklist