Fonts policy

Материал из Rosalab Wiki
Перейти к: навигация, поиск
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:

  • In %post: %{_sbindir}/chkfontpath -q -a %{_datadir}/fonts/%{name}
  • In %postun: %{_sbindir}/chkfontpath -q -r %{_datadir}/fonts/%{name}

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:

  • $type would be one of:
    • ttf
      TrueType fonts (*.ttf)
      type1
      Postscript Type1 fonts (*.pfb, *.pfa, *.afm, *.pfm)
      bitmap
      fixed size, bitmapped, fonts (*.pcf, *.bdf)
  • $name would be either:
    • the font name
      fonts-type1-hebrew
      $foundryname-$fontname
      fonts-ttf-bitstream-vera

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:

  • avoiding unpackaged and/or %ghost files lost in the system
  • reducing run time dependencies (on the tools that generate them)
  • they (at least some of them) may be hand edited for fixing/tuning (see mkfontscale(1) and mkfontdir(1) manpages)

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

  • fonts coming from Xorg are being named x11-font-$name-$type
    • should they be excepted from naming policy? or have own policy rules? or be adapted?
  • fonts sharing directory must run mkfontscale and mkfontdir (or alikes) at %post and %postun.
  • why some fonts require chkfontpath, while most simply test for and use if it exists?
  • what is the relation of Xorg X chkfontpath?
  • why Xorg fonts (x11-font-*) don't run fc-cache in %post/%postun?


Some extra references


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