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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

mojavelinux
Administrator
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
Reply | Threaded
Open this post in threaded view
|

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

jlo2k
Hello,
thanks for the quick answer. You were right. I applied the `-`can be used instead of _ for attributes that i read somewhere and thought in the back of my head 'should i really do this?' and did not pay enogh attention thereby creating this error. I should have known better.

In regards to asciidoctor pdf font styles i understood, that i i want to use a light font, then i cannot define light?

e.g. base open sans style light size 10 would not work? i thought i had tried it and it worked.
But of course working does not mean supported intentionally.
The right way of doing so would then be to define the light font in the catalog as normal style and use that?

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

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

mojavelinux
Administrator
> The right way of doing so would then be to define the light font in the catalog as normal style and use that?

That's correct. The PDF generator we use (Prawn) only understands two weights, normal and bold. If you want any other weight, you have to treat it as a different font.

So if you want your normal text to be light(er), you configure it to use a light font. The PDF generator doesn't care what you map the normal style too. It just sees it as any other font.

Best Regards,

-Dan

--
Dan Allen (he, him, his) | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

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

jlo2k
Many thanks for clarification. I started about a month ago to learn about asciidoc and i am becoming a fan, because it just exactly allows the things i am missing in md. Still a lot of stuff to read and learn.