(annot, ncol, col, fontname, fontsize)
| 20476 | |
| 20477 | |
| 20478 | def JM_make_annot_DA(annot, ncol, col, fontname, fontsize): |
| 20479 | # PyMuPDF uses a fz_buffer to build up the string, but it's non-trivial to |
| 20480 | # convert the fz_buffer's `unsigned char*` into a `const char*` suitable |
| 20481 | # for passing to pdf_dict_put_text_string(). So instead we build up the |
| 20482 | # string directly in Python. |
| 20483 | buf = '' |
| 20484 | if ncol < 1: |
| 20485 | buf += f'0 g ' |
| 20486 | elif ncol == 1: |
| 20487 | buf += f'{col[0]:g} g ' |
| 20488 | elif ncol == 2: |
| 20489 | assert 0 |
| 20490 | elif ncol == 3: |
| 20491 | buf += f'{col[0]:g} {col[1]:g} {col[2]:g} rg ' |
| 20492 | else: |
| 20493 | buf += f'{col[0]:g} {col[1]:g} {col[2]:g} {col[3]:g} k ' |
| 20494 | buf += f'/{JM_expand_fname(fontname)} {fontsize} Tf' |
| 20495 | mupdf.pdf_dict_put_text_string(mupdf.pdf_annot_obj(annot), mupdf.PDF_ENUM_NAME_DA, buf) |
| 20496 | |
| 20497 | |
| 20498 | def JM_make_spanlist(line_dict, line, raw, buff, tp_rect): |
no test coverage detected
searching dependent graphs…