Repository navigation
Py313 fontconfig non linux - #133
Merged
naveen521kk merged 3 commits intoOct 17, 2026
Merged
Conversation
…ystems _register_font and _unregister_font were only defined when UNAME_SYSNAME is Linux, Windows or Darwin. On FreeBSD and other Unix-like systems none of the IF branches matched, so importing manimpango failed with "ImportError: cannot import name '_register_font'". Those systems use fontconfig like Linux does, so make the fontconfig branch the default for everything except Windows and macOS.
test_fail_just_unregister is skipped on Linux because fontconfig's unregister_font() always returns True, and test_both_fc_and_register_font_are_same only runs on Linux. Both depend on the fontconfig backend, not on Linux itself. That backend is used on every platform except Windows and macOS. On FreeBSD, for example, the first test ran and failed, and the second never ran. Add a FONTCONFIG flag and use it in those two skip conditions. Nothing changes on Linux, Windows or macOS.
naveen521kk
approved these changes
Oct 17, 2026
naveen521kk
left a comment
Member
There was a problem hiding this comment.
LGTM, thanks! I'll do a patch release with these changes later this week.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: use fontconfig font registration on all non-Windows, non-macOS systems
manimpango/_register_font.pyxdefines_register_font/_unregister_fontunder Cython compile-timeIF UNAME_SYSNAME == ...branches forLinux,WindowsandDarwinonly. When building on FreeBSD (and NetBSD, OpenBSD, illumos, ...) none of the branches match, the names are never defined, andimport manimpangofails:These systems use fontconfig exactly like Linux, so this makes the fontconfig branch apply to everything except Windows and macOS. Linux, Windows and macOS builds are unchanged. A second, test-only commit gates the two fontconfig-specific unregister tests on the backend rather than on
linux.Testing
Cython 3.0.12 (the
<3.1pin from pyproject.toml), Python 3.13: cythonized_register_font.pyxwithcompile_time_env={"UNAME_SYSNAME": ...}and listed the module-level names bound in the generated C:_register_font,_unregister_fontset_register_font,_unregister_fontset_fc_register_font/_fc_unregister_font_register_font,_unregister_fontsetFull build of main on FreeBSD 15.1, Python 3.12, 3.13 and 3.14 (pip install from the checkout, pango/cairo/fontconfig from packages):
manimpango.register_font(...)fails with the ImportError aboveregister_font(DejaVuSans.ttf)returns True andlist_fonts()finds itThe second commit is test-only.
test_fail_just_unregisteris skipped on Linux because fontconfig'sunregister_font()always returns True, andtest_both_fc_and_register_font_are_sameruns only on Linux. Both depend on the fontconfig backend rather than on Linux. On FreeBSD the first test ran and failed (3 cases), and the second never ran. The commit adds aFONTCONFIGflag (neither win32 nor darwin) and uses it in those two skip conditions only. Skips are unchanged on Linux, Windows and macOS.With both commits (in-place build) on FreeBSD 15.1,
pytest -q tests -k fontgives 19 passed, 3 skipped (test_fail_just_unregister), 0 failed on Python 3.12, 3.13 and 3.14.Context
Found while testing packages against Python 3.13 for FreeBSD ports (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292105).