Retrieve old font '/W' and '/DW' values.
(xref)
| 5177 | font_buffers = {} |
| 5178 | |
| 5179 | def get_old_widths(xref): |
| 5180 | """Retrieve old font '/W' and '/DW' values.""" |
| 5181 | df = doc.xref_get_key(xref, "DescendantFonts") |
| 5182 | if df[0] != "array": # only handle xref specifications |
| 5183 | return None, None |
| 5184 | df_xref = int(df[1][1:-1].replace("0 R", "")) |
| 5185 | widths = doc.xref_get_key(df_xref, "W") |
| 5186 | if widths[0] != "array": # no widths key found |
| 5187 | widths = None |
| 5188 | else: |
| 5189 | widths = widths[1] |
| 5190 | dwidths = doc.xref_get_key(df_xref, "DW") |
| 5191 | if dwidths[0] != "int": |
| 5192 | dwidths = None |
| 5193 | else: |
| 5194 | dwidths = dwidths[1] |
| 5195 | return widths, dwidths |
| 5196 | |
| 5197 | def set_old_widths(xref, widths, dwidths): |
| 5198 | """Restore the old '/W' and '/DW' in subsetted font. |
no test coverage detected
searching dependent graphs…