Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add fonts to support more different types of characters for multiple languages #29861

Merged
merged 10 commits into from
Jan 28, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ RUN apt-get update -y && \
libcairo2\
libasound2\
libatspi2.0-0\
libxshmfence1 && \
libxshmfence1 \
fonts-arphic-ukai \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am curios about the list we arrived at here, We don't even have the basic one fonts-liberation for the image.

Do we know if that works?

Here is the list from PW for comparison - https://github.com/microsoft/playwright/blob/5ba7903ba098586a13745e0d7ac894f1d55d47aa/packages/playwright-core/src/utils/nativeDeps.ts#L434-L470

One we use in RUM agent for puppeteer and playwright - https://github.com/elastic/apm-agent-rum-js/tree/master/.ci/docker

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I followed an approach of testing websites and taking note of which didn't display all characters correctly. Then, I went after the packages only for those, and ran an E2E test which generated the images above. I followed this process to avoid adding too many unnecessary packages.

Wrt to fonts-liberation, it seemed to be a standard set of fonts which could just replace the default set of fonts to which it's compatible, but we already have default fonts for western characters in the base image and thus I thought we wouldn't need that. Looking into the other packages, they also seem to fall into one of two categories:

  • Covering standard character sets (like fonts-liberation or ttf-unifont)
  • Tools for managing fonts themselves (like libfontconfig)

The other fonts seemed to be the most complete and popular fonts for their character standards (fonts-arphic-ukai [for chinese characters] , fonts-ipafont-mincho [for japanese characters, fonts-ipafont-gothic being for sans-serif japanese characters], and fonts-unfonts-core for Korean characters). Those were the ones which came up when I looked for packages for each individual language.

We already had support for Arabic/Russian characters in the base image as per the initial test, so I haven't added those as the websites I visited already displayed correctly. It could be the case that there are characters outside the unicode space

Looking at Playwright's deps these are the changes I see we could make:

I moved this PR to draft just so that we would make sure to review the licensing and whether we're happy with the current coverage set. I do thing we should add fonts-tlwg though, so I'll run a test for that before opening this PR for review again too.

fonts-arphic-uming \
fonts-ipafont-mincho \
fonts-ipafont-gothic \
fonts-unfonts-core && \
apt-get clean all && \
exit_code=0 && break || exit_code=$? && echo "apt-get error: retry $iter in 10s" && sleep 10; \
done; \
Expand Down
7 changes: 6 additions & 1 deletion dev-tools/packaging/templates/docker/Dockerfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ RUN apt-get update -y && \
libcairo2\
libasound2\
libatspi2.0-0\
libxshmfence1 && \
libxshmfence1 \
fonts-arphic-ukai \
fonts-arphic-uming \
fonts-ipafont-mincho \
fonts-ipafont-gothic \
fonts-unfonts-core && \
apt-get clean all && \
exit_code=0 && break || exit_code=$? && echo "apt-get error: retry $iter in 10s" && sleep 10; \
done; \
Expand Down