pdfasciidoctorasciidoctor-pdf

How to fix created PDF with Asciidoctor-pdf doesn't show üöä chars


I'm writing my documentation with asciidoctor and now I will create a pdf file with my existing adoc file, but after I used:

asciidoctor -r asciidoctor-pdf -b pdf documentation.adoc

and get my pdf I've go with firefox to the url of my documentation.pdf but my formattet code blocks in the pdf don't show üäö chars, this chars i use for inline comments. If my output file is HTML i have no errors with the special chars.

My PDF file looks so:

My pdf code block

My HTML code block

I've try to use

ä
for the ä char but the pdf file shows then
ä


Solution

  • Last issue first: HTML entities should have no spaces within them; if you need to use one to show ä, write it as ä.

    The problem is that the font being used for source blocks does not include glyphs for some/all accented characters.

    Asciidoctor-PDF is packaged with a monospace font with more glyphs (M+ 1p), but it is not used by default because there is no italics or boldface (which would provide a similar font-doesn't-have-the-feature-I-want problem).

    To use it, you need to apply the default-with-fallback-font theme:

    asciidoctor-pdf -a pdf-theme=default-with-fallback-font documentation.adoc
    

    Note: I used the short-hand invocation to avoid line wrap. The key is to add -a pdf-theme=default-with-fallback-font option to your invocation.