Zenika / sensei

The compiler for our training material.
https://hub.docker.com/r/zenika/sensei
Other
16 stars 4 forks source link

Different font size between "serve" and "pdf" commands #64

Open HarryPommier opened 3 years ago

HarryPommier commented 3 years ago

The font size is different between the slides generated with "sensei serve" and the slides generated with "sensei pdf" This may cause layout errors.

With "serve": sensei_serve

With "pdf" sensei_pdf

zigarn commented 3 years ago

Wouldn't it be more an issue of font? Like depending on the build process it's using different alternatives of fonts (between CSS declared fonts, fonts available in container and fonts available on system in browser and in PDF)

zigarn commented 3 years ago

When checking the font actually used through the font info of the inspect tool of Firefox:

Result in evince: image Result in Chrome PDF viewer: image Result in GIMP: image

Rendering is coherent in PDF viewers.

If I change the font declaration in sensei to use DejaVu Sans (Mono), or remove the declaration of @font-face, the rendering becomes the same in Firefox than on PDF viewers. Looks like CSS-declared fonts are lost during the PDF printing process...

hgwood commented 3 years ago

All the screenshot look exactly the same to me :)

hgwood commented 3 years ago

The original issue is about the font size being different: the word "sound" on the first bullet point is on the first line in the web view, and on the second line in the pdf. Might also not be a font size issue but a slide size issue.

hgwood commented 3 years ago

@HarryPommier could you try reproducing the issue using the latest version of sensei?

zigarn commented 3 years ago

@hgwood If you look closely, the boldness of the title is different between web view and PDF. Also in code bloc we can see that the first line is splitted in two lines in web view but not in PDF. So there is a difference of rendering between web and PDF.

hgwood commented 3 years ago

Right, sorry!

zigarn commented 3 years ago

When launching decktape with option --screenshot, which is doing a screenshot from pupeeter page object, the screenshot result is the same as in the PDF viewers.

zigarn commented 3 years ago

Also I suspect some of the effects are from image sizing and placement, which can be subtly different in PDF than in browser. But I think most of this issue is due to PDF printing process of decktape, and won't be easy to debug and fix...

zigarn commented 3 years ago

Useful reading abour PDF, fonts and reader interpretation: https://linuxfr.org/users/pied/journaux/pdf-mais-que-fait-la-police