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

Function vlist_out

lib/matplotlib/_mathtext.py:1800–1857  ·  view source on GitHub ↗
(box: Vlist)

Source from the content-addressed store, hash-verified

1798 phantom.pop()
1799
1800 def vlist_out(box: Vlist) -> None:
1801 nonlocal cur_v, cur_h
1802
1803 cur_g = 0
1804 cur_glue = 0.
1805 glue_order = box.glue_order
1806 glue_sign = box.glue_sign
1807 left_edge = cur_h
1808 cur_v -= box.height
1809 top_edge = cur_v
1810
1811 for p in box.children:
1812 if isinstance(p, Kern):
1813 cur_v += p.width
1814 elif isinstance(p, List):
1815 if len(p.children) == 0:
1816 cur_v += p.height + p.depth
1817 else:
1818 cur_v += p.height
1819 cur_h = left_edge + p.shift_amount
1820 save_v = cur_v
1821 p.width = box.width
1822 if isinstance(p, Hlist):
1823 hlist_out(p)
1824 elif isinstance(p, Vlist):
1825 vlist_out(p)
1826 else:
1827 assert False, "unreachable code"
1828 cur_v = save_v + p.depth
1829 cur_h = left_edge
1830 elif isinstance(p, Box):
1831 rule_height = p.height
1832 rule_depth = p.depth
1833 rule_width = p.width
1834 if np.isinf(rule_width):
1835 rule_width = box.width
1836 rule_height += rule_depth
1837 if rule_height > 0 and rule_depth > 0:
1838 cur_v += rule_height
1839 render(p, output,
1840 cur_h + off_h, cur_v + off_v,
1841 rule_width, rule_height)
1842 elif isinstance(p, Glue):
1843 glue_spec = p.glue_spec
1844 rule_height = glue_spec.width - cur_g
1845 if glue_sign != 0: # normal
1846 if glue_sign == 1: # stretching
1847 if glue_spec.stretch_order == glue_order:
1848 cur_glue += glue_spec.stretch
1849 cur_g = round(clamp(box.glue_set * cur_glue))
1850 elif glue_spec.shrink_order == glue_order: # shrinking
1851 cur_glue += glue_spec.shrink
1852 cur_g = round(clamp(box.glue_set * cur_glue))
1853 rule_height += cur_g
1854 cur_v += rule_height
1855 elif isinstance(p, Char):
1856 raise RuntimeError(
1857 "Internal mathtext error: Char node found in vlist")

Callers 1

hlist_outFunction · 0.85

Calls 3

hlist_outFunction · 0.85
renderFunction · 0.85
clampFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…