%global fontname iosevka-fixed-curly-slab
%global fontconf 65-%{fontname}

%global upstream_version 3.0.0-rc.8

Name:           %{fontname}-fonts
Version:        3.0.0~rc.8
Release:        1%{?dist}
Summary:        Slender typeface for code, from code. Variant 11-iosevka-fixed-curly-slab.

License:        SIL OFL Version 1.1
URL:            https://github.com/be5invis/Iosevka
Source0:        %{url}/releases/download/v%{upstream_version}/11-iosevka-fixed-curly-slab-%{upstream_version}.zip
Source1:        %{fontname}-fontconfig.conf
Source2:        %{fontname}.metainfo.xml

BuildArch:      noarch
BuildRequires:  fontpackages-devel
BuildRequires:  libappstream-glib

%description
Iosevka is a slender monospace sans-serif and slab-serif typeface inspired by \
Pragmata Pro, M+ and PF DIN Mono, designed to be the ideal font for \
programming. The font is designed by Belleve Invis. \
 \
As the font is built entirely from code, many variations of the font can be \
maintained and developed. This allows multiple pre-built variants to be \
packaged in order to suit the users needs. Many of the possible variations are \
described below. \
 \
 - shape: the shape of various glyphs, like i, l, 0, etc. \
 - spacing: how wide some specific characters are. \
 - slab: whether the font has slab-serifs. \
 - ligatures: whether the font contains ligatures. \

%prep
%autosetup -n ttf #11-iosevka-fixed-curly-slab-%{upstream_version}

%build

%install
install -m 0755 -d %{buildroot}%{_fontdir}
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}
ln -s %{_fontconfig_templatedir}/%{fontconf} \
      %{buildroot}%{_fontconfig_confdir}/%{fontconf}
 
# Add AppStream metadata file
install -Dm 0644 -p %{SOURCE2} \
        %{buildroot}%{_datadir}/metainfo/%{fontname}.metainfo.xml
 
%check
appstream-util validate-relax --nonet \
        %{buildroot}%{_datadir}/metainfo/%{fontname}.metainfo.xml
 
%_font_pkg -f %{fontconf} *.ttf
 
%{_datadir}/metainfo/%{fontname}.metainfo.xml