mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2025-01-06 21:49:40 +02:00
Makes autohint callable from other locations and updates Hack post process scripts
This commit is contained in:
parent
1d84436942
commit
ff4f215932
@ -7,7 +7,7 @@
|
||||
# Modified by Ryan L McIntyre
|
||||
# for Nerd Fonts (https://github.com/ryanoasis/nerd-fonts)
|
||||
# Nerd Fonts Version: 2.0.0
|
||||
# Script Version: 1.0.1
|
||||
# Script Version: 1.1.1
|
||||
#
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
@ -23,25 +23,27 @@ command -v ttfautohint >/dev/null 2>&1 || {
|
||||
echo "[Nerd Fonts] 'ttfautohint' is required (not installed). Aborting." >&2; exit 1;
|
||||
}
|
||||
|
||||
nerdfonts_hack_scripts_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# ttfautohint - Input and output file names must not be identical
|
||||
cp "$fontfile" "${fontfile}.tmp"
|
||||
|
||||
if [[ "$fontfile" == *" Regular"* ]]
|
||||
if [[ "$fontfile" == *"Regular"* ]]
|
||||
then
|
||||
echo "[Nerd Fonts] Hinting Hack Regular"
|
||||
ttfautohint -l 4 -r 80 -G 350 -x 0 -H 181 -D latn -f latn -w G -W -t -X "" -I -m "bin/scripts/Hack/Hack-Regular-TA.txt" "${fontfile}.tmp" "$fontfile"
|
||||
elif [[ "$fontfile" == *" Bold"* ]]
|
||||
ttfautohint -l 6 -r 50 -x 10 -H 181 -D latn -f latn -w G -W -t -X "" -I -m "${nerdfonts_hack_scripts_dir}/Hack-Regular-TA.txt" "${fontfile}.tmp" "$fontfile"
|
||||
elif [[ "$fontfile" == *"Bold"* ]]
|
||||
then
|
||||
echo "[Nerd Fonts] Hinting Hack Bold"
|
||||
ttfautohint -l 4 -r 80 -G 350 -x 0 -H 260 -D latn -f latn -w G -W -t -X "" -I -m "bin/scripts/Hack/Hack-Bold-TA.txt" "${fontfile}.tmp" "$fontfile"
|
||||
elif [[ "$fontfile" == *" Italic"* ]]
|
||||
ttfautohint -l 6 -r 50 -x 10 -H 260 -D latn -f latn -w G -W -t -X "" -I -m "${nerdfonts_hack_scripts_dir}/Hack-Bold-TA.txt" "${fontfile}.tmp" "$fontfile"
|
||||
elif [[ "$fontfile" == *"Italic"* ]]
|
||||
then
|
||||
echo "[Nerd Fonts] Hinting Hack Italic"
|
||||
ttfautohint -l 4 -r 80 -G 350 -x 0 -H 145 -D latn -f latn -w G -W -t -X "" -I -m "bin/scripts/Hack/Hack-Bold-TA.txt" "${fontfile}.tmp" "$fontfile"
|
||||
elif [[ "$fontfile" == *" BoldItalic"* ]]
|
||||
ttfautohint -l 6 -r 50 -x 10 -H 145 -D latn -f latn -w G -W -t -X "" -I -m "${nerdfonts_hack_scripts_dir}/Hack-Italic-TA.txt" "${fontfile}.tmp" "$fontfile"
|
||||
elif [[ "$fontfile" == *"BoldItalic"* ]]
|
||||
then
|
||||
echo "[Nerd Fonts] Hinting Hack Bold Italic"
|
||||
ttfautohint -l 4 -r 80 -G 350 -x 0 -H 265 -D latn -f latn -w G -W -t -X "" -I -m "bin/scripts/Hack/Hack-Bold-TA.txt" "${fontfile}.tmp" "$fontfile"
|
||||
ttfautohint -l 6 -r 50 -x 10 -H 265 -D latn -f latn -w G -W -t -X "" -I -m "${nerdfonts_hack_scripts_dir}/Hack-BoldItalic-TA.txt" "${fontfile}.tmp" "$fontfile"
|
||||
else
|
||||
echo "[Nerd Fonts] Could not find any Hack fonts to hint..."
|
||||
fi
|
||||
|
47
bin/scripts/Hack/fix-dsig.py
Executable file
47
bin/scripts/Hack/fix-dsig.py
Executable file
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2013,2016 The Font Bakery Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# See AUTHORS.txt for the list of Authors and LICENSE.txt for the License.
|
||||
|
||||
# Adapted for the Hack typeface build workflow by Chris Simpkins
|
||||
|
||||
from __future__ import print_function, unicode_literals
|
||||
import sys
|
||||
import os
|
||||
from fontTools import ttLib
|
||||
|
||||
|
||||
def set_empty_dsig(ttFont):
|
||||
newDSIG = ttLib.newTable("DSIG")
|
||||
newDSIG.ulVersion = 1
|
||||
newDSIG.usFlag = 0
|
||||
newDSIG.usNumSigs = 0
|
||||
newDSIG.signatureRecords = []
|
||||
ttFont.tables["DSIG"] = newDSIG
|
||||
|
||||
def main(argv):
|
||||
for path in argv:
|
||||
if not os.path.exists(path):
|
||||
sys.stderr.write("[fix-dsig.py] ERROR: " + path + " is not a valid path to a font file")
|
||||
sys.exit(1)
|
||||
else:
|
||||
font = ttLib.TTFont(path)
|
||||
set_empty_dsig(font)
|
||||
font.save(path)
|
||||
print(path + " - successful DSIG table fix")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1:])
|
36
bin/scripts/Hack/fix-fstype.py
Executable file
36
bin/scripts/Hack/fix-fstype.py
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 The Fontbakery Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# Adapted for the Hack typeface build workflow by Chris Simpkins
|
||||
|
||||
import os
|
||||
import sys
|
||||
from fontTools.ttLib import TTFont
|
||||
|
||||
def main(argv):
|
||||
for path in argv:
|
||||
if not os.path.exists(path):
|
||||
sys.stderr.write("[fix-fstype.py] ERROR: " + path + " is not a valid path to a font file")
|
||||
sys.exit(1)
|
||||
else:
|
||||
font = TTFont(path)
|
||||
font['OS/2'].fsType = 0
|
||||
font.save(path)
|
||||
print(path + " - successful fstype fix")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1:])
|
@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
# Nerd Fonts Version: 2.0.0
|
||||
# Script Version: 1.1.0
|
||||
# Script Version: 1.2.0
|
||||
|
||||
fontfile=$1
|
||||
dir=$(dirname "$0")
|
||||
|
||||
echo "dir $dir"
|
||||
|
||||
"${dir}/fix-dsig.py" "$fontfile"
|
||||
"${dir}/fix-fstype.py" "$fontfile"
|
||||
"${dir}/autohint.sh" "$fontfile"
|
||||
"${dir}/../fpfix.py" "$fontfile"
|
||||
|
||||
printf "\\n"
|
||||
printf "[Nerd Fonts] Post Processed Hack '%s'\\n" "$fontfile"
|
||||
|
Loading…
Reference in New Issue
Block a user