asciidoctor / asciidoctor-pdf

:page_with_curl: Asciidoctor PDF: A native PDF converter for AsciiDoc based on Asciidoctor and Prawn, written entirely in Ruby.
https://docs.asciidoctor.org/pdf-converter/latest/
MIT License
1.14k stars 500 forks source link

Embedding of "built-in" fonts #2497

Closed mementum closed 7 months ago

mementum commented 7 months ago

Reading here: https://docs.asciidoctor.org/pdf-converter/latest/theme/font-support/

Helvetica is a built-in font. I therefore assumed that the font would be "embedded" in the final output. But to my surprise it wasn't, as reported by Amazon KDP. I then used evince to double-check and Helvetica was not embedded in the document.

This link provides some info: https://www.ibm.com/docs/en/cmofi/7.3.0?topic=indexer-pdf-fonts-output-file-size

Helvetica is one of the 14 fonts which are available in Acrobat, which could be seen as the PDF target. But Amazon complains about the embedding.

Being a "built-in" fond in asciidoctor-pdf the questions:

mojavelinux commented 7 months ago

No, they should not. AFM fonts are assumed to be provided by the PDF reader. For all intents and purposes, they are default, application-provided fonts.

9.6.2.2 Standard Type 1 Fonts (Standard 14 Fonts)

The PostScript names of 14 Type 1 fonts, known as the standard 14 fonts, are as follows: Times-Roman, Helvetica, Courier, Symbol, Times-Bold, Helvetica-Bold, Courier-Bold, ZapfDingbats, Times-Italic, Helvetica- Oblique, Courier-Oblique, Times-BoldItalic, Helvetica-BoldOblique, Courier-BoldOblique

These fonts, or their font metrics and suitable substitution fonts, shall be available to the conforming reader.

If you want a font to be embedded, it has to be a TTF font. That is the specification to which Prawn is developed and is unlikely to change. You're welcome to create a theme that defines Helvetica as a TTF font in the font catalog, in which case it will be used and bundled.

Helvetica is also not a free font. So even if we wanted to automatically translate an AFM font to a bundled TTF font, we wouldn't be able to in an open source project.

The documentation already strongly recommends avoiding the use of the AFM fonts. They are supported since they are defined as part of the PDF specification, but even the specification acknowledges that they have severe drawbacks.

mementum commented 7 months ago

Thanks for the feedback. The key point, unknown to me, is that Helvetica is not a free font.