| 506 | self.fontsize = fontsize |
| 507 | |
| 508 | def create_hatch(self, hatch, linewidth): |
| 509 | sidelen = 72 |
| 510 | if hatch in self._hatches: |
| 511 | return self._hatches[hatch] |
| 512 | name = 'H%d' % len(self._hatches) |
| 513 | pageheight = self.height * 72 |
| 514 | self._pswriter.write(f"""\ |
| 515 | << /PatternType 1 |
| 516 | /PaintType 2 |
| 517 | /TilingType 2 |
| 518 | /BBox[0 0 {sidelen:d} {sidelen:d}] |
| 519 | /XStep {sidelen:d} |
| 520 | /YStep {sidelen:d} |
| 521 | |
| 522 | /PaintProc {{ |
| 523 | pop |
| 524 | {linewidth:g} setlinewidth |
| 525 | {self._convert_path(Path.hatch(hatch), Affine2D().scale(sidelen), simplify=False)} |
| 526 | gsave |
| 527 | fill |
| 528 | grestore |
| 529 | stroke |
| 530 | }} bind |
| 531 | >> |
| 532 | matrix |
| 533 | 0 {pageheight:g} translate |
| 534 | makepattern |
| 535 | /{name} exch def |
| 536 | """) |
| 537 | self._hatches[hatch] = name |
| 538 | return name |
| 539 | |
| 540 | def get_image_magnification(self): |
| 541 | """ |