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)
| 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: |
no test coverage detected