8000 update coords for hrule rendering · matplotlib/matplotlib@939a332 · GitHub
[go: up one dir, main page]

Skip to content

Commit 939a332

Browse files
committed
update coords for hrule rendering
1 parent c0d9c98 commit 939a332

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/matplotlib/_mathtext.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,20 @@ def __init__(self, box):
9292
self.rects = [] # (x1, y1, x2, y2)
9393

9494
def to_vector(self):
95-
w, h, d = map(
96-
np.ceil, [self.box.width, self.box.height, self.box.depth])
95+
96+
xmin = min([*[ox + info.metrics.xmin for ox, oy, info in self.glyphs],
97+
*[x1 for x1, y1, x2, y2 in self.rects], 0]) - 1
98+
ymin = min([*[oy - info.metrics.ymax for ox, oy, info in self.glyphs],
99+
*[y1 for x1, y1, x2, y2 in self.rects], 0]) - 1
100+
xmax = max([*[ox + info.metrics.xmax for ox, oy, info in self.glyphs],
101+
*[x2 for x1, y1, x2, y2 in self.rects], 0]) + 1
102+
ymax = max([*[oy - info.metrics.ymin for ox, oy, info in self.glyphs],
103+
*[y2 for x1, y1, x2, y2 in self.rects], 0]) + 1
104+
105+
w = xmax - xmin
106+
h = ymax - ymin - self.box.depth
107+
d = ymax - ymin - self.box.height
108+
97109
gs = [(info.font, info.fontsize, info.num, ox, h - oy + info.offset)
98110
for ox, oy, info in self.glyphs]
99111
rs = [(x1, h - y2, x2 - x1, y2 - y1)

0 commit comments

Comments
 (0)
0