Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cat-in-136/72b7504f5dce02e07eea to your computer and use it in GitHub Desktop.
Save cat-in-136/72b7504f5dce02e07eea to your computer and use it in GitHub Desktop.
adobe-source-han-sans-jp-fonts RPM spec and so on
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match>
<test name="lang">
<string>ja</string>
</test>
<test name="family">
<string>monospace</string>
</test>
<edit name="family" mode="prepend">
<string>Source Han Sans JP</string>
</edit>
<edit name="family" mode="prepend" binding="strong">
<string>DejaVu Sans Mono</string>
</edit>
</match>
<alias>
<family>Source Han Sans JP</family>
<default>
<family>monospace</family>
</default>
</alias>
<match>
<test name="lang">
<string>ja</string>
</test>
<test name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend">
<string>Source Han Sans JP</string>
</edit>
</match>
<alias>
<family>Source Han Sans JP</family>
<default>
<family>serif</family>
</default>
</alias>
<match>
<test name="lang">
<string>ja</string>
</test>
<test name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend">
<string>Source Han Sans JP</string>
</edit>
</match>
<alias>
<family>Source Han Sans JP</family>
<default>
<family>sans-serif</family>
</default>
</alias>
</fontconfig>
%global fontname adobe-source-han-sans-jp
%global fontconf 65-0-%{fontname}.conf
%global archivename SourceHanSansJP-%{version}
Name: adobe-source-han-sans-jp-fonts
Version: 1.001
Release: 1%{?dist}
Summary: Adobe OpenType Pan-CJK font family for Japanese
License: ASL 2.0
URL: https://github.com/adobe-fonts/source-han-sans/
# the original upstream tar ball is too large, use the download script instead
Source0: %{archivename}.zip
Source1: %{name}-fontconfig.conf
Source2: http://downloads.sourceforge.net/source-han-sans.adobe/LICENSE.txt
# the script to download fonts
Source3: fetchcnfont.sh
BuildArch: noarch
BuildRequires: fontpackages-devel
Requires: fontpackages-filesystem
%description
Source Han Sans is a sans serif Pan-CJK font family
that is offered in seven weights—ExtraLight, Light,
Normal, Regular, Medium, Bold, and Heavy—and
in several OpenType/CFF-based deployment configurations
to accommodate various system requirements or limitations.
As the name suggests, Pan-CJK fonts are intended to
support the characters necessary to render or
display text in Simplified Chinese, Traditional Chinese,
Japanese, and Korean.
%prep
%setup -q -n %{archivename}
%build
%install
#install doc
install -m 0644 -p %{SOURCE2} .
install -m 0755 -d %{buildroot}%{_fontdir}
install -m 0644 -p *.otf %{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}
%_font_pkg -f %{fontconf} *.otf
%doc LICENSE.txt
%changelog
* Sun Oct 26 2014 cat_in_136 - 1.001-1
- Initial Version (based on adobe-source-han-sans-cn-fonts)
#!/bin/bash
#Try to get upstream latest files
LANG="JP"
PREFIX="SourceHanSans$LANG"
VERSION="1.001"
ARCHIVE="$PREFIX-$VERSION"
TMPDIR=$(mktemp -d --tmpdir=/var/tmp fetchcnfont-XXXXXXXXXX)
[ $? != 0 ] && exit 1
umask 022
pushd "$TMPDIR"
URLPREFIX="https://github.com/adobe-fonts/source-han-sans/raw/release/SubsetOTF"
VARIANTS="Bold ExtraLight Heavy Light Medium Normal Regular"
for i in $(echo $VARIANTS | tr " " "\n")
do wget "$URLPREFIX/$LANG/$PREFIX-$i.otf"
done
mkdir "$ARCHIVE"
mv $PREFIX-*.otf "$ARCHIVE"
chmod -x $ARCHIVE/*.otf
zip "$ARCHIVE.zip" $ARCHIVE/*.otf
popd
mv "$TMPDIR/$ARCHIVE.zip" .
rm -fr "$TMPDIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment