MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / vpack

Method vpack

lib/matplotlib/_mathtext.py:1435–1506  ·  view source on GitHub ↗

Compute the dimensions of the resulting boxes, and to adjust the glue if one of those dimensions is pre-specified. Parameters ---------- h : float, default: 0 A height. m : {'exactly', 'additional'}, default: 'additional' Whet

(self, h: float = 0.0,
              m: T.Literal['additional', 'exactly'] = 'additional',
              l: float = np.inf)

Source from the content-addressed store, hash-verified

1433 return False
1434
1435 def vpack(self, h: float = 0.0,
1436 m: T.Literal['additional', 'exactly'] = 'additional',
1437 l: float = np.inf) -> None:
1438 """
1439 Compute the dimensions of the resulting boxes, and to adjust the glue
1440 if one of those dimensions is pre-specified.
1441
1442 Parameters
1443 ----------
1444 h : float, default: 0
1445 A height.
1446 m : {'exactly', 'additional'}, default: 'additional'
1447 Whether to produce a box whose height is 'exactly' *h*; or a box
1448 with the natural height of the contents, plus *h* ('additional').
1449 l : float, default: np.inf
1450 The maximum height.
1451
1452 Notes
1453 -----
1454 The defaults produce a box with the natural height of the contents.
1455 """
1456 # I don't know why these get reset in TeX. Shift_amount is pretty
1457 # much useless if we do.
1458 # self.shift_amount = 0.
1459 w = 0.
1460 d = 0.
1461 x = 0.
1462 total_stretch = [0.] * 4
1463 total_shrink = [0.] * 4
1464 for p in self.children:
1465 if isinstance(p, Box):
1466 x += d + p.height
1467 d = p.depth
1468 if not np.isinf(p.width):
1469 s = getattr(p, 'shift_amount', 0.)
1470 w = max(w, p.width + s)
1471 elif isinstance(p, Glue):
1472 x += d
1473 d = 0.
1474 glue_spec = p.glue_spec
1475 x += glue_spec.width
1476 total_stretch[glue_spec.stretch_order] += glue_spec.stretch
1477 total_shrink[glue_spec.shrink_order] += glue_spec.shrink
1478 elif isinstance(p, Kern):
1479 x += d + p.width
1480 d = 0.
1481 elif isinstance(p, Char):
1482 raise RuntimeError(
1483 "Internal mathtext error: Char node found in Vlist")
1484
1485 self.width = w
1486 if d > l:
1487 x += d - l
1488 self.depth = l
1489 else:
1490 self.depth = d
1491
1492 if m == 'additional':

Callers 3

__init__Method · 0.95
sqrtMethod · 0.95
overlineMethod · 0.95

Calls 1

_set_glueMethod · 0.80

Tested by

no test coverage detected