~earboxer/statusbar

2e510eed9b944a48aafc76d4526cddfb20932631 — Zach DeCook 2 years ago d1be142
fontconfig: Create script to generate font configuration
2 files changed, 45 insertions(+), 2 deletions(-)

A genFontconfig.sh
M patchicons.pe
A genFontconfig.sh => genFontconfig.sh +41 -0
@@ 0,0 1,41 @@
#!/bin/sh

# Output the fontconfig file to stdout
echo "<?xml version=\"1.0\"?>"
echo "<!DOCTYPE fontconfig SYSTEM \"urn:fontconfig:fonts.dtd\">"
echo "<fontconfig>"

echo "	<description>map statusbar families to statusbar generic and prefer donor font</description>"
echo "<!-- generic identification -->"
echo "	<alias binding=\"same\">"
echo "		<family>statusbar</family>"
echo "		<default><family>statusbar</family></default>"
echo "	</alias>"
echo
for familyname in "$@"; do
	echo "	<alias binding=\"same\">"
	echo "		<family>${familyname}-statusbar</family>"
	# Append the DonorFont
	echo "		<accept><family>${familyname}</family></accept>"
	# Fallback to another statusbar font if neither exists.
	echo "		<default><family>statusbar</family></default>"
	echo "	</alias>"
done
echo
echo "<!-- generic aliases -->"
echo "	<alias binding=\"same\">"
echo "		<family>statusbar</family>"
echo "		<prefer>"
for familyname in "$@"; do
	echo "			<family>${familyname}-statusbar</family>"
done
echo "		</prefer>"
echo "		<accept>"
# Fallback to DonorFont when just 'statusbar' was specified.
# (Requires DonorFont-statusbar to be installed if DonorFont is installed)
for familyname in "$@"; do
	echo "			<family>${familyname}</family>"
done
echo "		</accept>"
echo "	</alias>"
echo "</fontconfig>"

M patchicons.pe => patchicons.pe +4 -2
@@ 10,6 10,9 @@ endif
Open($2)
Select("%", "%", "0", "9", "_", "_", "a", "z");
Copy()
fontname = $fontname
familyname = $familyname
fullname = $fullname
weight = $weight
copyright = $copyright
version = $version


@@ 19,8 22,7 @@ macstyle = $macstyle
Open($1)
Select("%", "%", "0", "9", "_", "_", "a", "z");
Paste()
name = $2:t:r + "-statusbar"
SetFontNames(name, name, name, weight, copyright + "statusbar:" + $copyright, version + "-" + $version)
SetFontNames(fontname, familyname + "-statusbar", "statusbar " + fullname, weight, copyright + " statusbar:" + $copyright, version + "-" + $version)
SetMacStyle(macstyle)

# Save into current directory as new font.