From Fedora Project Wiki

(Fix link to spec templates)
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{CompactHeader|fonts-sig}}
{{CompactHeader|fonts-sig}}


{{Admon/warning|Complex formatting ahead|The template on this page is heavily annotated. Its official version is always available in plain text in the [[Fedora fonts policy package|fontpackages package]].}}
{{Admon/warning|Complex formatting ahead|This page presents an heavily annotated template. Its official version is always available in plain text in the [[Fedora fonts policy package|fontpackages package]].}}


== Foreword ==
== Foreword ==
Line 12: Line 12:


== The template ==
== The template ==
{{Admon/warning|The following template is totally outdated. you should copy a template from fontpackages for your package. the latest is available [https://pagure.io/fontpackages/blob/master/f/spec-templates here].}}


{{Rightnote|<pre>%define fontname <FONTNAME></pre>|{{:Fonts spec template notes/fontname}}}}
{{Rightnote|<pre>%global fontname <FONTNAME></pre>|{{:Fonts spec template notes/fontname}}}}
{{Rightnote|<pre>%define fontconf <XX>-%{fontname}.conf</pre>|{{:Fonts spec template notes/fontconfig-prio}}}}<pre>
{{Rightnote|<pre>%global fontconf <XX>-%{fontname}.conf</pre>|{{:Fonts spec template notes/fontconfig-prio}}}}
 
{{Rightnote|<pre>#global archivename %{name}-%{version}</pre>|Optional}}<pre>
</pre>{{Rightnote|<pre>#define archivename %{name}-%{version}</pre>|Optional}}<pre>


Name:          %{fontname}-fonts
Name:          %{fontname}-fonts
</pre>{{Rightnote|<pre>Version:        </pre>|{{:Fonts spec template notes/font-versions}}}}<pre>
</pre>{{Rightnote|<pre>Version:        </pre>|{{:Fonts spec template notes/font-versions}}}}<pre>
Release:        1%{?dist}
Release:        1%{?dist}
</pre>{{Rightnote|<pre>Summary:        </pre>|{{:Fonts spec template notes/summary}}}}<pre>
</pre>{{Rightnote|<pre>Summary:        </pre>|{{:Fonts spec template notes/summary}}}}
Group:          User Interface/X
{{Rightnote|<pre>License:        </pre>|{{:Fonts spec template notes/licensing}}}}<pre>
</pre>{{Rightnote|<pre>License:        </pre>|{{:Fonts spec template notes/licensing}}}}<pre>
URL:             
URL:             
Source0:         
Source0:         
Source1:        %{name}-fontconfig.conf
Source1:        %{name}-fontconfig.conf
</pre>{{Rightnote|<pre>BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)</pre>|{{:Fonts spec template notes/buildroot}}}}<pre>
</pre>
<pre>


BuildArch:    noarch
BuildArch:    noarch
Line 43: Line 43:


%install
%install
rm -fr %{buildroot}
install -m 0755 -d %{buildroot}%{_fontdir}
install -m 0755 -d %{buildroot}%{_fontdir}
</pre>{{Rightnote|<pre>install -m 0644 -p *.ttf %{buildroot}%{_fontdir}</pre>|{{:Fonts spec template notes/font-install}}}}<pre>
</pre>{{Rightnote|<pre>install -m 0644 -p *.ttf %{buildroot}%{_fontdir}</pre>|{{:Fonts spec template notes/font-install}}}}<pre>
Line 54: Line 52:
         %{buildroot}%{_fontconfig_templatedir}/%{fontconf}
         %{buildroot}%{_fontconfig_templatedir}/%{fontconf}
</pre>{{Rightnote|<pre>ln -s %{_fontconfig_templatedir}/%{fontconf} \
</pre>{{Rightnote|<pre>ln -s %{_fontconfig_templatedir}/%{fontconf} \
       %{buildroot}%{_fontconfig_confdir}/%{fontconf}</pre>|{{:Fonts spec template notes/fontconfig-passive-ruleset}}}}<pre>
       %{buildroot}%{_fontconfig_confdir}/%{fontconf}</pre>|{{:Fonts spec template notes/fontconfig-passive-ruleset}}}}{{Rightnote|<pre>%_font_pkg -f %{fontconf} *.ttf</pre>|{{:Fonts spec template notes/font_pkg}}}}<pre>
 
 
%clean
rm -fr %{buildroot}
 
 
</pre>{{Rightnote|<pre>%_font_pkg -f %{fontconf} *.ttf</pre>|{{:Fonts spec template notes/font_pkg}}}}<pre>


</pre>{{Rightnote|<pre>%doc</pre>|{{:Fonts spec template notes/doc}}}}<pre>
</pre>{{Rightnote|<pre>%doc</pre>|{{:Fonts spec template notes/doc}}}}<pre>
%dir %{_fontdir}


</pre>{{Rightnote|<pre>%changelog</pre>|{{:Fonts spec template notes/changelog}}}}
</pre>{{Rightnote|<pre>%changelog</pre>|{{:Fonts spec template notes/changelog}}}}


Notes:
Notes:

Latest revision as of 09:23, 4 June 2019

A page of the Fonts Special Interest Group

Complex formatting ahead
This page presents an heavily annotated template. Its official version is always available in plain text in the fontpackages package.

Foreword

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 this less simple template;
  • if upstream releases separate fonts in separate archives, do not try to stuff them in a single spec/package, just package them separately.
What is a font family?
  • A font family corresponds to one entry in GUI font lists. For example, DejaVu Sans, DejaVu Serif and DejaVu Sans Mono are three different font families.
  • A font family is subdivided in faces or styles. DejaVu Sans Normal, DejaVu Sans Bold, DejaVu Sans Condensed Italic are three faces of the DejaVu Sans font family.
  • A font-metadata aware tool such as gnome-font-viewer[1] or fontforge[2] can be used to check the font family name and the font face/style declared by a font file.

The template

The following template is totally outdated. you should copy a template from fontpackages for your package. the latest is available here.
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[3]. If fontname already includes the font or fonts affix, drop it.
%global 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.
%global fontconf <XX>-%{fontname}.conf
Optional
#global archivename %{name}-%{version}

Name:           %{fontname}-fonts
Do not trust font metadata versionning[4], 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:        
Make sure you've read and understand our legal page.
License:        
URL:            
Source0:        
Source1:        %{name}-fontconfig.conf

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

Font descriptions must detail information on the font style, Unicode coverage, and intended use[5] 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
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}
The %_font_pkg macro takes the following arguments:
  • an optional -n name subpackage name
  • an optional -f pattern fontconfig pattern name. The corresponding files must be installed by the packager in %{_fontconfig_templatedir} and %{_fontconfig_confdir} in the %install section.
  • a list of font names or font name patterns. The corresponding files must be installed by the packager in %{_fontdir} in the %install section.
%_font_pkg -f %{fontconf} *.ttf

Documentation usually includes licensing and other information in plain text or PDF[6] format. Make sure your text files use maximum 80 column lines with Unix-style line ends and are encoded in UTF-8.
%doc

Use one of the approved formats.
%changelog


Notes:

  1. Simple, but sadly not available in each and every Fedora release.
  2. Type <CTRL> + <SHIFT> + <F> to open the font metadata window in fontforge.
  3. Thus Sourceforge is not a foundry
  4. The metadata embedded in TTF or OTF files.
  5. Print, screen, headings, code…
  6. For example, font specimen pages


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.