From Fedora Project Wiki
(Motivation)
(How To Test)
Line 172: Line 172:
 
1. Currently this Change implementation is available in https://copr.fedorainfracloud.org/coprs/pnemade/FontLangProvidesToLangpacks/ Copr repository for F31+ releases. Download and enable this repository on your system.
 
1. Currently this Change implementation is available in https://copr.fedorainfracloud.org/coprs/pnemade/FontLangProvidesToLangpacks/ Copr repository for F31+ releases. Download and enable this repository on your system.
  
2. Now if you want to install font for Japanese language, check which package is providing `font(:lang=ja)` dependency
+
2. Now if you want to install font for Hindi language, check which package is providing `font(:lang=hi)` dependency
   $ dnf repoquery --whatprovides "font(:lang=ja)" --recent
+
   $ dnf repoquery --whatprovides "font(:lang=hi)" --recent
     langpacks-core-ja-0:2.0-9.1.testing.fc32.noarch
+
     langpacks-core-hi-0:2.0-9.testing.fc32.noarch
  
3. Check if any font packages are still there which are providing `font(:lang=ja)` dependency. Again same above command shows only one package in Fedora now providing Japanese language font.
+
3. Check if any font packages are still there which are providing `font(:lang=hi)` dependency. Again same above command shows only one package in Fedora now providing Hindi language font.
  
4. Check that langpacks-core-* pulls in the only one default expected font for the language.
+
4. Try to install default font for Hindi language as
 
   <pre>
 
   <pre>
   ⬢[parag@toolbox fedora]$ sudo dnf install langpacks-core-ja
+
   $ sudo dnf install "font(:lang=hi)"
Last metadata expiration check: 0:00:28 ago on Mon Jan 13 19:50:39 2020.
+
Last metadata expiration check: 0:13:05 ago on Tue Jan 14 09:22:54 2020.
 
Dependencies resolved.
 
Dependencies resolved.
 
===============================================================================
 
===============================================================================
  Package                       Arch  Version             Repository   Size
+
  Package               Arch  Version                 Repository         Size
 
===============================================================================
 
===============================================================================
 
Installing:
 
Installing:
  langpacks-core-ja              noarch 2.0-9.1.testing.fc32 copr:copr.fedorainfracloud.org:pnemade:FontLangProvidesToLangpacks
+
  langpacks-core-hi      noarch 2.0-9.1.testing.fc32   copr:copr.fedorainfracloud.org:pnemade:FontLangProvidesToLangpacks
 
                                                                         8.8 k
 
                                                                         8.8 k
 
Installing dependencies:
 
Installing dependencies:
  google-noto-cjk-fonts-common  noarch 20190416-5.fc31      rawhide      20 k
+
  lohit-devanagari-fonts noarch 2.95.4-10.fc32.testing1 copr:copr.fedorainfracloud.org:pnemade:FontLangProvidesToLangpacks
google-noto-sans-cjk-ttc-fonts noarch 20190416-5.fc31      rawhide      86 M
+
                                                                          92 k
  
 
Transaction Summary
 
Transaction Summary
 
===============================================================================
 
===============================================================================
Install  3 Packages
+
Install  2 Packages
  
Total download size: 86 M
+
Total download size: 101 k
Installed size: 130 M
+
Installed size: 179 k
....
+
Is this ok [y/N]:
 +
 
 +
</pre>
 +
 
 +
This shows we got default Hindi font installed. If you run the same command in Fedora 31 without this copr repo you will see different output which is not default font. See
 +
<pre>
 +
$ sudo dnf install "font(:lang=hi)"
 +
Last metadata expiration check: 0:17:28 ago on Tue 14 Jan 2020 09:22:37 AM IST.
 +
Package google-droid-sans-fonts-20120715-16.fc31.noarch is already installed.
 +
Dependencies resolved.
 +
Nothing to do.
 +
Complete!
 
</pre>
 
</pre>
  

Revision as of 04:12, 14 January 2020


Move fonts language Provides to Langpacks

Summary

Move Provides: font(:lang=...) from fonts packages into the langpacks package, giving predictable default fonts for language scripts.

Motivation

Currently in Fedora fonts packages have auto-generated font(:lang=...) provides, which can be used as a dependency identifier to satisfy font coverage required for a certain language requirement. This can be used by GTK applications to install missing fonts via PackageKit for example. However in practice this has not been very useful since usually there are multiple assorted fonts that provide the language coverage and so an arbitrary fonts of unknown quality would get selected, so the mechanism is not reliable.

This change instead moves font(:lang=xy) provides to langpacks-core-xy which pulls in the expected default font for that language, to give reliable predictable default fonts for each language and improve the user application experience around fonts.

Owner

