Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 2 commits intomatplotlib:mainfromanntzer:texmetrics
Apr 1, 2025

Conversation

anntzer
Copy link
Contributor

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

def __init__(self, filename: str | os.PathLike) -> None: ...
def get_metrics(self, int) -> TexMetrics | None: ...
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
defget_metrics(self,int)->TexMetrics|None: ...
defget_metrics(self,idx:int)->TexMetrics|None: ...

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

thanks, fixed

@anntzeranntzerforce-pushed thetexmetrics branch 2 times, most recently fromb09d728 to3f2c7ddCompareMarch 31, 2025 11:13
@tacaswelltacaswell added this to thev3.11.0 milestoneMar 31, 2025
Copy link
Member

@dstansbydstansby left a 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

@anntzer
Copy link
ContributorAuthor

sure, done

Instead of directly exposing widths, heights, depths dicts, provide aget_metrics method to access a glyph's (tex) metrics.  This change is inpreparation for {xe,lua}tex support, which would use an alternativemetrics-loading class (`TtfMetrics`) where it would be excessive to loadthe metrics of all glyphs at once.
@anntzer
Copy link
ContributorAuthor

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 :)

@tacaswell
Copy link
Member

Pushed a commit that fixes it locally.

Look like this is a limitation in stubtests that does not correctly handle thekw_only=True functionality as__match_args__ is how dataclasses do some of their arg parsing in__init__.

@dstansby
Copy link
Member

Looks like it's related to (but not the same as) the fixedpython/mypy#15749. Might be worth a minimal reproducer and a issue report upstream in mypy?

@dstansby
Copy link
Member

I've got a minimal reproducer, will post an issue upstream

@anntzer
Copy link
ContributorAuthor

Thanks :)

@tacaswelltacaswell merged commit002661c intomatplotlib:mainApr 1, 2025
41 checks passed
@tacaswell
Copy link
Member

thank you@dstansby !

@anntzeranntzer deleted the texmetrics branchApril 1, 2025 05:40
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.11.0
Development

Successfully merging this pull request may close these issues.

4 participants
@anntzer@tacaswell@dstansby@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp