Retrieve old font '/W' and '/DW' values.
(xref)
| 7477 | font_buffers = {} |
| 7478 | |
| 7479 | def get_old_widths(xref): |
| 7480 | """Retrieve old font '/W' and '/DW' values.""" |
| 7481 | df = doc.xref_get_key(xref, "DescendantFonts") |
| 7482 | if df[0] != "array": # only handle xref specifications |
| 7483 | return None, None |
| 7484 | df_xref = int(df[1][1:-1].replace("0 R", "")) |
| 7485 | widths = doc.xref_get_key(df_xref, "W") |
| 7486 | if widths[0] != "array": # no widths key found |
| 7487 | widths = None |
| 7488 | else: |
| 7489 | widths = widths[1] |
| 7490 | dwidths = doc.xref_get_key(df_xref, "DW") |
| 7491 | if dwidths[0] != "int": |
| 7492 | dwidths = None |
| 7493 | else: |
| 7494 | dwidths = dwidths[1] |
| 7495 | return widths, dwidths |
| 7496 | |
| 7497 | def set_old_widths(xref, widths, dwidths): |
| 7498 | """Restore the old '/W' and '/DW' in subsetted font. |
nothing calls this directly
no test coverage detected