Current status

  • Targeted release: Fedora 32
  • Last updated: 2020-01-14
  • Tracker bug: <will be assigned by the Wrangler>

Detailed Description

The language based metadata for fonts packages was introduced in Fedora 11. The idea being to provide a mechanism to find and install a font for missing glyphs through PackageKit and was useful for minority languages which might be missing default installed fonts packages. But the user experience was generally not very good.

Users cannot predict which fonts will be installed. This often leads to poor fonts choices installed, particularly for languages with too many available fonts such as English, since the first font found lexically will be arbitrarily chosen with guarantee of quality or expected style. This random dependency resolution sometimes introduces highly unexpected results too - for example a font from an external repository may get chosen by chance. This would be particularly problematic when composing ISOs, eg when including EPEL.

So this Change proposal aims to improve the user experience around font dependencies by moving the Provides: tag into the langpacks package instead. Langpacks contains various dependencies to help to use that langpacks language. Langpacks have langpacks-core-* subpackages which installs default font and input-method. Once Provides: tag added to these subpackages, whenever missing glyph font installation is requested, only langpacks-core-<lang> package will get installed which will be anyway already having default font set using Requires: tag.

Currently font provides are auto-generated using fc-query by rpm like this:

$ fc-query -f %{=pkgkit}  /usr/share/fonts/dejavu/DejaVuSans.ttf
font(dejavusans)
font(:lang=aa)
font(:lang=ab)
...

and at the font package build time, it is transformed to:

Provides: font(dejavusans)
Provides: font(:lang=aa)
Provides: font(:lang=ab)
...

After this proposal will be implemented, the above result will be:

Provides: font(dejavusans)

and then add Provides: font(:lang=...) line to corresponding sub-packages langpacks-core-*.

So asking for a font for a certain language through PackageKit will be achieved by langpacks-core-* instead of a random font package.

Benefit to Fedora

This proposal will provide reliable, predictable, and consistent font dependencies.


Scope

  • Proposal owners:
    • Update fontconfig to drop generating font(:lang=...) from the alias of the formatter for %{=pkgkit}
    • Add a line of Provides: font(:lang=...) to each langpacks-core-.... For instance, Provides: font(:lang=hi) needs to be added to langpacks-core-hi.


  • Other developers: Release Engineers needs to rebuild all fonts packages with the updated fontconfig package.
  • Policies and guidelines: None
  • Trademark approval: None

Upgrade/compatibility impact

Some packages may be installed after upgrading if corresponding langpacks-core-* packages isn't yet installed.


How To Test

1. Currently this Change implementation is available in https://copr.fedorainfracloud.org/coprs/pnemade/FontLangProvidesToLangpacks/ Copr repository for F31+ releases. Download and enable this repository on your system.

2. Now if you want to install font for Hindi language, check which package is providing font(:lang=hi) dependency

  $ dnf repoquery --whatprovides "font(:lang=hi)" --recent
    langpacks-core-hi-0:2.0-9.testing.fc32.noarch

3. Check if any font packages are still there which are providing font(:lang=hi) dependency. Again same above command shows only one package in Fedora now providing Hindi language font.

4. Try to install default font for Hindi language as

   $ sudo dnf install "font(:lang=hi)"
Last metadata expiration check: 0:13:05 ago on Tue Jan 14 09:22:54 2020.
Dependencies resolved.
===============================================================================
 Package                Arch   Version                 Repository         Size
===============================================================================
Installing:
 langpacks-core-hi      noarch 2.0-9.1.testing.fc32    copr:copr.fedorainfracloud.org:pnemade:FontLangProvidesToLangpacks
                                                                         8.8 k
Installing dependencies:
 lohit-devanagari-fonts noarch 2.95.4-10.fc32.testing1 copr:copr.fedorainfracloud.org:pnemade:FontLangProvidesToLangpacks
                                                                          92 k

Transaction Summary
===============================================================================
Install  2 Packages

Total download size: 101 k
Installed size: 179 k
Is this ok [y/N]: 

This shows we got default Hindi font installed. If you run the same command in Fedora 31 without this copr repo you will see different output which is not default font. See

$ sudo dnf install "font(:lang=hi)"
Last metadata expiration check: 0:17:28 ago on Tue 14 Jan 2020 09:22:37 AM IST.
Package google-droid-sans-fonts-20120715-16.fc31.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!

User Experience

Users should see better quality fonts for the chosen languages when they install a font to cover a certain language script through PackageKit or through font meta dependencies of other packages.


Dependencies

All fonts packages

Contingency Plan

  • Contingency mechanism: proposal owners will revert all the changes and rebuild all fonts packages to add back the provides.
  • Contingency deadline: the beta freeze
  • Blocks release? No
  • Blocks product? N/A

Documentation

N/A

Release Notes