%global fontname hack %global fontconf 45-%{fontname}.conf Name: %{fontname}-fonts Version: 3.003 Release: 1%{?dist} Summary: A typeface designed for source code License: Bitstream Vera, Public Domain, and MIT URL: https://sourcefoundry.org/hack/ Source0: https://github.com/source-foundry/Hack/archive/v%{version}/Hack-v%{version}.tar.gz Source1: %{fontname}.metainfo.xml BuildArch: noarch BuildRequires: fontpackages-devel BuildRequires: libappstream-glib # To build Hack BuildRequires: python3 BuildRequires: ttfautohint Requires: fontpackages-filesystem %description Hack is a typeface designed for source code, expanding on the works of Bitstream Vera and DejaVu. %prep %setup -q -c # BUG-1441023: Currently there isn't a fontmake package in the Fedora # repository, rather than installing it the packager's system - use virtual # environment :) python3 -m venv venv venv/bin/python3 -m pip install fontmake venv/bin/python3 -m pip install fonttools # Python doesn't seem to resolve the following (:S) venv/bin/python3 -m pip install fs %build # Rather than patch 'build-ttf.sh', it is re-implemented here - this allows # the virtual environments to be used easier BUT it does mean that it needs # to be reviewed EVERY update to reproduce Source Foundry's build process. # The same would also be true of a patch, but there is not validation with # this. # First pass with fontmake venv/bin/python3 -m fontmake -u "Hack-%{version}/source/Hack-Regular.ufo" -o ttf venv/bin/python3 -m fontmake -u "Hack-%{version}/source/Hack-Bold.ufo" -o ttf venv/bin/python3 -m fontmake -u "Hack-%{version}/source/Hack-Italic.ufo" -o ttf venv/bin/python3 -m fontmake -u "Hack-%{version}/source/Hack-BoldItalic.ufo" -o ttf # Second pass with fontbakery venv/bin/python3 "Hack-%{version}/postbuild_processing/fixes/fix-dsig.py" master_ttf/*.ttf venv/bin/python3 "Hack-%{version}/postbuild_processing/fixes/fix-fstype.py" master_ttf/*.ttf # Third pass with ttfautohint mkdir master_ttf/hinted ttfautohint -l 6 -r 50 -x 10 -H 181 -D latn -f latn -w G -W -t -X "" -I -m "Hack-%{version}/postbuild_processing/tt-hinting/Hack-Regular-TA.txt" "master_ttf/Hack-Regular.ttf" "master_ttf/hinted/Hack-Regular.ttf" ttfautohint -l 6 -r 50 -x 10 -H 260 -D latn -f latn -w G -W -t -X "" -I -m "Hack-%{version}/postbuild_processing/tt-hinting/Hack-Bold-TA.txt" "master_ttf/Hack-Bold.ttf" "master_ttf/hinted/Hack-Bold.ttf" ttfautohint -l 6 -r 50 -x 10 -H 145 -D latn -f latn -w G -W -t -X "" -I -m "Hack-%{version}/postbuild_processing/tt-hinting/Hack-Italic-TA.txt" "master_ttf/Hack-Italic.ttf" "master_ttf/hinted/Hack-Italic.ttf" ttfautohint -l 6 -r 50 -x 10 -H 265 -D latn -f latn -w G -W -t -X "" -I -m "Hack-%{version}/postbuild_processing/tt-hinting/Hack-BoldItalic-TA.txt" "master_ttf/Hack-BoldItalic.ttf" "master_ttf/hinted/Hack-BoldItalic.ttf" %install install -m 0755 -d %{buildroot}%{_fontdir} install -m 0644 -p master_ttf/hinted/*.ttf %{buildroot}%{_fontdir} install -m 0755 -d %{buildroot}%{_fontconfig_templatedir} \ %{buildroot}%{_fontconfig_confdir} install -m 0644 -p Hack-%{version}/config/fontconfig/45-Hack.conf \ %{buildroot}%{_fontconfig_templatedir}/%{fontconf} ln -s %{_fontconfig_templatedir}/%{fontconf} \ %{buildroot}%{_fontconfig_confdir}/%{fontconf} # Add AppStream metadata file install -Dm 0644 -p %{SOURCE1} \ %{buildroot}%{_datadir}/metainfo/%{fontname}.metainfo.xml %check appstream-util validate-relax --nonet \ %{buildroot}%{_datadir}/metainfo/%{fontname}.metainfo.xml %_font_pkg -f %{fontconf} *.ttf %license Hack-%{version}/LICENSE.md %doc Hack-%{version}/README.md %{_datadir}/metainfo/%{fontname}.metainfo.xml %changelog * Wed Oct 31 2018 Jamie Mansfield - 3.003-1 - Initial package