Page MenuHomePhabricator

Replace Liberation 1 fonts with Liberation 2 for svg rendering
Closed, ResolvedPublic


The Thumbor servers currently use fonts-liberation 1.07.4 for the Liberation font family. Liberation Serif is used as the default font for SVG rendering , but Liberation 1 doesn't always produce nice results at smaller sizes (T247567). I would suggest moving to fonts-liberation2 for thumbnail rendering. It is more actively maintained, and produces generally better results.

Test files are at 270px.

Liberation Sans 1

wmf270px-Sea_level_history_and_projections.svg.png (203×270 px, 14 KB)

Liberation Sans 2

lib2270px-Sea_level_history_and_projections.svg.png (203×270 px, 15 KB)

Event Timeline

herron triaged this task as Medium priority.Jul 27 2020, 8:20 PM

Change 728568 had a related patch set uploaded (by AntiCompositeNumber; author: AntiCompositeNumber):

[operations/puppet@production] mediawiki::packages::fonts: replace fonts-liberation with fonts-liberation2

@AntiCompositeNumber does this merit a User-notice ahead of time or is it subtle enough that people won't notice?

On stretch and buster, I see liberation2 installing:


liberation1 installs:


So we'd be losing all the LiberationSansNarrow variants - is that OK?


Note: 2.00.0 onward releases does not includes Liberation Sans Narrow font due to licensing problems. Please refer to older releases for Liberation Sans Narrow font.

(Liberation 1 is under a modified GPL license)

There is no 2.0 version of Liberation Sans Narrow. It was moved to a separate repository in 1.07.5, but Debian has not updated from 1.07.4 and does not package it separately. I don't know if that's intentional to avoid the split or if it's just due to lack of maintenance for the v1 package.

As I mentioned on Gerrit, I don't see anything in fontconfig's documentation that would cause it to consistently select Liberation 2 fonts over Liberation 1 fonts.

The canonical font pattern is finally matched against all available fonts. The distance from the pattern to the font is measured for each of several properties: foundry, charset, family, lang, spacing, pixelsize, style, slant, weight, antialias, rasterizer and outline. This list is in priority order -- results of comparing earlier elements of this list weigh more heavily than later elements.

All of those properties are the same between the two fonts (except liberation 2 supports more languages). The only changes I see in fc-match -s Liberation -v are in fontversion and charset. Looking at, it appears that fontversion is actually compared when matching fonts, it's just undocumented 🙄.

I don't think it's worth the hassle of creating a separate package for Liberation Sans Narrow ourselves. There's no good way (outside curl | greping a few hundred GB of SVG files) to determine if the narrow fonts are in use, so I think the better option is to keep fonts-liberation installed and hope fontconfig matches the fonts consistently. If Debian ever splits the package we can switch then.

As far as User-notice goes, I'm not sure. I only found one previous example of SVG font changes being included (in 2014) but I also wouldn't be surprised if someone filed a task in a week saying "why are the fonts different in different sized thumbnails of my SVG". I'm happy to let the Tech News editors make that decision though.

  • The version of the Liberation fonts used in SVG files will be upgraded. Only new thumbnails will be affected. Liberation Sans Narrow will not change.


  • New thumbnails means all thumbnails of new files, all thumbnails of new versions of files, thumbnails of old files that had not been previously generated at that width, and thumbnails of files purged with ?action=purge (usually).
  • Users can't switch back to the old fonts.
  • Thumbor SVG rendering is the only thing I know this affects. The only other service that used this font list was Graphoid. I don't know if MediaWiki uses them for anything.
  • The change is most visible at thumbnail sizes (usually 200-500px).

Do you know when this would be in production, or is it too early to tell?

Hi @AntiCompositeNumber. If I understand correctly, this should be included in the next issue of Tech News (going out Monday) within the "Future changes" section? Please confirm. And thank you for supplying the suggested text!

Hi @AntiCompositeNumber. If I understand correctly, this should be included in the next issue of Tech News (going out Monday) within the "Future changes" section? Please confirm. And thank you for supplying the suggested text!

Yes please. I set a reminder to merge the puppet change on Tuesday.

Change 728568 merged by Legoktm:

[operations/puppet@production] mediawiki::packages::fonts: replace fonts-liberation with fonts-liberation2

This update might trigged a difference in rendering between SVG-check vs Commons-Rendering, see T335415 (not only the font is different also the alignment is different on small thumbnails)