Using basic text insertion.
()
| 106 | |
| 107 | |
| 108 | def test_textbox5(): |
| 109 | """Using basic text insertion.""" |
| 110 | small_glyph_heights0 = pymupdf.TOOLS.set_small_glyph_heights() |
| 111 | pymupdf.TOOLS.set_small_glyph_heights(True) |
| 112 | try: |
| 113 | doc = pymupdf.open() |
| 114 | page = doc.new_page() |
| 115 | r = pymupdf.Rect(100, 100, 150, 150) |
| 116 | text = "words and words and words and more words..." |
| 117 | rc = -1 |
| 118 | fontsize = 12 |
| 119 | page.draw_rect(r) |
| 120 | while rc < 0: |
| 121 | rc = page.insert_textbox( |
| 122 | r, |
| 123 | text, |
| 124 | fontsize=fontsize, |
| 125 | align=pymupdf.TEXT_ALIGN_JUSTIFY, |
| 126 | ) |
| 127 | fontsize -= 0.5 |
| 128 | |
| 129 | blocks = page.get_text("blocks") |
| 130 | bbox = pymupdf.Rect(blocks[0][:4]) |
| 131 | assert bbox in r |
| 132 | finally: |
| 133 | # Must restore small_glyph_heights, otherwise other tests can fail. |
| 134 | pymupdf.TOOLS.set_small_glyph_heights(small_glyph_heights0) |
| 135 | |
| 136 | |
| 137 | def test_2637(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…