Skip to content

Pass explicit font paths to fontspec in backend_pgf. #10339

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

Merged
merged 1 commit into from
May 6, 2018

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jan 28, 2018

PR Summary

xref #10307. @laborleben Can you check whether this works for you? Seems better than continuously posting patches :)

Basically

  1. we already have a font fonding mechanism and should just reuse it in backend_pgf.
  2. we sometimes find fonts in nonstandard locations and may need to tell tex exactly where to find them.

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@laborleben
Copy link

Hi, thanks a lot for the work. This time it worked like a charm. I tried different parameters and the code worked every time. I'm looking forward to see your improvements merged upstream.

If you need further testing on macOS, please let me know.

@anntzer anntzer added this to the v2.2 milestone Jan 29, 2018
Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine to me, and glad it fixes the pdf issue...

@anntzer anntzer modified the milestones: needs sorting, v3.0 Feb 17, 2018
@anntzer anntzer force-pushed the pgf-fontspec branch 2 times, most recently from 4dc3ed1 to b002924 Compare May 3, 2018 02:50
# backslashes. 2) The dirname needs to include a separator.
dirname = Path(fm.findfont(family)).parent.as_posix() + "/"
latex_fontspec.append(
r"\%s{%s}[Path=%s]" % (command, basename, dirname))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basename seems undefined. Apparently an untested code path 😦

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, fixed

@@ -77,23 +58,20 @@ def _parse_lualatex_version(output):
def get_fontspec():
"""Build fontspec preamble from rc."""
latex_fontspec = []
texcommand = get_texcommand()
texcommand = rcParams["pgf.texsystem"]
Copy link
Member

@timhoffm timhoffm May 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we explicitly not want the check and fallback mechanism to xelatex, which was implemented in get_texcommand?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That does already get checked during standard rcparam validation.

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditional on CI.

Bonus points if you want to add a test for the pgf.rcfonts code path.

@anntzer
Copy link
Contributor Author

anntzer commented May 6, 2018

I'll skip the bonus points.

@timhoffm timhoffm merged commit bdeb21e into matplotlib:master May 6, 2018
@anntzer anntzer deleted the pgf-fontspec branch May 6, 2018 21:02
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