diff --git a/bin/scripts/name_parser/FontnameParser.py b/bin/scripts/name_parser/FontnameParser.py index fbfc7ef3d..cdaf9aa28 100644 --- a/bin/scripts/name_parser/FontnameParser.py +++ b/bin/scripts/name_parser/FontnameParser.py @@ -283,10 +283,14 @@ class FontnameParser: os2_weight = font.os2_weight ps_weight = FontnameTools.weight_string_to_number(font.weight) name_weight = FontnameTools.weight_string_to_number(weight) + weightproblem = False + if ps_weight is None: + self.logger.warn('Can not parse PS-weight: {}'.format(restored_weight_token)) + weightproblem = True if name_weight is None: - self.logger.error('Can not parse name for weight: {}'.format(restored_weight_token)) - return - if abs(os2_weight - ps_weight) > 50 or abs(os2_weight - name_weight) > 50: + self.logger.warn('Can not parse name for weight: {}'.format(restored_weight_token)) + weightproblem = True + if weightproblem or abs(os2_weight - ps_weight) > 50 or abs(os2_weight - name_weight) > 50: self.logger.warning('Possible problem with the weight metadata detected, check with --debug') self.logger.debug('Weight approximations: OS2/PS/Name: {}/{}/{} (from {}/\'{}\'/\'{}\')'.format( os2_weight, ps_weight, name_weight, diff --git a/bin/scripts/name_parser/FontnameTools.py b/bin/scripts/name_parser/FontnameTools.py index 52825b7a2..93904d325 100644 --- a/bin/scripts/name_parser/FontnameTools.py +++ b/bin/scripts/name_parser/FontnameTools.py @@ -287,7 +287,7 @@ class FontnameTools: @staticmethod def weight_string_to_number(w): """ Convert a common string approximation to a PS/2 weight value """ - if not len(w): + if not isinstance(w, str) or len(w) < 1: return 400 for num, strs in FontnameTools.equivalent_weights.items(): if w.lower() in strs: diff --git a/font-patcher b/font-patcher index 5efec62c2..e6881be65 100755 --- a/font-patcher +++ b/font-patcher @@ -6,7 +6,7 @@ from __future__ import absolute_import, print_function, unicode_literals # Change the script version when you edit this script: -script_version = "4.5.2" +script_version = "4.5.3" version = "3.0.2" projectName = "Nerd Fonts"