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

Method kern

lib/matplotlib/_mathtext.py:1340–1355  ·  view source on GitHub ↗

Insert `Kern` nodes between `Char` nodes to set kerning. The `Char` nodes themselves determine the amount of kerning they need (in `~Char.get_kerning`), and this function just creates the correct linked list.

(self)

Source from the content-addressed store, hash-verified

1338 return all(map(lambda node: node.is_char_node(), self.children))
1339
1340 def kern(self) -> None:
1341 """
1342 Insert `Kern` nodes between `Char` nodes to set kerning.
1343
1344 The `Char` nodes themselves determine the amount of kerning they need
1345 (in `~Char.get_kerning`), and this function just creates the correct
1346 linked list.
1347 """
1348 new_children = []
1349 for elem0, elem1 in itertools.zip_longest(self.children, self.children[1:]):
1350 new_children.append(elem0)
1351 kerning_distance = elem0.get_kerning(elem1)
1352 if kerning_distance != 0.:
1353 kern = Kern(kerning_distance)
1354 new_children.append(kern)
1355 self.children = new_children
1356
1357 def hpack(self, w: float = 0.0,
1358 m: T.Literal['additional', 'exactly'] = 'additional') -> None:

Callers 2

__init__Method · 0.95
subsuperMethod · 0.95

Calls 2

KernClass · 0.85
get_kerningMethod · 0.45

Tested by

no test coverage detected