| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -65,11 +65,18 @@ def _get_preamble(): | |
| families = ["serif", "sans\\-serif", "monospace"] | ||
| commands = ["setmainfont", "setsansfont", "setmonofont"] | ||
| for family, command in zip(families, commands): | ||
| # 1) Forward slashes also work on Windows, so don't mess with | ||
| # backslashes. 2) The dirname needs to include a separator. | ||
| path = pathlib.Path(fm.findfont(family)) | ||
| preamble.append(r"\%s{%s}[Path=\detokenize{%s/}]" % ( | ||
| command, path.name, path.parent.as_posix())) | ||
| try: | ||
| # 1) Forward slashes also work on Windows, so do not mess | ||
| # with backslashes. | ||
| # 2) The dirname needs to include a separator. | ||
| path = pathlib.Path(fm.findfont(family, | ||
| fallback_to_default=False)) | ||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualityminor nit: only the findfont call should be wrapped in the try... except; this makes it clearer that you're catching failures of findfont and not e.g. findfont returning an invalid value for Path(). (Plus this avoids the awkward linebreak.)
Sorry, something went wrong.
All reactions
|
||
| except ValueError: | ||
| # Use default LaTeX font instead | ||
| pass | ||
| else: | ||
| preamble.append(r"\%s{%s}[Path=\detokenize{%s}]" % ( | ||
| command, path.name, path.parent.as_posix() + "/")) | ||
| return "\n".join(preamble) | ||
|
|
||
|
|
||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.