gohufont: generate opentype files

This commit is contained in:
rnhmjoj 2019-12-07 17:22:14 +01:00
parent f16019c58f
commit 68464b6440
No known key found for this signature in database
GPG Key ID: BFBAF4C975F76450
2 changed files with 17 additions and 18 deletions

View File

@ -1,42 +1,41 @@
{ stdenv, fetchurl, fetchFromGitHub { stdenv, fetchurl, fetchFromGitHub
, mkfontdir, mkfontscale, bdf2psf, bdftopcf , mkfontdir, mkfontscale, bdf2psf, bdftopcf
, fonttosfnt
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "gohufont"; pname = "gohufont";
version = "2.1"; version = "2.1";
src = fetchurl { src = fetchFromGitHub {
url = "https://font.gohu.org/${pname}-${version}.tar.gz";
sha256 = "10dsl7insnw95hinkcgmp9rx39lyzb7bpx5g70vswl8d6p4n53bm";
};
bdf = fetchFromGitHub {
owner = "hchargois"; owner = "hchargois";
repo = "gohufont"; repo = "gohufont";
rev = "cc36b8c9fed7141763e55dcee0a97abffcf08224"; rev = "cc36b8c9fed7141763e55dcee0a97abffcf08224";
sha256 = "1hmp11mrr01b29phw0xyj4h9b92qz19cf56ssf6c47c5j2c4xmbv"; sha256 = "1hmp11mrr01b29phw0xyj4h9b92qz19cf56ssf6c47c5j2c4xmbv";
}; };
nativeBuildInputs = [ mkfontdir mkfontscale bdf2psf bdftopcf ]; nativeBuildInputs =
[ mkfontdir mkfontscale bdf2psf bdftopcf fonttosfnt ];
buildPhase = '' buildPhase = ''
# convert bdf to psf fonts # convert bdf fonts to psf
build=$(pwd) build=$(pwd)
mkdir psf mkdir psf
cd ${bdf2psf}/share/bdf2psf cd ${bdf2psf}/share/bdf2psf
for i in $bdf/*.bdf; do for i in $src/*.bdf; do
name=$(basename $i .bdf)
bdf2psf \ bdf2psf \
--fb "$i" standard.equivalents \ --fb "$i" standard.equivalents \
ascii.set+useful.set+linux.set 512 \ ascii.set+useful.set+linux.set 512 \
"$build/psf/$(basename $i .bdf).psf" "$build/psf/$name.psf"
done done
cd $build cd $build
# convert hidpi variant to pcf # convert bdf fonts to pcf and otb
for i in $bdf/hidpi/*.bdf; do for i in *.bdf $src/hidpi/*.bdf; do
name=$(basename $i .bdf).pcf name=$(basename $i .bdf)
bdftopcf -o "$name" "$i" bdftopcf -o "$name.pcf" "$i"
fonttosfnt -v -o "$name.otb" "$i" || true
done done
''; '';
@ -46,10 +45,10 @@ stdenv.mkDerivation rec {
mkdir -p "$fontDir" mkdir -p "$fontDir"
mv -t "$fontDir" psf/*.psf mv -t "$fontDir" psf/*.psf
# install the pcf fonts (for xorg applications) # install the pcf and otb fonts (for xorg applications)
fontDir="$out/share/fonts/misc" fontDir="$out/share/fonts/misc"
mkdir -p "$fontDir" mkdir -p "$fontDir"
mv -t "$fontDir" *.pcf.gz *.pcf mv -t "$fontDir" *.pcf *.otb
cd "$fontDir" cd "$fontDir"
mkfontdir mkfontdir
@ -58,7 +57,7 @@ stdenv.mkDerivation rec {
outputHashAlgo = "sha256"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = "0kl7k8idl0fnsap2c4j02i33z017p2s4gi2cgspy6ica46fczcc1"; outputHash = "0j9fhvzkascpb5y8lc1pmmmgd74apgw9mimbj0bk2chcbfsi852p";
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = '' description = ''

View File

@ -17493,7 +17493,7 @@ in
geolite-legacy = callPackage ../data/misc/geolite-legacy { }; geolite-legacy = callPackage ../data/misc/geolite-legacy { };
gohufont = callPackage ../data/fonts/gohufont { }; gohufont = callPackage ../data/fonts/gohufont { inherit (xorg) fonttosfnt mkfontdir; };
gnome-user-docs = callPackage ../data/documentation/gnome-user-docs { }; gnome-user-docs = callPackage ../data/documentation/gnome-user-docs { };