| 1 |
import fontforge |
| 2 |
import tempfile |
| 3 |
import os |
| 4 |
|
| 5 |
font = fontforge.font() |
| 6 |
|
| 7 |
names = (("English (US)", "Designer", "Hello😀"), |
| 8 |
("Portuguese (Portugal)", "Copyright", "Olá🤠"), |
| 9 |
("French French", "Version", "🎼 Salut")) |
| 10 |
|
| 11 |
font.sfnt_names = names |
| 12 |
|
| 13 |
with tempfile.TemporaryDirectory() as tmpdirname: |
| 14 |
sfd_full_name = os.path.join(tmpdirname, "Test.sfd") |
| 15 |
font.save(sfd_full_name) |
| 16 |
|
| 17 |
|
| 18 |
font.close() |
| 19 |
|
| 20 |
font2 = fontforge.open(sfd_full_name) |
| 21 |
|
| 22 |
|
| 23 |
for name in names: |
| 24 |
assert(name in font2.sfnt_names) |