Provide OpenType Bitmap fonts
Use bitmapfonts2otb.py to combine bitmap fonts Add bitmap-*-opentype-fonts sub packages
This commit is contained in:
parent
92531149ac
commit
75039c3ea8
@ -7,7 +7,7 @@ terminals.
|
||||
|
||||
Name: bitmap-fonts
|
||||
Version: 0.3
|
||||
Release: 32%{?dist}
|
||||
Release: 33%{?dist}
|
||||
License: GPLv2 and MIT and Lucida
|
||||
Source0: bitmap-fonts-%{version}.tar.bz2
|
||||
Source1: fixfont-3.5.tar.bz2
|
||||
@ -16,10 +16,13 @@ Source3: 66-bitmap-console.conf
|
||||
Source4: 66-bitmap-fangsongti.conf
|
||||
Source5: 66-bitmap-fixed.conf
|
||||
Source6: 66-bitmap-lucida-typewriter.conf
|
||||
Source7: bitmapfonts2otb.py
|
||||
BuildArch: noarch
|
||||
Summary: Selected set of bitmap fonts
|
||||
BuildRequires: xorg-x11-font-utils
|
||||
BuildRequires: fontpackages-devel
|
||||
BuildRequires: python3
|
||||
BuildRequires: /usr/bin/ftdump
|
||||
|
||||
|
||||
%description
|
||||
@ -34,6 +37,7 @@ Requires: %{fontname}-console-fonts = %{version}-%{release}
|
||||
Requires: %{fontname}-fixed-fonts = %{version}-%{release}
|
||||
Requires: ucs-miscfixed-fonts
|
||||
Obsoletes: bitmap-fonts < %{version}-%{release}
|
||||
Conflicts: %{fontname}-opentype-fonts-compat
|
||||
|
||||
%description -n %{fontname}-fonts-compat
|
||||
%common_desc
|
||||
@ -41,16 +45,44 @@ Meta-package for installing all font families of bitmap.
|
||||
|
||||
%files -n %{fontname}-fonts-compat
|
||||
|
||||
%package -n %{fontname}-opentype-fonts-compat
|
||||
Summary: Compatibility files of bitmap-font families (opentype version)
|
||||
Requires: %{fontname}-lucida-typewriter-opentype-fonts = %{version}-%{release}
|
||||
Requires: %{fontname}-fangsongti-opentype-fonts = %{version}-%{release}
|
||||
Requires: %{fontname}-console-opentype-fonts = %{version}-%{release}
|
||||
Requires: %{fontname}-fixed-opentype-fonts = %{version}-%{release}
|
||||
Requires: ucs-miscfixed-opentype-fonts
|
||||
Conflicts: %{fontname}-fonts-compat
|
||||
|
||||
%description -n %{fontname}-opentype-fonts-compat
|
||||
%common_desc
|
||||
Meta-package for installing all font families of opentype bitmap.
|
||||
|
||||
%files -n %{fontname}-opentype-fonts-compat
|
||||
|
||||
%package -n bitmap-lucida-typewriter-fonts
|
||||
Summary: Selected CJK bitmap fonts for Anaconda
|
||||
Requires: fontpackages-filesystem
|
||||
Provides: %{name}-cjk = %{version}-%{release}
|
||||
License: Lucida
|
||||
Conflicts: bitmap-lucida-typewriter-opentype-fonts
|
||||
|
||||
%description -n bitmap-lucida-typewriter-fonts
|
||||
%common_desc
|
||||
|
||||
%_font_pkg -n lucida-typewriter -f %{fontconf}-lucida-typewriter.conf lut*
|
||||
%_font_pkg -n lucida-typewriter -f %{fontconf}-lucida-typewriter.conf lut*.pcf.gz
|
||||
%doc LU_LEGALNOTICE
|
||||
|
||||
%package -n bitmap-lucida-typewriter-opentype-fonts
|
||||
Summary: Selected CJK bitmap fonts for Anaconda (opentype version)
|
||||
Requires: fontpackages-filesystem
|
||||
License: Lucida
|
||||
Conflicts: bitmap-lucida-typewriter-fonts
|
||||
|
||||
%description -n bitmap-lucida-typewriter-opentype-fonts
|
||||
%common_desc
|
||||
|
||||
%_font_pkg -n lucida-typewriter-opentype -f %{fontconf}-lucida-typewriter.conf LucidaTypewriter*.otb
|
||||
%doc LU_LEGALNOTICE
|
||||
|
||||
%package -n bitmap-fangsongti-fonts
|
||||
@ -58,39 +90,76 @@ Summary: Selected CJK bitmap fonts for Anaconda
|
||||
Requires: fontpackages-filesystem
|
||||
Provides: %{name}-cjk = %{version}-%{release}
|
||||
License: MIT
|
||||
Conflicts: bitmap-fangsongti-opentype-fonts
|
||||
|
||||
%description -n %{fontname}-fangsongti-fonts
|
||||
bitmap-fonts-cjk package contains bitmap fonts used by Anaconda. They are
|
||||
selected from the xorg packages, and the font encoding are converted from
|
||||
native encoding to ISO10646. They are only intended to be used in Anaconda.
|
||||
|
||||
%_font_pkg -n fangsongti -f %{fontconf}-fangsongti.conf fangsongti*
|
||||
%_font_pkg -n fangsongti -f %{fontconf}-fangsongti.conf fangsongti*.pcf.gz
|
||||
%doc LICENSE
|
||||
|
||||
%package -n bitmap-fangsongti-opentype-fonts
|
||||
Summary: Selected CJK bitmap fonts for Anaconda (opentype version)
|
||||
Requires: fontpackages-filesystem
|
||||
License: MIT
|
||||
Conflicts: bitmap-fangsongti-fonts
|
||||
|
||||
%description -n %{fontname}-fangsongti-opentype-fonts
|
||||
%common_desc
|
||||
|
||||
%_font_pkg -n fangsongti-opentype -f %{fontconf}-fangsongti.conf Fangsong*.otb
|
||||
%doc LICENSE
|
||||
|
||||
%package -n bitmap-console-fonts
|
||||
Summary: Selected set of bitmap fonts
|
||||
Requires: fontpackages-filesystem
|
||||
License: GPLv2
|
||||
Conflicts: bitmap-console-opentype-fonts
|
||||
|
||||
%description -n %{fontname}-console-fonts
|
||||
%common_desc
|
||||
|
||||
%_font_pkg -n console -f %{fontconf}-console.conf console8x16*
|
||||
%_font_pkg -n console -f %{fontconf}-console.conf console8x16*.pcf.gz
|
||||
|
||||
%package -n bitmap-console-opentype-fonts
|
||||
Summary: Selected set of bitmap fonts (opentype version)
|
||||
Requires: fontpackages-filesystem
|
||||
License: GPLv2
|
||||
Conflicts: bitmap-console-fonts
|
||||
|
||||
%description -n %{fontname}-console-opentype-fonts
|
||||
%common_desc
|
||||
|
||||
%_font_pkg -n console-opentype -f %{fontconf}-console.conf Console*.otb
|
||||
|
||||
%package -n bitmap-fixed-fonts
|
||||
Summary: Selected set of bitmap fonts
|
||||
Requires: fontpackages-filesystem
|
||||
License: GPLv2
|
||||
Conflicts: bitmap-fixed-opentype-fonts
|
||||
|
||||
%description -n %{fontname}-fixed-fonts
|
||||
%common_desc
|
||||
|
||||
%_font_pkg -n fixed -f %{fontconf}-fixed.conf console9*
|
||||
%_font_pkg -n fixed -f %{fontconf}-fixed.conf console9*.pcf.gz
|
||||
|
||||
%package -n bitmap-fixed-opentype-fonts
|
||||
Summary: Selected set of bitmap fonts (opentype version)
|
||||
Requires: fontpackages-filesystem
|
||||
License: GPLv2
|
||||
Conflicts: bitmap-fixed-fonts
|
||||
|
||||
%description -n %{fontname}-fixed-opentype-fonts
|
||||
%common_desc
|
||||
|
||||
%_font_pkg -n fixed-opentype -f %{fontconf}-fixed.conf Fixed*.otb
|
||||
|
||||
%prep
|
||||
%setup -q -a 1
|
||||
cp %{SOURCE2} .
|
||||
cp %{SOURCE7} .
|
||||
|
||||
|
||||
%build
|
||||
@ -111,6 +180,11 @@ rm %{buildroot}%{_fontdir}/[0-9]*.pcf
|
||||
rm %{buildroot}%{_fontdir}/console8x8.pcf
|
||||
rm README
|
||||
|
||||
# Convert to OpenType Bitmap Font
|
||||
pushd %{buildroot}%{_fontdir}
|
||||
python3 %{_sourcedir}/bitmapfonts2otb.py *.pcf
|
||||
popd
|
||||
|
||||
gzip %{buildroot}%{_fontdir}/*.pcf
|
||||
|
||||
install -m 0755 -d %{buildroot}%{_fontconfig_templatedir} \
|
||||
@ -140,6 +214,11 @@ done
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Feb 6 2020 Peng Wu <pwu@redhat.com> - 0.3-33
|
||||
- Provide OpenType Bitmap fonts
|
||||
- Use bitmapfonts2otb.py to combine bitmap fonts
|
||||
- Add bitmap-*-opentype-fonts sub packages
|
||||
|
||||
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-32
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
|
62
bitmapfonts2otb.py
Normal file
62
bitmapfonts2otb.py
Normal file
@ -0,0 +1,62 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
# Automatically group the font files by family names and style names,
|
||||
# and assume each bitmap font only contains one font face.
|
||||
#
|
||||
# Generates one otb file per (family name, style name) tuple, named
|
||||
# after the tuple.
|
||||
#
|
||||
# This tool requires ftdump and fonttosfnt.
|
||||
|
||||
# Written by Peng Wu as
|
||||
# https://pwu.fedorapeople.org/fonts/convertbitmap/convertfont.py
|
||||
# Some changes by Hans Ulrich Niedermann.
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
usage = '''
|
||||
bitmapfonts2otb.py [BITMAPFONTFILE]...
|
||||
'''
|
||||
|
||||
fontnames = dict()
|
||||
|
||||
# get font family name and style name by ftdump
|
||||
def getfullname(fontname):
|
||||
output = subprocess.check_output(['ftdump', fontname])
|
||||
|
||||
output = output.decode('utf8')
|
||||
# only contain one font face
|
||||
assert not 'Face number: 1' in output
|
||||
result = {}
|
||||
for row in output.split('\n'):
|
||||
if ':' in row:
|
||||
key, value = row.split(': ')
|
||||
result[key.strip()] = value.strip()
|
||||
|
||||
familyname, stylename = result['family'], result['style']
|
||||
if stylename == 'Regular':
|
||||
return familyname
|
||||
else:
|
||||
return familyname + ' ' + stylename
|
||||
|
||||
|
||||
def generate_fonts():
|
||||
for fullname, filenames in fontnames.items():
|
||||
outputfilename = fullname.replace(' ', '-') + '.otb'
|
||||
argv = ['fonttosfnt', '-b', '-c', '-g', '2', '-m', '2', '-o', outputfilename ]
|
||||
argv.extend(filenames)
|
||||
print(outputfilename)
|
||||
print(' '.join(argv))
|
||||
print(subprocess.check_output(argv).decode('utf8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for bitmapfontname in sys.argv[1:]:
|
||||
fullname = getfullname(bitmapfontname)
|
||||
if fullname in fontnames:
|
||||
fontnames[fullname].append(bitmapfontname)
|
||||
else:
|
||||
fontnames[fullname] = [bitmapfontname]
|
||||
|
||||
generate_fonts()
|
Loading…
Reference in New Issue
Block a user