Skip to content
New issue

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

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

Already on GitHub? # to your account

Issues with font kerning on headless chromium + fix #27

Closed
Tracked by #82
markjoshwel opened this issue Jun 18, 2024 · 1 comment · Fixed by #29
Closed
Tracked by #82

Issues with font kerning on headless chromium + fix #27

markjoshwel opened this issue Jun 18, 2024 · 1 comment · Fixed by #29
Assignees
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@markjoshwel
Copy link

markjoshwel commented Jun 18, 2024

as seen in puppeteer/puppeteer#2410

  • running mkdocs serve on windows:

    image

  • running mkdocs build on linux:

    image

  • running mkdocs build on linux with --font-render-hinting=none:

    image

  • running mkdocs serve, and viewing it on a browser:

    image

while the windows and the 'fixed' linux pdf do still have kerning difference, looking at the woes of the people before us (https://www.google.com/search?q=bad+font+kerning+on+headless+chrome), this would be considered 'the bare minimum' to fix glaring inconsistent typography issues

the fix for this, as per the issue, would be to add --font-render-hinting=none to the args of chromium in mkdocs_exporter/formats/pdf/browser.py:

diff --git a/formats/pdf/browser.py b/formats/pdf/browser-kerning-fix.py
index b5cd103..2109c25 100644
--- a/formats/pdf/browser.py
+++ b/formats/pdf/browser-kerning-fix.py
@@ -15,7 +15,8 @@ class Browser:
   args = [
     '--disable-background-timer-throttling',
     '--disable-renderer-backgrounding',
-    '--allow-file-access-from-files'
+    '--allow-file-access-from-files',
+    '--font-render-hinting=none',
   ]
   """The browser's arguments..."""

once again, thanks for the project :)

@adrienbrignon
Copy link
Owner

Hello @markjoshwel,

Thank you for opening an issue and providing some valuable details.
I'll update the browser's arguments to include --font-render-hinting=none by default.

Furthermore, I will make it possible to pass arguments to the browser via the configuration.

@adrienbrignon adrienbrignon added bug Something isn't working enhancement New feature or request labels Jun 18, 2024
@adrienbrignon adrienbrignon self-assigned this Jun 18, 2024
@adrienbrignon adrienbrignon added this to the v6.1.0 milestone Jun 22, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants