Skip to content

Commit

Permalink
Don't crash on non-existant subsets
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Jan 22, 2024
1 parent 87c5a04 commit cd18008
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Lib/gfsubsets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import contextlib
import re
import sys
import warnings
from importlib import resources
from fontTools import ttLib

Expand All @@ -25,6 +26,9 @@ def __getitem__(self, subset):
def read_namfile(self, subset):
cps = set()
ref = nam_files.joinpath(subset + "_unique-glyphs.nam")
if not ref.is_file():
warnings.warn(f"No such subset '{subset}'")
return cps
with ref.open("r", encoding="utf-8") as f:
for line in f:
if line.startswith("#"):
Expand Down

0 comments on commit cd18008

Please sign in to comment.