From Fedora Project Wiki

No edit summary
 
(No difference)

Latest revision as of 21:55, 21 January 2009

A page of the Fonts Special Interest Group

Deprecated template
This template is no longer in use in Fedora; the new versions are referenced in Packaging:FontsPolicy.

The following annotated template is intended to help you understand the Fedora fonts packaging policy. A plain-text version without formatting or annotations is available in the rpmdevtools package.


Conventions
Common directives Comment
Only if you declare fontconfig rules Comment
Some other optional part Comment


Annotated fonts spec template
%define fontname Upstream lowercased project name, without any fonts or font affix.
%define fontdir %{_datadir}/fonts/%{fontname} %{_datadir}/fonts is owned by the filesystem package.
%define fontconfdir %{_sysconfdir}/fonts/conf.d Owned by the filesystem package.
%define archivename Usually a mix of %{fontname} and %{version}.
Name: %{fontname}-fonts See also our grouping conventions.
Version:
  • When in doubt check the version field embedded in TTF or OTF files[1].
  • If upstream is not updating this field regularly, you'll have to resort to  %{alphatag}s.
  • If upstream is never updating this field, use the date of the most recent font file as version.
Release: %{?dist}
Summary: fonts
Group: User Interface/X
License: Make sure you've read and understand our legal page.
URL:
Source0: /%{archivename}.
Source1: %{name}-fontconfig.conf Fontconfig ruleset for the fonts being packaged.
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) Or any other approved choice.
BuildArch: noarch
Conflicts: fontconfig<
  • This directive will ensure concurrent fontconfig updating if your ruleset uses some new syntax fontconfig versions shipped in previous Fedora releases do not understand.
  • Do not use a versioned Requires, as this will force fontconfig installation unconditionally. Resources like fonts must not force the installation of a particular handler.
%description Is the font style unusual, does it cover remarkable unicode blocks? Is the font intended for screen or print media, plain-text or fancy decoration uses?
%prep
%setup -q -n %{archivename}
%build Try to build fonts from source.
%install
rm -fr %{buildroot}
install -m 0755 -d %{buildroot}%{fontdir}
install -m 0644 -p …/*.ttf …/*.otf %{buildroot}%{fontdir}
install -m 0755 -d %{buildroot}%{fontconfdir} For a discussion on the choice of visit our fontconfig page.
install -m 0644 -p %{SOURCE1} %{buildroot}%{fontconfdir}/-%{fontname}.conf
%clean
rm -fr %{buildroot}
%post
  • This ensures fontconfig indexes are refreshed if fontconfig is present on the system; if not the fontconfig package will create them itself on installation[2].
  • Note that while the use of %{fontdir} ensures fc-cache does not waste time on other fonts, it also makes any later %{fontdir} renaming unsafe.
  • The -f parameter forces a refresh in all cases[3]. It must be used in packages targeting pre-Fedora 9 releases.
if [ -x %{_bindir}/fc-cache ] ; then
%{_bindir}/fc-cache -f %{fontdir} || :
fi
%postun
if [ $1 -eq 0 -a -x %{_bindir}/fc-cache ] ; then
%{_bindir}/fc-cache -f %{fontdir} || :
fi
%files
%defattr(0644,root,root,0755) Any other set of permission is almost certain to be a fonts packaging bug.
%doc *.txt
%config(noreplace) %{fontconfdir}/XX-%{fontname}.conf This is sufficient to drop a Fontconfig ruleset that will be evaluated if fontconfig is installed, and will have no effects otherwise[4].
%dir %{fontdir}
%{fontdir}/*.ttf
%{fontdir}/*.otf
%changelog Changelog in approved format.


Fonts in Fedora
The Fonts SIG takes loving care of Fedora fonts. Please join this special interest group if you are interested in creating, improving, packaging, or just suggesting a font. Any help will be appreciated.
  1. For example by double-clicking on them in Nautilus.
  2. In compliance of our no-dependency policy.
  3. For example fc-cache currently relies on timestamps to detect if the font cache needs to be regenenerated, and they're not a reliable reference if the system clock was misconfigured in the past (if the BIOS clock was wrong at install-time). This should be fixed in fontconfig-2.5.
  4. See also our no-dependency policy.