Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TST: Remove redundant font tests#30513

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
QuLogic wants to merge9 commits intomatplotlib:text-overhaul
base:text-overhaul
Choose a base branch
Loading
fromQuLogic:redundant-font-tests

Conversation

QuLogic
Copy link
Member

PR summary

I extracted this out of#30512 because it was causing issues with the pre-loading of test images. I may update this as/when I find more redundant tests.

  • test_backend_ps::test_type3_font is covered bytest_backend_ps::test_multi_font_type3
  • test_text::test_pdf_chars_beyond_bmp is covered bytest_backend_pdf::test_multi_font_type3 andtest_backend_pdf::test_multi_font_type42
  • test_text::test_pdf_kerning is covered bytest_backend_pdf::test_kerning
  • test_text::test_pdf_type42_kerning is covered bytest_backend_pdf::test_kerning

PR checklist

With libraqm, string layout produces glyph indices, not character codes,and font features may even produce different glyphs for the samecharacter code (e.g., by picking a different Stylistic Set). Thus wecannot rely on character codes as unique items within a font, and mustmove toward glyph indices everywhere.
Currently, we split text into single byte chunks and multi-byte glyphs,then iterate through single byte chunks for output and multi-byte glyphsfor output.Instead, output the single byte chunks as we finish them, then do themulti-byte glyphs at the end.
For a Type 3 font, its encoding is entirely defined by its `Encoding`dictionary (which we create), so there's no reason to use a specificencoding like `cp1252`. Instead, switch to Latin-1, which correspondsexactly to the first 256 character codes in Unicode, and can be mappeddirectly with `ord`.
By tracking both character codes and glyph indices, we can handleproducing multiple font subsets if needed by a file format.
For character codes outside the embedded font limits (256 for type 3 and65536 for type 42), we output them as XObjects instead of using textcommands. But there is nothing in the PDF spec that requires anyspecific encoding like this.Since we now support subsetting all fonts before embedding, split eachfont into groups based on the maximum character code (e.g., 256-entrygroups for type 3), then switch text strings to a different font subsetand re-map character codes to it when necessary.This means all text is true text (albeit with some strange encoding),and we no longer need any XObjects for glyphs. For users of non-Englishtext, this means it will become selectable and copyable again.Fixesmatplotlib#21797
For Type 3 fonts, add a `ToUnicode` mapping (which was added in PDF1.2), and for Type 42 fonts, correct the Unicode encoding, which shouldbe UTF-16BE, not UCS2.
These characters are outside the BMP and should test subset splittingfor type 42 output in PDF.
- `test_backend_ps::test_type3_font` is covered by  `test_backend_ps::test_multi_font_type3`- `test_text::test_pdf_chars_beyond_bmp` is covered by  `test_backend_pdf::test_multi_font_type3` and  `test_backend_pdf::test_multi_font_type42`- `test_text::test_pdf_kerning` is covered by  `test_backend_pdf::test_kerning`- `test_text::test_pdf_type42_kerning` is covered by  `test_backend_pdf::test_kerning`
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
v3.11.0
Development

Successfully merging this pull request may close these issues.

1 participant
@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp