| 1 | import fontforge |
| 2 | |
| 3 | def on_new_font(new_font): |
| 4 | new_font.createChar(-1, "dummy_char") |
| 5 | |
| 6 | fontforge.hooks["newFontHook"] = on_new_font |
| 7 | |
| 8 | # Create a new font. We expect to find the dummy character which was created |
| 9 | # by the hook. |
| 10 | font = fontforge.font() |
| 11 | char_idx = font.findEncodingSlot("dummy_char") |
| 12 | assert char_idx != -1 |