Skip to content

Commit b65d493

Browse files
committed
Always use the actual x-height instead of what the font tells us. [skip ci]
1 parent cbe90a1 commit b65d493

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lib/matplotlib/_mathtext.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,10 @@ def _get_info(self, fontname, font_class, sym, fontsize, dpi):
249249
)
250250

251251
def get_xheight(self, fontname, fontsize, dpi):
252-
font = self._get_font(fontname)
253-
font.set_size(fontsize, dpi)
254-
pclt = font.get_sfnt_table('pclt')
255-
if pclt is None:
256-
# Some fonts don't store the xHeight, so we do a poor man's xHeight
257-
metrics = self.get_metrics(
258-
fontname, mpl.rcParams['mathtext.default'], 'x', fontsize, dpi)
259-
return metrics.iceberg
260-
xHeight = (pclt['xHeight'] / 64.0) * (fontsize / 12.0) * (dpi / 100.0)
261-
return xHeight
252+
# Some fonts report the wrong x-height, so we do a poor man's x-height.
253+
metrics = self.get_metrics(
254+
fontname, mpl.rcParams['mathtext.default'], 'x', fontsize, dpi)
255+
return metrics.iceberg
262256

263257
def get_underline_thickness(self, font, fontsize, dpi):
264258
# This function used to grab underline thickness from the font

0 commit comments

Comments
 (0)