From Fedora Project Wiki

Revision as of 13:04, 20 December 2008 by Nim (talk | contribs) (New page: {{CompactHeader|fonts-sig}} This template can be used with simple font releases (one font family in one upstream archive): * if you're unlucky enough upstream released several font famili...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A page of the Fonts Special Interest Group

This template can be used with simple font releases (one font family in one upstream archive):

  • if you're unlucky enough upstream released several font families in a single archive, use spectemplate-fonts-multi.spec
  • if upstream releases separate fonts in separate achives, do not try to stuff them in a single spec/package, just package them separately.

Please remove the template comments when creating your own file; <FOO> must be replaced by something appropriate for your font.


Replace <FONTNAME> with something appropriate such as foundryname-fontname. For Fedora purposes a “foundry” is an entity that publishes a set of fonts with consistent QA rules[1]. If fontname already includes the font or fonts affix, drop it.
%define fontname <FONTNAME>
fontconf is the optional fontconfig ruleset for the fonts being packaged. For more information on choosing the right fontconfig priorities, see this page.
%define fontconf <XX>-%{fontname}.conf

Optional
#define archivename %{name}-%{version}

Name:           %{fontname}-fonts
Do not trust font metadata versionning[2], unless you've checked upstream does update versions on file changes. When in doubt use the timestamp of the most recent font file as version, for example 20081231.
Version:        
Release:        1%{?dist}
Font summaries need to be short and to the point. Usual informations are font style and Unicode coverage. Only repeat the font name(s) if you don't have anything else to write.
Summary:        
Group:          User Interface/X
Make sure you've read and understand our legal page.
License:        
URL:            
Source0:        
Source1:        %{name}-fontconfig.conf
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

BuildArch:     noarch
BuildRequires: fontpackages-devel
Requires:      fontpackages-filesystem

Font descriptions must detail information on the font style, Unicode coverage, and intended use[3] to help users choose the right packages to install. Also, it is considered good form to credit the original font designer and sum up the font history.

Incidentally, this is a good way to check if the licensing information declared by upstream is correct and if some fontconfig substitution rules can be added to the package.

Examples of terrific font descriptions are found on the Greek Font Society web site. This is what other font packages should strive to emulate.

%description

%prep
%setup -q

Building fonts from sources is always preferred. For GPLed or LGPLed fonts this is required by the license.
%build


%install
rm -fr %{buildroot}

install -m 0755 -d %{buildroot}%{_fontdir}
Change *.ttf to the actual location of your font files (in a subdirectory, in this directory with an otf extension, etc).
install -m 0644 -p *.ttf %{buildroot}%{_fontdir}

install -m 0755 -d %{buildroot}%{_fontconfig_templatedir} \
                   %{buildroot}%{_fontconfig_confdir}

install -m 0644 -p %{SOURCE1} \
        %{buildroot}%{_fontconfig_templatedir}/%{fontconf}
To package a fontconfig ruleset disabled by default:
  • install it in %{_fontconfig_templatedir},
  • create symbolic link with the same name in %{_fontconfig_confdir}, that points to /dev/null.
ln -s %{_fontconfig_templatedir}/%{fontconf} \
      %{buildroot}%{_fontconfig_confdir}/%{fontconf}


%clean
rm -fr %{buildroot}


%_font_pkg -f %{fontconf} *.ttf

%doc
%dir %{_fontdir}


%changelog

Notes:

  1. Thus Sourceforge is not a foundry
  2. The metadata embedded in TTF or OTF files.
  3. Print, screen, headings, code…


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.