From Fedora Project Wiki

No edit summary
(Fonts spec template (2008-10-01) has been moved, it is now a redirect to Fonts spec template (2007-10-01))
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{CompactHeader|fonts}}
#REDIRECT [[Fonts spec template (2007-10-01)]]
 
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 [https://fedorahosted.org/rpmdevtools/browser/spectemplate-fonts.spec rpmdevtools package].
 
 
== Conventions ==
 
{| style="font-family:monospace; background-color:#FFFAE9; font-family:monospace;"
|-
| Common directives
| style="font-family:sans-serif; font-style:italic; color:#00578E;" | Comment
|- style="background-color:#ffdebc;"
| Only if you declare fontconfig rules
| style="font-family:sans-serif; font-style:italic; color:#990033;" | Comment
|- style="background-color:#ffe4f5;"
| Some other optional part
| style="font-family:sans-serif; font-style:italic; color:#663366;" | Comment
|}
 
== Spec ==
 
{| style="font-family:monospace; background-color:#FFFAE9; font-family:monospace;"
|-
| width="60%" | %define fontname xxx
| width="40%" style="font-family:sans-serif; font-style:italic; color:#00578E;" | Upstream lowercased project name.
|-
|
|
|-
| %define fontdir %{_datadir}/fonts/%{fontname}
| style="font-family:sans-serif; font-style:italic; color:#00578E;" | '''%{_datadir}/fonts''' is owned by the '''filesystem''' package.
|- style="background-color:#ffdebc;"
| %define fontconfdir %{_sysconfdir}/fonts/conf.d
| style="font-family:sans-serif; font-style:italic; color:#990033;" | Owned by the filesystem package.
|-
|
|
|- style="background-color:#ffe4f5;"
| %define archivename xxx
| style="font-family:sans-serif; font-style:italic; color:#663366;" | Usually a mix of '''%{fontname}''' and '''%{version}'''.
|-
|
|
|-
| Name: %{fontname}-fonts
| style="font-family:sans-serif; font-style:italic; color:#00578E;" | See also our grouping conventions.
|-
| Version:
| style="font-family:sans-serif; font-style:italic; color:#00578E;" | When in doubt check the version field embedded in TTF files<ref>For example unsing '''nautilus'''</ref>. 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: X%{?dist}
|
|-
| Summary: Xxx fonts
|
|-
|
|
|-
| Group: User Interface/X
|
|-
| License: XXX
| style="font-family:sans-serif; font-style:italic; color:#00578E;" | Make sure you've read and understand our legal page.
|-
URL:
 
Source0: …/%{archivename}.xxx
 
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<xxx
 
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?
 
XXX…
 
 
 
%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 xxx/*.ttf xxx/*.otf %{buildroot}%{fontdir}
 
 
install -m 0755 -d %{buildroot}%{fontconfdir}
 
install -m 0644 -p %{SOURCE1} %{buildroot}%{fontconfdir}/XX-%{fontname}.conf
 
For a discussion on the choice of XX, visit our fontconfig section.
 
 
 
%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 installation3. 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 cases4. 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" = "0" ]; then
 
if [ -x %{_bindir}/fc-cache ]; then
 
%{_bindir}/fc-cache -f %{fontdir} || :
 
fi
 
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 otherwise5.
 
 
%dir %{fontdir}
 
%{fontdir}/*.ttf
 
%{fontdir}/*.otf
 
 
 
%changelog
 
Changelog in approved format.
|}
 
{{:Fonts_SIG_signature}}
[[Category:Fonts packaging|Spec template]]

Latest revision as of 21:55, 21 January 2009