Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fontbro/font.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import tempfile
from collections import Counter
from collections.abc import Generator
from curses import ascii
from io import BytesIO
from pathlib import Path
from typing import IO, Any, cast
Expand Down Expand Up @@ -36,6 +35,7 @@
from fontbro.utils import (
concat_names,
find_item,
is_control_character,
read_json,
remove_spaces,
slugify,
Expand Down Expand Up @@ -509,7 +509,7 @@ def get_characters(
char = chr(code)
else:
continue
if ascii.iscntrl(char):
if is_control_character(char):
continue
if glyfs and ignore_blank:
glyf = glyfs.get(char_name)
Expand Down
6 changes: 6 additions & 0 deletions fontbro/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ def slugify(
s = re.sub(r"[^\w\-]", "", s)
s = s.strip("-")
return s.lower().strip().replace(" ", "-")


def is_control_character(
char: str,
) -> bool:
return ord(char) < 0x20 or ord(char) == 0x7F