Page MenuHomePhabricator

Properly setup fonts-config on Proton servers
Closed, ResolvedPublic

Description

Following up from T178665, please update puppeteer rules for proton servers to match the best font config for PDF rendering.

I made all necessary changes bu running dpkg-reconfigure fontconfig-config and then selecting:

  • Font tuning method for screen: None
  • Automatic font hinting style: Medium
  • Enable subpixel rendering for screen: always
  • Enable bitmapped fonts by default: No (this config doesn't matter as it does not affect the generated PDF's)

Related Objects

StatusSubtypeAssignedTask
Resolvedovasileva
ResolvedNone
ResolvedBawolff
Resolvedphuedx
Resolvedmobrovac
Resolvedmobrovac
Resolvedphuedx
ResolvedJdrewniak
Resolvedphuedx
Resolvedphuedx
Resolvedphuedx
Resolvedphuedx
DeclinedNone
Resolvedbmansurov
Resolvedmobrovac
Resolvedovasileva
InvalidNone
ResolvedJdlrobson
Resolvedphuedx
Resolvedphuedx
Resolvedholger.knust
ResolvedTgr
Resolvedjijiki
ResolvedMSantos
Resolvedmobrovac
Resolvedovasileva
Resolvedphuedx
Declinedpmiazga
ResolvedDzahn
Resolvedpmiazga
Duplicateholger.knust
ResolvedMSantos
ResolvedTgr
ResolvedJohan
OpenNone
Resolvedovasileva
InvalidNone
Resolvedmobrovac
Resolvedmobrovac

Event Timeline

@pmiazga your running manually the command should have produced a fonts.conf file. Can you please attach it to this task? For reference, here is the config that has been used for Electron.

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <match target="font">
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hinting">
   <bool>false</bool>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hintstyle">
   <const>hintslight</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="antialias">
   <bool>true</bool>
  </edit>
 </match>
  <match target="font">
    <edit mode="assign" name="lcdfilter">
      <const>lcddefault</const>
    </edit>
  </match>
</fontconfig>

But I'd like to point that the fontconfig-config package created lots of 20-unhint-*.conf files:

lrwxrwxrwx 1 root root   50 Aug 16  2016 20-unhint-small-dejavu-lgc-sans.conf -> ../conf.avail/20-unhint-small-dejavu-lgc-sans.conf
lrwxrwxrwx 1 root root   55 Aug 16  2016 20-unhint-small-dejavu-lgc-sans-mono.conf -> ../conf.avail/20-unhint-small-dejavu-lgc-sans-mono.conf
lrwxrwxrwx 1 root root   51 Aug 16  2016 20-unhint-small-dejavu-lgc-serif.conf -> ../conf.avail/20-unhint-small-dejavu-lgc-serif.conf
lrwxrwxrwx 1 root root   46 Aug 16  2016 20-unhint-small-dejavu-sans.conf -> ../conf.avail/20-unhint-small-dejavu-sans.conf
lrwxrwxrwx 1 root root   51 Aug 16  2016 20-unhint-small-dejavu-sans-mono.conf -> ../conf.avail/20-unhint-small-dejavu-sans-mono.conf
lrwxrwxrwx 1 root root   47 Aug 16  2016 20-unhint-small-dejavu-serif.conf -> ../conf.avail/20-unhint-small-dejavu-serif.conf
lrwxrwxrwx 1 root root   58 Aug 24  2016 20-unhint-small-vera.conf -> /usr/share/fontconfig/conf.avail/20-unhint-small-vera.conf

Everything is available on deployment-chromium01 server (I did all tests there)

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
[...]
</fontconfig>

Where is this file? I've tried searching for it on deployment-chromium01 but can't find it.

But I'd like to point that the fontconfig-config package created lots of 20-unhint-*.conf files:

lrwxrwxrwx 1 root root   50 Aug 16  2016 20-unhint-small-dejavu-lgc-sans.conf -> ../conf.avail/20-unhint-small-dejavu-lgc-sans.conf
lrwxrwxrwx 1 root root   55 Aug 16  2016 20-unhint-small-dejavu-lgc-sans-mono.conf -> ../conf.avail/20-unhint-small-dejavu-lgc-sans-mono.conf
lrwxrwxrwx 1 root root   51 Aug 16  2016 20-unhint-small-dejavu-lgc-serif.conf -> ../conf.avail/20-unhint-small-dejavu-lgc-serif.conf
lrwxrwxrwx 1 root root   46 Aug 16  2016 20-unhint-small-dejavu-sans.conf -> ../conf.avail/20-unhint-small-dejavu-sans.conf
lrwxrwxrwx 1 root root   51 Aug 16  2016 20-unhint-small-dejavu-sans-mono.conf -> ../conf.avail/20-unhint-small-dejavu-sans-mono.conf
lrwxrwxrwx 1 root root   47 Aug 16  2016 20-unhint-small-dejavu-serif.conf -> ../conf.avail/20-unhint-small-dejavu-serif.conf
lrwxrwxrwx 1 root root   58 Aug 24  2016 20-unhint-small-vera.conf -> /usr/share/fontconfig/conf.avail/20-unhint-small-vera.conf

Actually, your reconfiguration created only a handful of new symlinks:

lrwxrwxrwx 1 root root   54 Jul  6 19:54 10-sub-pixel-rgb.conf -> /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf
lrwxrwxrwx 1 root root   49 Jul  6 19:54 10-unhinted.conf -> /usr/share/fontconfig/conf.avail/10-unhinted.conf
lrwxrwxrwx 1 root root   52 Jul  6 19:54 70-yes-bitmaps.conf -> /usr/share/fontconfig/conf.avail/70-yes-bitmaps.conf

These might be enough to reproduce in production to get the desired effect.

Those changes were in /etc/fonts/fonts.conf and /etc/fonts/conf.d/51-local.conf but looks like they are overriten.

To get into the state we want to have, we just need to run dpkg-reconfigure fontconfig-config. Task description says which options works the best with the PDF renderer.

Change 468545 had a related patch set uploaded (by Mobrovac; owner: Mobrovac):
[operations/puppet@production] Proton: Configure the fonts

https://gerrit.wikimedia.org/r/468545

Change 468545 merged by Alexandros Kosiaris:
[operations/puppet@production] Proton: Configure the fonts

https://gerrit.wikimedia.org/r/468545

@pmiazga the font changes have been applied. Could you check the output of the PDFs in production now?

@mobrovac sure, will do, I just have a question, how can I get the PDF from production? I know how to get those from Beta Cluster, but I never tried to fetch the PDF from production

@mobrovac sure, will do, I just have a question, how can I get the PDF from production? I know how to get those from Beta Cluster, but I never tried to fetch the PDF from production

Use https://{domain}/api/rest_v1/page/pdf/{title}?new_pdf=true

Fonts are ok, PDF looks good and the hinting/kerning is correct. Thanks for fixing the fonts issue.

mobrovac triaged this task as Medium priority.

Resolving given the above. Please reopen if something turns up.