Skip to content
Merged
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
3 changes: 2 additions & 1 deletion manimpango/_register_font.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ cpdef bint _fc_unregister_font(set registered_fonts, str font_path):
return True


IF UNAME_SYSNAME == "Linux":
# Linux, the BSDs and other Unix-like systems use fontconfig directly.
IF UNAME_SYSNAME != "Windows" and UNAME_SYSNAME != "Darwin":
_register_font = _fc_register_font
_unregister_font = _fc_unregister_font

Expand Down
11 changes: 5 additions & 6 deletions tests/test_fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
from . import FONT_DIR
from ._manim import MarkupText

# Platforms other than Windows and macOS register fonts through fontconfig.
FONTCONFIG = not sys.platform.startswith(("win32", "darwin"))


@contextmanager
def register_font(font_file: Path):
Expand Down Expand Up @@ -92,9 +95,7 @@ def test_warning(font_file, font_name):
assert "Pango-WARNING **" not in captured, "Looks like Pango raised a warning?"


@pytest.mark.skipif(
sys.platform.startswith("linux"), reason="unsupported api for linux"
)
@pytest.mark.skipif(FONTCONFIG, reason="unsupported api for fontconfig")
@pytest.mark.parametrize("font_name", font_lists_dict)
@pytest.mark.skipif(sys.platform.startswith("darwin"), reason="always returns true")
def test_fail_just_unregister(font_name):
Expand Down Expand Up @@ -128,9 +129,7 @@ def test_simple_fonts_render(tmpdir):
assert Path(filename).exists()


@pytest.mark.skipif(
not sys.platform.startswith("linux"), reason="unsupported api other than linux"
)
@pytest.mark.skipif(not FONTCONFIG, reason="unsupported api other than fontconfig")
def test_both_fc_and_register_font_are_same():
assert (
manimpango._register_font._fc_register_font
Expand Down
Loading