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

Skip to content

Implement multi-font embedding for PS Backend #20832

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

Closed
wants to merge 32 commits into from

Conversation

aitikgupta
Copy link
Contributor

@aitikgupta aitikgupta commented Aug 13, 2021

PR Summary

Adding on to the changes from the original PDF PR: #20804, this PR modifies the layout of PS backend to allow embedding multiple fonts.

Currently, Type3 multi-font embedding works fine, however, Type42 fails to display the glyphs from other font, even after the font is embedded (and subsetted).

UPDATE: Using a different font seems to output a good Type42 embedding.

Type3_converted_from_ps.pdf
Type42_converted_from_ps.pdf

image
^^ Type 3

import matplotlib.pyplot as plt

FONTTYPE = 42    # or 3

plt.rcParams['font.family'] = ['Authentic', 'SimHei']
plt.rcParams['ps.fonttype'] = FONTTYPE
plt.rcParams['font.size'] = 30

plt.figtext(0.18, 0.45, "There are 多个汉字 in between!")
plt.savefig(f"type{FONTTYPE}_fallback.ps")

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

@tacaswell
Copy link
Member

Included in #23559

@tacaswell tacaswell closed this Aug 12, 2022
@QuLogic QuLogic added this to the v3.6.0 milestone Aug 12, 2022
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.

4 participants