Restore the old '/W' and '/DW' in subsetted font. If either parameter is None or evaluates to False, the corresponding dictionary key will be set to null.
(xref, widths, dwidths)
| 7495 | return widths, dwidths |
| 7496 | |
| 7497 | def set_old_widths(xref, widths, dwidths): |
| 7498 | """Restore the old '/W' and '/DW' in subsetted font. |
| 7499 | |
| 7500 | If either parameter is None or evaluates to False, the corresponding |
| 7501 | dictionary key will be set to null. |
| 7502 | """ |
| 7503 | df = doc.xref_get_key(xref, "DescendantFonts") |
| 7504 | if df[0] != "array": # only handle xref specs |
| 7505 | return None |
| 7506 | df_xref = int(df[1][1:-1].replace("0 R", "")) |
| 7507 | if (type(widths) is not str or not widths) and doc.xref_get_key(df_xref, "W")[ |
| 7508 | 0 |
| 7509 | ] != "null": |
| 7510 | doc.xref_set_key(df_xref, "W", "null") |
| 7511 | else: |
| 7512 | doc.xref_set_key(df_xref, "W", widths) |
| 7513 | if (type(dwidths) is not str or not dwidths) and doc.xref_get_key( |
| 7514 | df_xref, "DW" |
| 7515 | )[0] != "null": |
| 7516 | doc.xref_set_key(df_xref, "DW", "null") |
| 7517 | else: |
| 7518 | doc.xref_set_key(df_xref, "DW", dwidths) |
| 7519 | return None |
| 7520 | |
| 7521 | def set_subset_fontname(new_xref): |
| 7522 | """Generate a name prefix to tag a font as subset. |
nothing calls this directly
no test coverage detected