Thanks to visit codestin.com
Credit goes to github.com

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

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

Parse FontBBox in type1font. #30088

wants to merge 1 commit into from

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).
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