Visitar URL original
Emit non BMP chars as XObjects in PDF by sauerburger · Pull Request #20633 · matplotlib/matplotlib · GitHub
The Wayback Machine - https://web.archive.org/web/20210911134927/https://github.com/matplotlib/matplotlib/pull/20633
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

Emit non BMP chars as XObjects in PDF #20633

Merged
merged 2 commits into from Jul 22, 2021

Conversation

@sauerburger
Copy link
Member

@sauerburger sauerburger commented Jul 12, 2021 •

PR Summary

Closes #20616

This PR address #20616 and emits Type 42 chars from beyond the Basic Multilingual Plane as XObjects, similar to the treatment of multi-byte chars in Type 3 fonts.

This PR builds on top of #20615.

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
@sauerburger sauerburger changed the title Pdf non bmp chars Emit non BMP chars as XObjects in PDF Jul 12, 2021
@sauerburger sauerburger force-pushed the sauerburger:pdf-non-bmp-chars branch from 675a7b2 to cded989 Jul 12, 2021
Copy link
Contributor

@aitikgupta aitikgupta left a comment

I think this is close to what @anntzer mentioned by splitting characters into 'multi-bytes' for Type 42 as well (briefly during the call and on #18191).

Looks good! 🎉

Test that character beyond the Basic Multilingual Plane are supported in PDF
files with Type 42 fonts. The example tests STIX Sans math chars and a char
from an old script.
@sauerburger sauerburger force-pushed the sauerburger:pdf-non-bmp-chars branch from cded989 to 08872c7 Jul 15, 2021
@QuLogic QuLogic added this to the v3.5.0 milestone Jul 20, 2021
lib/matplotlib/backends/backend_pdf.py Outdated Show resolved Hide resolved
lib/matplotlib/backends/backend_pdf.py Outdated Show resolved Hide resolved
Currently, the CID maps only support 2-byte fixed-width characters. Unicode
points beyond the Basic Multilingual Plane cannot be used. This comment follows
the strategy taken for Type 3 fonts. Any char with a code point > 65535 is
emitted as an XObject.
@sauerburger sauerburger force-pushed the sauerburger:pdf-non-bmp-chars branch from 08872c7 to a4067a0 Jul 21, 2021
Copy link
Contributor

@jklymak jklymak left a comment

I'm approving in lieu of @aitikgupta, not because I understand the font handling here.

@QuLogic QuLogic merged commit bd127f3 into matplotlib:master Jul 22, 2021
26 of 27 checks passed
26 of 27 checks passed
@github-actions
flake8
Details
@github-actions
greeting
Details
@github-actions
Python 3.7 on ubuntu-18.04 (Minimum Versions)
Details
@github-actions
Python 3.7 on ubuntu-18.04
Details
@github-actions
Python 3.8 on ubuntu-18.04
Details
@github-actions
Python 3.9 on ubuntu-20.04
Details
@github-actions
Python 3.8 on macos-latest
Details
@github-actions
eslint
Details
@codecov
codecov/project/tests 98.27% (-0.71%) compared to b932575
Details
@lgtm-com
LGTM analysis: JavaScript No code changes detected
Details
@github-actions
Check the rendered docs here! Link to 0/doc/build/html/index.html
Details
@lgtm-com
LGTM analysis: Python No new or fixed alerts
Details
ci/circleci: docs-python38 Your tests passed on CircleCI!
Details
@codecov
codecov/patch 100.00% of diff hit (target 50.00%)
Details
@codecov
codecov/project/library 77.11% (target 50.00%)
Details
@appveyor
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@azure-pipelines
matplotlib.matplotlib Build #20210721.9 succeeded
Details
@azure-pipelines
matplotlib.matplotlib (Check Skip) Check Skip succeeded
Details
@azure-pipelines
matplotlib.matplotlib (Main Pytest Linux_py37) Main Pytest Linux_py37 succeeded
Details
@azure-pipelines
matplotlib.matplotlib (Main Pytest Linux_py38) Main Pytest Linux_py38 succeeded
Details
@azure-pipelines
matplotlib.matplotlib (Main Pytest Linux_py39) Main Pytest Linux_py39 succeeded
Details
@azure-pipelines
matplotlib.matplotlib (Main Pytest Windows_py37) Main Pytest Windows_py37 succeeded
Details
@azure-pipelines
matplotlib.matplotlib (Main Pytest Windows_py38) Main Pytest Windows_py38 succeeded
Details
@azure-pipelines
matplotlib.matplotlib (Main Pytest Windows_py39) Main Pytest Windows_py39 succeeded
Details
@azure-pipelines
matplotlib.matplotlib (Main Pytest macOS_py37) Main Pytest macOS_py37 succeeded
Details
@azure-pipelines
matplotlib.matplotlib (Main Pytest macOS_py38) Main Pytest macOS_py38 succeeded
Details
@azure-pipelines
matplotlib.matplotlib (Main Pytest macOS_py39) Main Pytest macOS_py39 succeeded
Details
@sauerburger sauerburger mentioned this pull request Jul 22, 2021
3 of 7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants