Skip to content
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

register_font: support for new API #111

Merged
merged 16 commits into from
Sep 13, 2024
Merged

register_font: support for new API #111

merged 16 commits into from
Sep 13, 2024

Conversation

naveen521kk
Copy link
Member

  • Pango 1.52.0 supports a new API for registering fonts on Windows and this commit adds support for it.
  • Using the new API requires adding the font to every PangoFontMap that is used in the application.
  • Due to this, the font files is stored in memory and registered with every PangoFontMap that is created when rendering text.
  • list_fonts is improved by caching the list of fonts based on the registered font files.

- Pango 1.52.0 supports a new API for registering fonts on
Windows and this commit adds support for it.
- Using the new API requires adding the font to every
PangoFontMap that is used in the application.
- Due to this, the font files is stored in memory and
registered with every PangoFontMap that is created
when rendering text.
- `list_fonts` is improved by caching the list of fonts
based on the registered font files.

Signed-off-by: Naveen M K <[email protected]>
- Introduce `RegisterFont` dataclass to store font information
- Only registers fonts registered using win32 backend
- Other methods also only handles what it needs to
@naveen521kk naveen521kk force-pushed the register-font-refactor branch 2 times, most recently from 4e9a153 to 01f6223 Compare September 11, 2024 17:13
@naveen521kk naveen521kk force-pushed the register-font-refactor branch 2 times, most recently from cf9b168 to b5e07c1 Compare September 11, 2024 17:34
- `local()` is a internal function and broke in python 3.13
- instead use `exec` with a global dict
@naveen521kk naveen521kk force-pushed the register-font-refactor branch 2 times, most recently from 70b3927 to 6eabae6 Compare September 11, 2024 18:04
@naveen521kk naveen521kk linked an issue Sep 13, 2024 that may be closed by this pull request
@naveen521kk naveen521kk force-pushed the register-font-refactor branch 3 times, most recently from 624b957 to 3f6b9ea Compare September 13, 2024 05:45
@naveen521kk naveen521kk merged commit 170c7dd into v0 Sep 13, 2024
26 checks passed
@naveen521kk naveen521kk deleted the register-font-refactor branch September 13, 2024 07:09
@naveen521kk naveen521kk linked an issue Sep 14, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

setup.py get_version fails on Python 3.13 register_font broken on Windows with Pango 1.50.12 + Cairo 1.17.6
1 participant