Set text alignment via CSS style
(self, align)
| 2472 | return Xml( mupdf.fz_xml_root( self.this)) |
| 2473 | |
| 2474 | def set_align(self, align): |
| 2475 | """Set text alignment via CSS style""" |
| 2476 | if isinstance( align, str): |
| 2477 | t = align |
| 2478 | elif align == TEXT_ALIGN_LEFT: |
| 2479 | t = "left" |
| 2480 | elif align == TEXT_ALIGN_CENTER: |
| 2481 | t = "center" |
| 2482 | elif align == TEXT_ALIGN_RIGHT: |
| 2483 | t = "right" |
| 2484 | elif align == TEXT_ALIGN_JUSTIFY: |
| 2485 | t = "justify" |
| 2486 | else: |
| 2487 | raise ValueError(f"Unrecognised {align=}") |
| 2488 | self.add_style(f"text-align: {t}") |
| 2489 | return self |
| 2490 | |
| 2491 | def set_attribute( self, key, value): |
| 2492 | assert key |
no test coverage detected