Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeckTape Container Font Bug #329

Open
thomas-ferchau opened this issue Apr 19, 2024 · 1 comment
Open

DeckTape Container Font Bug #329

thomas-ferchau opened this issue Apr 19, 2024 · 1 comment

Comments

@thomas-ferchau
Copy link

I have recently discovered DeckTape and really appreciate that I can now create PDF slides from Asciidoctor / reveal.js files from the command line :-)

My biggest concerns are internal links (#49) - that would really help - and this font-related bug for which I could not find an issue yet.

Bug Description

When generating a PDF with the decktape Docker container from reveal.js slides, fonts do not work properly:

  • The font in the PDF does not look like Arial or Helvetica or sans-serif (defined as font-family).

  • Titles are not bold in the PDF (but they are in the HTML file)

  • Acrobat Reader (on Windows) reports:

    Cannot extract the embedded font 'AAAAAA+WenQuanYiZenHei'. Some characters may not display or print correctly.

  • The problems also occur without custom CSS:

    The default reveal.js theme defines Source Sans Pro, Helvetica, sans-serif as font-family.
    Now Acrobat reader complains about the font BAAAAA+SourceSansPro-Regular.

Example Files

You can download example PDF and HTML files that show the problem and the results with the workaround applied (see below).

Versions and more Details

Decktape image: astefanutti/decktape:3.12.0
Asciidoctor image: asciidoctor/docker-asciidoctor:1.69.0
Acrobat Reader version (Windows): 24.001.20643

The HTML file was created with Asciidoctor reveal.js, but that should not matter.

It also includes FontAwesome to enable the use of icons.

Strange Behaviour

Strangely, some minor changes in the Asciidoc file removed the Acrobat Reader error message (for example, replacing some words by others!).

I cannot reproduce this right now, but the effect was definitely there. It made me try a lot of changes in the document before finding a more stable workaround (see below)...​

If it would help, I might be able to find a combination that changes the behaviour in Acrobat Reader. But I guess the root problem is not really related to that.

Reproduce the Bug

Clone my reproducer repository, follow the setup instructions, and run the following commands:

scripts/build-html.sh && scripts/build-pdf.sh

This produces the following files:

  • fontbug.html

  • pdf/fontbug.pdf (with the problems)

  • pdf/fontbug-workaround.pdf (problems fixed by workaround, see below).

Workaround

I found a workaround in removing wqy-zenhei from Dockerfile:

Replace these lines...​

    ttf-freefont\
    wqy-zenhei &&\
    # /etc/fonts/conf.d/44-wqy-zenhei.conf overrides 'monospace' matching FreeMono.ttf in /etc/fonts/conf.d/69-unifont.conf
    mv /etc/fonts/conf.d/44-wqy-zenhei.conf /etc/fonts/conf.d/74-wqy-zenhei.conf &&\

...​with this...​

    ttf-freefont &&

...​as done in this commit.

That fixes the problems as you can see in fontbug-workaround.pdf. That file is created with the container image ghcr.io/thomas-ferchau/decktape:pr-1 which includes this modification in a fork of decktape.

The workaround does not work without custom CSS - in that case, Acrobat Reader complains about the reveal.js default font: BAAAAA+SourceSansPro-Regular.

If I understand it correctly, /etc/fonts/conf.d/74-wqy-zenhei.conf defines to prefer its fonts which might cause the problem.

@psimm
Copy link

psimm commented May 21, 2024

I'm also getting this error in Acrobat Reader when opening a PDF that was created by decktape from a revealjs presentation. The revealjs presentation was created with Quarto.

Here's the PDF: fontbug.pdf

And here's the content of the qmd document to create the revealjs HTML file. I'm not including the html file because it has too many external dependencies.

---
title: "Title"
subtitle: "Analysis of customer reviews"
format: revealjs

---


## Content

- Bullet 1
- Bullet 2

Curiously, the font error doesn't occur when I remove the subtitle, or if I shorten it to just the word "Analysis". Acrobat actually lists the font too:

Screenshot 2024-05-21 at 15 19 12

But still shows the message: "Cannot extract the embedded font 'BAAAAA+SourceSansPro-Regular'. Some characters may not display or print correctly." when opening the PDF.

Other PDF readers work: I've tried Preview and Chrome on Mac, and Edge on Windows.

Versions:
decktape 3.12.0
Quarto 1.5.30
macOS 14.4.1
Acrobat Reader 2024.002.20759

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants