6
6
from __future__ import absolute_import , print_function , unicode_literals
7
7
8
8
# Change the script version when you edit this script:
9
- script_version = "4.4.0 "
9
+ script_version = "4.4.1 "
10
10
11
11
version = "3.0.2"
12
12
projectName = "Nerd Fonts"
@@ -1878,7 +1878,7 @@ def setup_arguments():
1878
1878
args = parser .parse_args ()
1879
1879
1880
1880
if args .makegroups > 0 and not FontnameParserOK :
1881
- logging .critical ("FontnameParser module missing (bin/scripts/name_parser/Fontname*), specify --makegroups 0" )
1881
+ logger .critical ("FontnameParser module missing (bin/scripts/name_parser/Fontname*), specify --makegroups 0" )
1882
1882
sys .exit (1 )
1883
1883
1884
1884
# if you add a new font, set it to True here inside the if condition
@@ -1913,22 +1913,22 @@ def setup_arguments():
1913
1913
args .complete = font_complete
1914
1914
1915
1915
if args .nonmono and args .single :
1916
- logging .warning ("Specified contradicting --variable-width-glyphs and --use-single-width-glyph. Ignoring --variable-width-glyphs." )
1916
+ logger .warning ("Specified contradicting --variable-width-glyphs and --use-single-width-glyph. Ignoring --variable-width-glyphs." )
1917
1917
args .nonmono = False
1918
1918
1919
1919
make_sure_path_exists (args .outputdir )
1920
1920
if not os .path .isfile (args .font ):
1921
- logging .critical ("Font file does not exist: %s" , args .font )
1921
+ logger .critical ("Font file does not exist: %s" , args .font )
1922
1922
sys .exit (1 )
1923
1923
if not os .access (args .font , os .R_OK ):
1924
- logging .critical ("Can not open font file for reading: %s" , args .font )
1924
+ logger .critical ("Can not open font file for reading: %s" , args .font )
1925
1925
sys .exit (1 )
1926
1926
is_ttc = len (fontforge .fontsInFile (args .font )) > 1
1927
1927
try :
1928
1928
source_font_test = TableHEADWriter (args .font )
1929
1929
args .is_variable = source_font_test .find_table ([b'avar' , b'cvar' , b'fvar' , b'gvarb' , b'HVAR' , b'MVAR' , b'VVAR' ], 0 )
1930
1930
if args .is_variable :
1931
- logging .warning ("Source font is a variable open type font (VF), opening might fail..." )
1931
+ logger .warning ("Source font is a variable open type font (VF), opening might fail..." )
1932
1932
except :
1933
1933
args .is_variable = False
1934
1934
finally :
@@ -1943,25 +1943,27 @@ def setup_arguments():
1943
1943
args .extension = '.' + args .extension
1944
1944
if re .match ("\.ttc$" , args .extension , re .IGNORECASE ):
1945
1945
if not is_ttc :
1946
- logging .critical ("Can not create True Type Collections from single font files" )
1946
+ logger .critical ("Can not create True Type Collections from single font files" )
1947
1947
sys .exit (1 )
1948
1948
else :
1949
1949
if is_ttc :
1950
- logging .critical ("Can not create single font files from True Type Collections" )
1950
+ logger .critical ("Can not create single font files from True Type Collections" )
1951
1951
sys .exit (1 )
1952
1952
1953
1953
if isinstance (args .xavgwidth , int ) and not isinstance (args .xavgwidth , bool ):
1954
1954
if args .xavgwidth < 0 :
1955
- logging .critical ("--xavgcharwidth takes no negative numbers" )
1955
+ logger .critical ("--xavgcharwidth takes no negative numbers" )
1956
1956
sys .exit (2 )
1957
1957
if args .xavgwidth > 16384 :
1958
- logging .critical ("--xavgcharwidth takes only numbers up to 16384" )
1958
+ logger .critical ("--xavgcharwidth takes only numbers up to 16384" )
1959
1959
sys .exit (2 )
1960
1960
1961
1961
return args
1962
1962
1963
-
1964
1963
def main ():
1964
+ global logger
1965
+ logging .basicConfig (format = '%(levelname)s: %(message)s' )
1966
+ logger = logging # Use root logger until we can set up something sane
1965
1967
global version
1966
1968
git_version = check_version_with_git (version )
1967
1969
allversions = "Patcher v{} ({}) (ff {})" .format (
@@ -1972,7 +1974,6 @@ def main():
1972
1974
check_fontforge_min_version ()
1973
1975
args = setup_arguments ()
1974
1976
1975
- global logger
1976
1977
logger = logging .getLogger (os .path .basename (args .font ))
1977
1978
logger .setLevel (logging .DEBUG )
1978
1979
log_to_file = (args .debugmode & 1 == 1 )
0 commit comments