Skip to content

Instantly share code, notes, and snippets.

View chrishein's full-sized avatar

Christian Hein chrishein

View GitHub Profile
@chrishein
chrishein / Recipe-bundling-fonts-with-headless-chrome.md
Created June 25, 2018 15:04 — forked from nat-n/Recipe-bundling-fonts-with-headless-chrome.md
How to build a fontconfig bundle for adding arbitrary fonts to headless chrome independent of the OS. This is specifically useful for deploying headless chrome to AWS lambda where it is necessary to include fonts for rendering CJK (Chinese, Japanese, Korean) characters into the deployed bundle.

Building fontconfig

Start up a lambda-like docker container:

docker run -i -t -v /tmp:/var/task lambci/lambda:build /bin/bash

Install some dependencies inside the container:

yum install gperf freetype-devel libxml2-devel git libtool -y

easy_install pip

# These instructions were tested on Ubuntu 12.04 64bit
# Be prepared to wait a while...
sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev libxext-dev libpq-dev libx11-dev
git clone git://github.com/antialize/wkhtmltopdf.git
git clone git://gitorious.org/+wkhtml2pdf/qt/wkhtmltopdf-qt.git wkhtmltopdf-qt
cd wkhtmltopdf
mkdir static-build
ln -s ../wkhtmltopdf-qt static-build/qt
./scripts/static-build.sh