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

Fonts are ignored in PDF #131

Closed
Skeeve opened this issue Feb 14, 2023 · 7 comments
Closed

Fonts are ignored in PDF #131

Skeeve opened this issue Feb 14, 2023 · 7 comments

Comments

@Skeeve
Copy link
Contributor

Skeeve commented Feb 14, 2023

I put into my document:

---
mainfont: Avenir Next
---

and. in split mode I can see the font change.

But when exporting to PDF, the font is ignored.

Are there any troubleshooting tips?

I'm using

  • Mac OS 13.1
  • pandoc 3.1
  • panWriter 0.8.5
@mb21
Copy link
Owner

mb21 commented Feb 14, 2023

PDF export is using pandoc, which is using LaTeX under the hood. There, not all normally installed fonts are supported. See https://pandoc.org/MANUAL.html#fonts

@Skeeve
Copy link
Contributor Author

Skeeve commented Feb 14, 2023

Okay. But I have a font which works with pandoc on another machine, but I do not use panwriter there. So what would be the correct syntax to tell pandoc from panwriter where the fontfile resides?

I already tried the full path to the font file but I did not succeed.

@Skeeve
Copy link
Contributor Author

Skeeve commented Feb 14, 2023

I checked as described here: https://fedidat.com/160-installing-fonts-for-pandoc/

and I can see: My font is installed.

@Skeeve
Copy link
Contributor Author

Skeeve commented Feb 14, 2023

Update:

pandoc -f markdown --pdf-engine=xelatex --to pdf -o Untitled.pdf Untitled.md

This works with my intended font "Avenir Next"

but when I define in the document or defaults.yaml

papersize: A4
mainfont: Avenir Next
output:
  latex:
    toc: true
    pdf-engine: xelatex

panWriter fails

Called: pandoc --metadata-file '/Users/skeeve/Library/Application Support/PanWriterUserData/default.yaml' --toc --pdf-engine xelatex --metadata 'mainfont=-apple-system, BlinkMacSystemFont, Segoe UI, sans-serif' --metadata monobackgroundcolor=#f0f0f0 --output /Users/skeeve/Desktop/Untitled.pdf --to latex --standalone

Error producing PDF.
! Package fontspec Error: The font "-apple-system, BlinkMacSystemFont, Segoe
(fontspec)                UI, sans-serif" cannot be found.

For immediate help type H <return>.
...                                              

l.24 \fi

@Skeeve
Copy link
Contributor Author

Skeeve commented Feb 15, 2023

Update: mainfont works if
a) You put it into the document, not in the defaults.yaml
b) You use xelatex as the pdf-engine

@Skeeve
Copy link
Contributor Author

Skeeve commented Feb 15, 2023

Would, maybe, this solve the issue?

  if (docMeta.mainfont === undefined) {
    out.metadata.mainfont = extMeta.mainfont || '-apple-system, BlinkMacSystemFont, Segoe UI, sans-serif';
  }

Yes, it does. Please see PR #134

@Skeeve
Copy link
Contributor Author

Skeeve commented Feb 16, 2023

Will be fixed when PR #134 is merged.

@Skeeve Skeeve closed this as completed Feb 16, 2023
mb21 pushed a commit that referenced this issue Feb 16, 2023
We only want to set PanWriter-specific styles in the HTML export case anyway
(so that it looks the same as the PanWriter preview).

fixes #131
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants