mraible / jhipster-book

The JHipster Mini-Book
http://www.jhipster-book.com
Apache License 2.0
22 stars 6 forks source link

Unable to embed fonts in PDF #111

Closed mraible closed 1 year ago

mraible commented 1 year ago

When InfoQ tried to upload the prepress version of the 7.0.0 release to Lulu, it failed because they were unable to embed the fonts in the PDF.

Screen Shot 2023-04-26 at 13 43 02

Related: Lulu's How Do I Embed Fonts in a PDF?

mraible commented 1 year ago

@ggrossetie Maybe this is caused by emojis? I see the following warnings when I run ./gradlew prepress:

> Task :prepress
2023-04-26T10:36:52.915-06:00 [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.
Apr 26, 2023 10:36:58 AM uri:classloader:/gems/asciidoctor-pdf-1.5.3/lib/asciidoctor/pdf/converter.rb convert_listing_or_literal
WARNING: Could not locate the character `█' in the following fonts: M+ 1mn, M+ 1p Fallback, Emoji
Apr 26, 2023 10:36:58 AM uri:classloader:/gems/asciidoctor-pdf-1.5.3/lib/asciidoctor/pdf/converter.rb convert_listing_or_literal
WARNING: Could not locate the character `✔' in the following fonts: M+ 1mn, M+ 1p Fallback, Emoji
Apr 26, 2023 10:37:04 AM uri:classloader:/gems/asciidoctor-pdf-1.5.3/lib/asciidoctor/pdf/converter.rb convert_section
WARNING: Could not locate the character `✖' in the following fonts: M+ 1mn, M+ 1p Fallback, Emoji
Apr 26, 2023 10:37:04 AM uri:classloader:/gems/asciidoctor-pdf-1.5.3/lib/asciidoctor/pdf/converter.rb convert_section
WARNING: Could not locate the character `▸' in the following fonts: M+ 1mn, M+ 1p Fallback, Emoji
Apr 26, 2023 10:37:05 AM uri:classloader:/gems/asciidoctor-2.0.18/lib/asciidoctor/abstract_block.rb content
WARNING: Could not locate the character `⬢' in the following fonts: M+ 1mn, M+ 1p Fallback, Emoji
Apr 26, 2023 10:37:12 AM uri:classloader:/gems/asciidoctor-pdf-1.5.3/lib/asciidoctor/pdf/converter.rb convert_image
WARNING: problem encountered in image: /Users/mraible/dev/jhipster-book/src/docs/asciidoc/modules/ROOT/images/chapter-3/diagram-boot-reactor.svg; Unknown tag 'pattern'; ignoring
Apr 26, 2023 10:37:13 AM uri:classloader:/gems/asciidoctor-2.0.18/lib/asciidoctor/document.rb content
WARNING: Could not locate the character `❯' in the following fonts: M+ 1mn, M+ 1p Fallback, Emoji
Apr 26, 2023 10:37:14 AM uri:classloader:/gems/asciidoctor-pdf-1.5.3/lib/asciidoctor/pdf/converter.rb convert_image
WARNING: problem encountered in image: /Users/mraible/dev/jhipster-book/src/docs/asciidoc/modules/ROOT/images/chapter-4/diagram-boot-reactor.svg; Unknown tag 'pattern'; ignoring
Apr 26, 2023 10:37:17 AM uri:classloader:/gems/asciidoctor-2.0.18/lib/asciidoctor/document.rb content
WARNING: Could not locate the character `✨' in the following fonts: Noto Serif, M+ 1p Fallback, Emoji
Apr 26, 2023 10:37:17 AM uri:classloader:/gems/asciidoctor-2.0.18/lib/asciidoctor/document.rb content
WARNING: Could not locate the character `🤗' in the following fonts: Noto Serif, M+ 1p Fallback, Emoji
mojavelinux commented 1 year ago

asciidoctor-pdf-1.5.3

FYI, Asciidoctor PDF 1.5 is no longer supported. The current release is 2.3.7.

mraible commented 1 year ago

@mojavelinux I need to find out where this version is specified. I don't see it in build.gradle. Any idea how to upgrade?

ggrossetie commented 1 year ago

You can update the version in the asciidoctorj block.

To override set asciidoctorj.pdfVersion or asciidoctorPdf.asciidoctorj.pdfVersion.

ggrossetie commented 1 year ago

You might want to add Noto Emoji to support (black and white) emoji:

https://fonts.google.com/noto#emoji-zsye

mraible commented 1 year ago

@ggrossetie I tried upgrading with this:

asciidoctorj {
    version = '2.5.7'
    pdfVersion = '2.3.7'
    requires file('src/main/ruby/asciidoctor-pdf-extensions.rb')
}

It fails with:

Could not set unknown property 'pdfVersion' for extension 'asciidoctorj' of type org.asciidoctor.gradle.jvm.AsciidoctorJExtension_Decorated.

I also tried the following:

asciidoctorj {
    version = '2.5.7'
    asciidoctorj.pdfVersion = '2.3.7'
    requires file('src/main/ruby/asciidoctor-pdf-extensions.rb')
}
asciidoctorj {
    version = '2.5.7'
    asciidoctorPdf.asciidoctorj.pdfVersion = '2.3.7'
    requires file('src/main/ruby/asciidoctor-pdf-extensions.rb')
}

The last one results in:

Could not set unknown property 'pdfVersion' for extension 'asciidoctorj' of type org.asciidoctor.gradle.jvm.AsciidoctorJExtension_Decorated

ggrossetie commented 1 year ago

Oh we are using version 3. Could you please try:

asciidoctorj {
  modules {
    pdf { 
      version '1.2.3'
    }
}
mraible commented 1 year ago

That seemed to work. Thanks!

Apr 30, 2023 3:56:41 PM uri:classloader:/gems/asciidoctor-pdf-2.3.7/lib/asciidoctor/pdf/theme_loader.rb load
WARNING: the literal theme category is deprecated; use the codespan category instead
Apr 30, 2023 3:56:41 PM uri:classloader:/gems/asciidoctor-pdf-2.3.7/lib/asciidoctor/pdf/theme_loader.rb load
WARNING: the blockquote theme category is deprecated; use the quote category instead
Apr 30, 2023 3:56:41 PM uri:classloader:/gems/asciidoctor-pdf-2.3.7/lib/asciidoctor/pdf/theme_loader.rb load
WARNING: the outline-list theme category is deprecated; use the list category instead
ggrossetie commented 1 year ago

Awesome 👍