This policy governs the packaging and installation of fonts in the ROSA distribution. All packages containing fonts should follow it.


Содержание

Tools

fc-cache (fontconfig)

From fc-cache(1) manpage:

fc-cache scans the font directories on the system and builds
font information cache files for applications using fontconfig
for their font handling.

Should be run in %post and %postun, after adding/removing the font directory to the configuration with chkfontpath (see below), to update the system's font cache.

NOTE: should be Required?


chkfontpath

From chkfontpath(8) manpage:

chkfontpath is mainly used by rpm in its %post and %postun
sections to add and remove new directories to the server's
config file at installation and de-installation time of
packages containing fonts.

In summary, this means something like:

NOTE: should be Required?

freetype-tools (ttmkfdir)

ttmkfdir is an alternative to mkfontdir, for Truetype fonts only. NOTE: Should it be used at all? Preferred? In which cases?

mkfontscale

Should be used to generate fonts.scale, at build time.

mkfontdir

Should be used to generate fonts.dir and encodings.dir, at build time, from fonts plus fonts.scale and fonts.alias.


Rules

Naming

Package name should be like: fonts-$type-$name.

Where:

Fonts subpackages of non-fonts main packages should follow these naming rules too, where $foundryname can be the main package name. See also the Location section below.


Files

Type1 and bitmap font files should be compressed by gzip. TrueType fonts should not.

Location

Each font package should put its fonts in its own subdirectory under /usr/share/fonts/. Like /usr/share/fonts/fonts-ttf-bitstream-vera.

Programs providing their own fonts should package them in subpackage(s), following the naming rules in this policy, and without requiring the main package as far as possible. The subpackage(s) should install the fonts in its own subdirectory under /usr/share/fonts/, named after the main package. Like /usr/share/fonts/fonts-type1-lilypond, or /usr/share/fonts/fonts-bitmap-fluxbox-artwiz.

For a fonts only package (i.e. not a subpackage of a non-fonts package), referring to the font directory by %_datadir/fonts/%name should be valid.

The following alternatives are possible:

  1.  %_datadir/fonts/fonts-ttf-bitstream-vera
  2.  %_datadir/fonts/ttf/fonts-ttf-bitstream-vera
  3.  %_datadir/fonts/ttf-bitstream-vera
  4.  %_datadir/fonts/ttf/bitstream-vera


Packages sharing directories

Right now, some ttf packages put files in a shared /usr/share/fonts/TTF directory, others share /usr/share/fonts/ttf instead (small caps ttf...), others have their own subdirectory under /usr/share/fonts/ttf, others have their own subdirectory under /usr/share/fonts/...). Are there performance problems for having many fonts directories? See below ('Special files' and 'NOTES') for reasoning on per-package font directory.


Special files

These files are created by the font management tools and should be packaged because:

See the cited manpages (specially mkfontdir(1)) for more information.

fonts.scale
used by mkfontdir, created by mkfontscale, may be edited by hand.
fonts.alias
created by hand, used by mkfontdir.
fonts.dir
created by mkfontdir.
encodings.dir
created by mkfontdir.


Configuration files

/etc/fonts/
fontconfig configuration directory.
/etc/X11/fs/config
xfs configuration file, handled by chkfontpath.


Notes


Some extra references


Idea.png
Примечание
This Policy is based on the Mandriva Fonts Packaging Policy.