Ejemplo n.º 1
0
def _hatch_primitives(
        hatch: 'Hatch', max_flattening_distance=None) -> Iterable[Primitive]:
    """ Yield all HATCH boundary paths as separated Path() objects. """
    for p in from_hatch(hatch):
        yield PathPrimitive(
            p,
            hatch,
            max_flattening_distance
        )
Ejemplo n.º 2
0
 def test_total_length_for_fit_alignment(self, ff):
     length = 3
     hatches = text2path.make_hatches_from_str(
         "XXX", font=ff, align="FIT", length=length)
     paths = []
     for hatch in hatches:
         paths.extend(path.from_hatch(hatch))
     bbox = path.bbox(paths)
     assert bbox.size.x == pytest.approx(length), "expect exact length"
     assert bbox.size.y == pytest.approx(1.0), \
         "text height should be unscaled"