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

Ensure text metric calculation always uses the text cache#29907

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 1 commit intomatplotlib:mainfromQuLogic:text-caching
Apr 13, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletionslib/matplotlib/offsetbox.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -794,9 +794,10 @@ def get_offset(self):
return self._offset

def get_bbox(self, renderer):
_, h_, d_ = renderer.get_text_width_height_descent(
"lp", self._text._fontproperties,
ismath="TeX" if self._text.get_usetex() else False)
_, h_, d_ = mtext._get_text_metrics_with_cache(
renderer, "lp", self._text._fontproperties,
ismath="TeX" if self._text.get_usetex() else False,
dpi=self.get_figure(root=True).dpi)

bbox, info, yd = self._text._get_layout(renderer)
w, h = bbox.size
Expand Down
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletionslib/matplotlib/text.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -694,10 +694,10 @@ def _get_rendered_text_width(self, text):
Return the width of a given text string, in pixels.
"""

w, h, d =self._renderer.get_text_width_height_descent(
text,
self.get_fontproperties(),
cbook.is_math_text(text))
w, h, d =_get_text_metrics_with_cache(
self._renderer,text, self.get_fontproperties(),
cbook.is_math_text(text),
self.get_figure(root=True).dpi)
return math.ceil(w)

def _get_wrapped_text(self):
Expand Down
5 changes: 3 additions & 2 deletionslib/mpl_toolkits/axisartist/axis_artist.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -588,8 +588,9 @@ def get_texts_widths_heights_descents(self, renderer):
if not label.strip():
continue
clean_line, ismath = self._preprocess_math(label)
whd = renderer.get_text_width_height_descent(
clean_line, self._fontproperties, ismath=ismath)
whd = mtext._get_text_metrics_with_cache(
renderer, clean_line, self._fontproperties, ismath=ismath,
dpi=self.get_figure(root=True).dpi)
whd_list.append(whd)
return whd_list

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp