Skip to content

Simplify/improve error reporting from ft2font. #30102

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented May 24, 2025

Provide a simple macro to call a FreeType function and throw an exception if an error is returned, while also including the source file and line location for the error. For example, trying FT2Font(open("pyproject.toml", "rb")) now raises "FT_Open_Face (ft2font.cpp line 220) failed with error 0x02: unknown file format" instead of "Can not load face (unknown file format; error code 0x2)".

cf. discussion starting at #30059 (comment).

PR summary

PR checklist

Provide a simple macro to call a FreeType function and throw
an exception if an error is returned, while also including the
source file and line location for the error.  For example, trying
`FT2Font(open("pyproject.toml", "rb"))` now raises "FT_Open_Face
(ft2font.cpp line 220) failed with error 0x2: unknown file format"
instead of "Can not load face (unknown file format; error code 0x2)"
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.

1 participant