Login  Register

Re: Confusing font error: (UnknownFont) is not a known font.

Posted by mojavelinux on Mar 02, 2021; 11:18am
URL: https://discuss.asciidoctor.org/Re-Confusing-font-error-UnknownFont-is-not-a-known-font-tp8552.html

I cannot comment on how docToolchain works, but I can comment on Asciidoctor PDF.

When you see this error:

 (UnknownFont)  is not a known font.

It means the PDF generator (Prawn) is finding the font family, but cannot find the variant for the particular style (bold, italic, bold_italic). I reported this error message as being too vague a while back in Prawn and it has since been fixed. See https://github.com/prawnpdf/prawn/issues/1022. We'll see an improved error message in Asciidoctor PDF 2 (which includes the latest version of Prawn).

But that only addresses the message, not the underlying problem. The problem is that the font catalog in your theme is using several unrecognized style names. The valid style names are as follows:

* normal
* bold
* italic
* bold_italic

The style names your theme is using are:

* normal
* medium
* bold
* italic
* medium-italic
* bold-italic

Asciidoctor PDF doesn't know what to do with medium, medium-italic, or bold-italic. And likely the generator is looking for bold_italic, but cannot find it. Hence the error message. So if you rename bold-italic to bold_italic, it will probably fix it.

Consult the theming guide for more information about registering custom fonts. https://github.com/asciidoctor/asciidoctor-pdf/blob/main/docs/theming-guide.adoc#custom-fonts

Best Regards,

-Dan

--
Dan Allen (he, him, his) | @mojavelinux | https://twitter.com/mojavelinux