adrienbrignon / mkdocs-exporter

⚡ The fastest and most configurable plugin for MkDocs, allowing seamless export of individual pages and/or entire documentation as PDF documents.
https://adrienbrignon.github.io/mkdocs-exporter/
MIT License
83 stars 9 forks source link

Issues with font kerning on headless chromium + fix #27

Closed markjoshwel closed 5 months ago

markjoshwel commented 5 months ago

as seen in https://github.com/puppeteer/puppeteer/issues/2410

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 commented 5 months ago

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.