Skip to content

Commit

Permalink
Adds scripts and resources for creating fontconfig (WIP fix #84)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanoasis committed Nov 30, 2016
1 parent 4716018 commit 3b5dff7
Show file tree
Hide file tree
Showing 6 changed files with 318 additions and 0 deletions.
136 changes: 136 additions & 0 deletions 10-nerd-font-symbols.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
<family>GohuFont</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>GohuFont</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Fira Mono for Powerline</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Fira Code</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>ProggyCleanTT</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Anonymous Pro for Powerline,Anonymice Powerline</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Terminus (TTF)</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Iosevka,Iosevka Extralight Oblique</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Heavy Data</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Space Mono</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Share Tech Mono</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Droid Sans Mono for Powerline</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>monofur for Powerline</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Bitstream Vera Sans Mono</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Meslo LG S for Powerline</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Monoid</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Lekton</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>mononoki</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Liberation Mono for Powerline,Literation Mono Powerline</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Hasklig,Hasklig Black</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>IBM 3270 Narrow</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Hack</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>DejaVu Sans Mono</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>ProFontIIx</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Code New Roman</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>M+ 1m</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Fantasque Sans Mono</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Hermit</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Ubuntu Mono derivative Powerline</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Source Code Pro,Source Code Pro Black</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Roboto Mono,Roboto Mono Light</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Aurulent Sans Mono</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
<alias>
<family>Inconsolata for Powerline</family>
<prefer><family>Symbols Nerd Font</family></prefer>
</alias>
</fontconfig>
64 changes: 64 additions & 0 deletions bin/scripts/generate-fontconfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
# version: 0.9.0
# Iterates over all patched fonts directories
# to generate a fontconfig based on the Nerd Fonts Symbols font
# that contains only the glyphs

#set -x

parent_dir="${PWD}/../../"
unpatched_parent_dir="../../src/unpatched-fonts/"
to="$parent_dir/10-nerd-font-symbols.conf"
symbolfont="Symbols Nerd Font"

cd $unpatched_parent_dir || {
echo >&2 "# Could not find patched fonts directory"
exit 1
}

# clear output file (needed for multiple runs or updates):
> "$to" 2> /dev/null

# add to the file
{
printf '<?xml version="1.0"?>'
printf '\n<!DOCTYPE fontconfig SYSTEM "fonts.dtd">'
printf '\n<fontconfig>'
} >> "$to"

#find ./Hack -maxdepth 0 -type d | # uncomment to test 1 font
find . -maxdepth 1 -type d | # uncomment to get all fonts
while read -r filename
do

searchdir=$filename

FONTS=()
while IFS= read -d $'\0' -r file ; do
FONTS=("${FONTS[@]}" "$file")
# limit to first variation of family (folder)
done < <(find "$searchdir" -type f -iname '*.[o,t]tf' -print0 | head -n 1)

if [ "${FONTS[0]}" ];
then
familyname=$(fc-query --format='%{family}' "${FONTS[0]}")

echo "# Generating fontconfig for: $familyname"

# add to the file
{
printf '\n <alias>'
printf '\n <family>%s</family>' "$familyname"
printf '\n <prefer><family>%s</family></prefer>' "$symbolfont"
printf '\n </alias>'
} >> "$to"

fi

done

# add to the file
{
printf "\n</fontconfig>\n"
} >> "$to"

59 changes: 59 additions & 0 deletions src/glyphs/NerdFontsSymbols 1000 EM Nerd Font Complete Blank.sfd
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
SplineFontDB: 3.0
FontName: Symbols-1000-em
FullName: Symbols-1000-em
FamilyName: Symbols
Weight: Regular
Copyright: Copyright (c) 2016, Ryan McIntyre
Version: 001.000
ItalicAngle: 0
UnderlinePosition: -100
UnderlineWidth: 50
Ascent: 800
Descent: 200
InvalidEm: 0
LayerCount: 2
Layer: 0 0 "Back" 1
Layer: 1 0 "Fore" 0
XUID: [1021 913 -638292798 6571593]
FSType: 0
OS2Version: 0
OS2_WeightWidthSlopeOnly: 0
OS2_UseTypoMetrics: 1
CreationTime: 1480466430
ModificationTime: 1480467813
PfmFamily: 17
TTFWeight: 400
TTFWidth: 5
LineGap: 90
VLineGap: 0
OS2TypoAscent: 0
OS2TypoAOffset: 1
OS2TypoDescent: 0
OS2TypoDOffset: 1
OS2TypoLinegap: 90
OS2WinAscent: 0
OS2WinAOffset: 1
OS2WinDescent: 0
OS2WinDOffset: 1
HheadAscent: 0
HheadAOffset: 1
HheadDescent: 0
HheadDOffset: 1
OS2Vendor: 'PfEd'
MarkAttachClasses: 1
DEI: 91125
LangName: 1033
Encoding: UnicodeFull
UnicodeInterp: none
NameList: AGL For New Fonts
DisplaySize: -72
AntiAlias: 1
FitToEm: 0
WinInfo: 64 8 8
OnlyBitmaps: 1
BeginPrivate: 0
EndPrivate
TeXData: 1 0 0 346030 173015 115343 0 1048576 115343 783286 444596 497025 792723 393216 433062 380633 303038 157286 324010 404750 52429 2506097 1059062 262144
BeginChars: 1114112 0
EndChars
EndSplineFont
59 changes: 59 additions & 0 deletions src/glyphs/NerdFontsSymbols 2048 EM Nerd Font Complete Blank.sfd
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
SplineFontDB: 3.0
FontName: Symbols-2048-em
FullName: Symbols-2048-em
FamilyName: Symbols
Weight: Regular
Copyright: Copyright (c) 2016, Ryan McIntyre
Version: 001.000
ItalicAngle: 0
UnderlinePosition: -204
UnderlineWidth: 102
Ascent: 1638
Descent: 410
InvalidEm: 0
LayerCount: 2
Layer: 0 0 "Back" 1
Layer: 1 0 "Fore" 0
XUID: [1021 913 -638292798 6571593]
FSType: 0
OS2Version: 0
OS2_WeightWidthSlopeOnly: 0
OS2_UseTypoMetrics: 1
CreationTime: 1480466430
ModificationTime: 1480467841
PfmFamily: 17
TTFWeight: 400
TTFWidth: 5
LineGap: 184
VLineGap: 0
OS2TypoAscent: 0
OS2TypoAOffset: 1
OS2TypoDescent: 0
OS2TypoDOffset: 1
OS2TypoLinegap: 184
OS2WinAscent: 0
OS2WinAOffset: 1
OS2WinDescent: 0
OS2WinDOffset: 1
HheadAscent: 0
HheadAOffset: 1
HheadDescent: 0
HheadDOffset: 1
OS2Vendor: 'PfEd'
MarkAttachClasses: 1
DEI: 91125
LangName: 1033
Encoding: UnicodeFull
UnicodeInterp: none
NameList: AGL For New Fonts
DisplaySize: -72
AntiAlias: 1
FitToEm: 0
WinInfo: 64 8 8
OnlyBitmaps: 1
BeginPrivate: 0
EndPrivate
TeXData: 1 0 0 346030 173015 115343 0 1048576 115343 783286 444596 497025 792723 393216 433062 380633 303038 157286 324010 404750 52429 2506097 1059062 262144
BeginChars: 1114112 0
EndChars
EndSplineFont
Binary file not shown.
Binary file not shown.

0 comments on commit 3b5dff7

Please sign in to comment.