8000 ft2font: Avoid undefined enum values by QuLogic · Pull Request #29438 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

ft2font: Avoid undefined enum values #29438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2025
Merged

Conversation

QuLogic
Copy link
Member
@QuLogic QuLogic commented Jan 9, 2025

PR summary

By simply defining them if not available.

This fixes the latter half of #29396 (comment)

PR checklist

@tacaswell
Copy link
Member

Atleast the two GHA failures look like wx installation problems:

E           Failed: Subprocess failed to test intended behavior
314
E           Traceback (most recent call last):
315
E             File "<string>", line 1, in <module>
316
E             File "/home/runner/work/matplotlib/matplotlib/lib/matplotlib/tests/test_backends_interactive.py", line 176, in _test_interactive_impl
317
E               fig = plt.figure()
318
E             File "/home/runner/work/matplotlib/matplotlib/lib/matplotlib/pyplot.py", line 1045, in figure
319
E               manager = new_figure_manager(
320
E             File "/home/runner/work/matplotlib/matplotlib/lib/matplotlib/pyplot.py", line 555, in new_figure_manager
321
E               _warn_if_gui_out_of_main_thread()
322
E             File "/home/runner/work/matplotlib/matplotlib/lib/matplotlib/pyplot.py", line 532, in _warn_if_gui_out_of_main_thread
323
E               canvas_class = cast(type[FigureCanvasBase], _get_backend_mod().FigureCanvas)
324
E             File "/home/runner/work/matplotlib/matplotlib/lib/matplotlib/pyplot.py", line 369, in _get_backend_mod
325
E               switch_backend(rcParams._get("backend"))
326
E             File "/home/runner/work/matplotlib/matplotlib/lib/matplotlib/pyplot.py", line 425, in switch_backend
327
E               module = backend_registry.load_backend_module(newbackend)
328
E             File "/home/runner/work/matplotlib/matplotlib/lib/matplotlib/backends/registry.py", line 317, in load_backend_module
329
E               return importlib.import_module(module_name)
330
E             File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/importlib/__init__.py", line 126, in import_module
331
E               return _bootstrap._gcd_import(name[level:], package, level)
332
E             File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
333
E             File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
334
E             File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
335
E             File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
336
E             File "<frozen importlib._bootstrap_external>", line 883, in exec_module
337
E             File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
338
E             File "/home/runner/work/matplotlib/matplotlib/lib/matplotlib/backends/backend_wxagg.py", line 1, in <module>
339
E               import wx
340
E             File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/wx/__init__.py", line 17, in <module>
341
E               from wx.core import *
342
E             File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/wx/core.py", line 12, in <module>
343
E               from ._core import *
344
E           ImportError: libnotify.so.4: cannot open shared object file: No such file or directory
345

346
lib/matplotlib/tests/test_backends_interactive.py:258: Failed

@tacaswell tacaswell added this to the v3.11.0 milestone Jan 9, 2025
@tacaswell
Copy link
Member

Does this open a path to users passing invalid flags through and having older versions of freetype error out?

By simply defining them if not available.
@QuLogic
Copy link
Member Author
QuLogic commented Jan 11, 2025

FaceFlags is only readable from FT2Font.face_flags, so not in that case. LoadFlags could be passed to FT2Font.set_text, FT2Font.load_char, and FT2Font.load_glyph. We don't expose them at a higher layer than that though.

I tried to run font.set_text('ABC', flags=LoadFlags.NO_SVG|LoadFlags.BITMAP_METRICS_ONLY) with the bundled (2.6.1) FreeType, and it just seemed to ignore it.

@timhoffm timhoffm merged commit 4943b99 into matplotlib:main Jan 13, 2025
40 checks passed
@QuLogic QuLogic deleted the ft2font-enums branch January 13, 2025 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0