Skip to content

Commit

Permalink
name_parser: Correct output on weight check
Browse files Browse the repository at this point in the history
[why]
When the weight check fails for some input the reason is not shown
correctly (i.e. not the string that actually failed).

[how]
Display exactly the failed string in the warning.

Signed-off-by: Fini Jastrow <[email protected]>
  • Loading branch information
Finii committed Oct 7, 2023
1 parent 809101d commit 89f1325
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/scripts/name_parser/FontnameParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ def check_weights(self, font):
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))
self.logger.warn('Can not parse PS-weight: {}'.format(font.weight))
weightproblem = True
if name_weight is None:
self.logger.warn('Can not parse name for weight: {}'.format(restored_weight_token))
self.logger.warn('Can not parse name for weight: {}'.format(weight))
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')
Expand Down

0 comments on commit 89f1325

Please sign in to comment.