google-fonts: fix font name format
When specifying a list of fonts to install, the google-fonts package would previously only search for fonts with the formats `$font-*.ttf` and `$font[*.ttf`. However, certain fonts in the Google fonts repository do not follow this naming scheme (e.g., Nova Square; ofl/novasquare/NovaSquare.ttf). I have added `$font.ttf` as a format. I have also optimized the build script so it does not make multiple calls to `find`.
This commit is contained in:
parent
e58d02aeef
commit
c3933fdc40
|
@ -40,12 +40,10 @@ stdenvNoCC.mkDerivation {
|
||||||
|
|
||||||
dontBuild = true;
|
dontBuild = true;
|
||||||
|
|
||||||
# The font files are in the fonts directory and use two naming schemes:
|
# The font files are in the fonts directory and use three naming schemes:
|
||||||
# FamilyName-StyleName.ttf and FamilyName[param1,param2,...].ttf
|
# FamilyName-StyleName.ttf, FamilyName[param1,param2,...].ttf, and
|
||||||
# This installs all fonts if fonts is empty and otherwise only
|
# FamilyName.ttf. This installs all fonts if fonts is empty and otherwise
|
||||||
# the specified fonts by FamilyName. To do this, it invokes
|
# only the specified fonts by FamilyName.
|
||||||
# `find` 2 times for every font, anyone is free to do this
|
|
||||||
# in a more efficient way.
|
|
||||||
fonts = map (font: builtins.replaceStrings [" "] [""] font) fonts;
|
fonts = map (font: builtins.replaceStrings [" "] [""] font) fonts;
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
adobeBlankDest=$adobeBlank/share/fonts/truetype
|
adobeBlankDest=$adobeBlank/share/fonts/truetype
|
||||||
|
@ -56,8 +54,7 @@ stdenvNoCC.mkDerivation {
|
||||||
find . -name '*.ttf' -exec install -m 444 -Dt $dest '{}' +
|
find . -name '*.ttf' -exec install -m 444 -Dt $dest '{}' +
|
||||||
'' else ''
|
'' else ''
|
||||||
for font in $fonts; do
|
for font in $fonts; do
|
||||||
find . -name "$font-*.ttf" -exec install -m 444 -Dt $dest '{}' +
|
find . \( -name "$font-*.ttf" -o -name "$font[*.ttf" -o -name "$font.ttf" \) -exec install -m 444 -Dt $dest '{}' +
|
||||||
find . -name "$font[*.ttf" -exec install -m 444 -Dt $dest '{}' +
|
|
||||||
done
|
done
|
||||||
'');
|
'');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user