Skip to content

Parse FontBBox in type1font. #30088

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
May 30, 2025
Merged

Parse FontBBox in type1font. #30088

merged 1 commit into from
May 30, 2025

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented May 20, 2025

... instead of having to go through ft2font in createType1Descriptor just to extract the font bbox, ascender and descender.

FontBBox is gauranteed to exist in the type1 font definition by the standard; its parsing as a size-4 array matches freetype's behavior (see ps_parser_load_field); and using bbox entries as ascender and descender also matches freetype's behavior (T1_Face_Init directly assigns root->ascender = (FT_Short)(root->bbox.yMax) and likewise for the descender; see also the docs for ascender and descender in FT_FaceRec).

PR summary

PR checklist

... instead of having to go through ft2font in createType1Descriptor
just to extract the font bbox, ascender and descender.

FontBBox is gauranteed to exist in the type1 font definition by the
standard; its parsing as a size-4 array matches freetype's behavior (see
ps_parser_load_field); and using bbox entries as ascender and descender
also matches freetype's behavior (T1_Face_Init directly assigns
`root->ascender = (FT_Short)(root->bbox.yMax)` and likewise for the
descender; see also the docs for ascender and descender in FT_FaceRec).
@QuLogic QuLogic added this to the v3.11.0 milestone May 30, 2025
@QuLogic QuLogic merged commit 3623a1a into matplotlib:main May 30, 2025
40 checks passed
@anntzer anntzer deleted the t1bb branch May 30, 2025 05:29
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