Reputation: 181
I'm using Puppeteer in an Alpine Linux Docker container. The container inherits from node:alpine
.
By default, it renders English fine, however it doesn't render Japanese at all.
I had a look at Puppeteer's Docker docs, which are tailored to Debian; we are using Alpine.
To render Japanese I ran apk add font-ipa@edge
, which installed an appropriate font.
However, now Chromium uses that font to render English, and it looks bad. I've tried installing other fonts on top, eg apk add ttf-freefont@edge
, but that doesn't change anything. It still uses the Japanese font.
How can I make Chromium use a specific Japenese font to render Japanese text, but a different (the default) font to render non-Japanese text? What fonts need installing?
We can't use another distro; it must be Alpine.
Upvotes: 1
Views: 4932
Reputation: 21
The previous answer provided by browserless above worked for me, however the code file that was linked has changed. I had to dig through the file history to find what he was talking about. So for anyone searching for this in the future. Here is the code I think was being referred to. It solved my issues.
Add these things to your docker file.
ENV font_directory /usr/share/fonts/noto
# Install fonts
RUN mkdir -p $font_directory
RUN cd $font_directory &&\
wget https://github.com/googlei18n/noto-cjk/blob/master/NotoSansCJKsc-Regular.otf?raw=true && \
fc-cache -f -v
Other Noto font libraries can be found here https://www.google.com/get/noto/#sans-hans
Upvotes: 2
Reputation: 2132
I maintain a docker image here that achieves what you're looking for (using system fonts but then other's when needed). More specifically the font browserless uses is Google's own Noto CJK font (this line in the Dockerfile).
Upvotes: 0