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

Use DejaVu fonts in PDF builds #1066

Merged
merged 5 commits into from
Jul 17, 2019
Merged

Use DejaVu fonts in PDF builds #1066

merged 5 commits into from
Jul 17, 2019

Conversation

mortenpi
Copy link
Member

DejaVu Sans Mono seems to be available out of the box on Linux (at least on Ubuntu), so no need to worry about installing it on the Docker image etc. It provides good Unicode coverage in my experience -- this is the fallback font on Ubuntu and I have not noticed any missing symbols. From a font quality perspective, I don't actually see much difference between it and Roboto Mono.

Fix #803. Once downstreamed will fix JuliaLang/julia#31048.

@mortenpi mortenpi added Type: Enhancement Format: LaTeX Related to the LaTeX / PDF output labels Jul 11, 2019
@mortenpi mortenpi added this to the 0.23.0 milestone Jul 11, 2019
We also have missing Unicode symbols in the plain text part.
@mortenpi
Copy link
Member Author

I also changed the sans-serif font to DejaVu Sans, since Lato is missing a lot of the necessary Unicode characters too. I would say that it looks good enough and my current feeling is that decent Unicode coverage is more important than having the most beautiful font.

Here is an example of the main manual compiled with the DejaVu fonts: TheJuliaLanguage.pdf

Just a note for future: Tex, unfortunately, does not seem to support fallback fonts (i.e. that if a particular character is missing, it would render it from a different font). The closest you have is ucharclasses for XeTeX, but it has two issues: (1) we are using LuaTex and it's XeTeX-only, and (2) it only allows setting different fonts for classes of characters but does not provide fallbacks for individual characters.

@mortenpi mortenpi changed the title Use DejaVu Sans Mono in PDF builds Use DejaVu fonts in PDF builds Jul 12, 2019
DejaVu Sans Mono does not render the \xor symbol, so we actually create
our own fallback system for this case where instances of this character
get replaced by the \unicodeveebar command in the TeX source.
\unicodeveebar then renders this character with DejaVu Sans.

In principle, this is pretty easily extensible to other missing Unicode
characters as well, should they come up.
@mortenpi
Copy link
Member Author

DejaVu Sans Mono does not render the ⊻ symbol, so I actually created our homebrew fallback system for this case. Instances of that character get replaced by the \unicodeveebar command in the TeX source, which then renders it DejaVu Sans instead.

In principle, this is pretty easily extensible to other missing Unicode characters as well, should they come up.

Here is an example build which shows off all the Unicode characters reported in #803: Unicodetest.pdf

@fredrikekre Any thoughts about this hack?

@mortenpi mortenpi merged commit bf05fee into master Jul 17, 2019
@mortenpi mortenpi deleted the mp/pdf-fonts branch July 17, 2019 06:19
@Ronneesley
Copy link

Ronneesley commented Aug 22, 2019

Hello @mortenpi,

I noticed that in PDF manual version 1.2, some characters aren't appearing, like:

Function composition and piping

The symbol: ∘

(sqrt  +)(3, 6)

Repeated Evaluation: Loops

The symbol: ∈

for s  ["foo","bar","baz"]
     println(s)
end

Is it resolved? Why new manual's version doesn't include the solution? Thanks.

@mortenpi
Copy link
Member Author

The 1.2.0 manual was still built with an older Documenter, so it did not have these fixes. With the latest Documenter, they render fine:

symbols

We could potentially backport JuliaLang/julia#32376 to 1.2.1. Otherwise, 1.3.0 will definitely have this fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Format: LaTeX Related to the LaTeX / PDF output Type: Enhancement
Projects
None yet
2 participants