From 3778e6d27faf8935d4f782a91a9c8e148c153c17 Mon Sep 17 00:00:00 2001 From: Dan Palmer Date: Thu, 3 Mar 2016 17:45:28 +0000 Subject: [PATCH] Fix font kerning in container There is a known *issue in Debian distros around subpixel hinting & font smoothing. Link below provides a description & an example font configuration for fixing it. This was highlighted in the **below wkhtmltopdf issue. The font configuration(according to the Readme found in `fonts/config.d/`) relies on ordering hence the `10-` prefix. * https://wiki.debian.org/Fonts#Subpixel-hinting_and_Font-smoothing ** https://github.com/wkhtmltopdf/wkhtmltopdf/issues/45 --- Dockerfile | 1 + README.md | 3 ++- fonts/10-wkhtmltopdf.conf | 29 +++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 fonts/10-wkhtmltopdf.conf diff --git a/Dockerfile b/Dockerfile index 4aa7909..6095fc2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ RUN rm -rf wkhtmltox RUN cp -r ./fonts/liberation_sans /usr/share/fonts/truetype/ RUN fc-cache -f -v +RUN cp ./fonts/10-wkhtmltopdf.conf /etc/fonts/conf.d/ ENV UNICORN_PORT 3000 EXPOSE $UNICORN_PORT diff --git a/README.md b/README.md index 292b5c2..97b17c6 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,8 @@ machine. You can find the relevant fonts in the `fonts/` directory. You should be able to add them to OS X by double clicking the font. The `Dockerfile` is responsible for setting up the fonts from the repo on the -container. +container. It also includes a font configuration file required to fix font +hinting and anti-aliasing in the container when generating PDF's. ### `Environment Variables` diff --git a/fonts/10-wkhtmltopdf.conf b/fonts/10-wkhtmltopdf.conf new file mode 100644 index 0000000..fdc875b --- /dev/null +++ b/fonts/10-wkhtmltopdf.conf @@ -0,0 +1,29 @@ + + + + + + rgb + + + + + true + + + + + hintslight + + + + + true + + + + + lcddefault + + +