Skip to content

Commit

Permalink
Add --suffix and --overwrite options
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Dec 13, 2024
1 parent f7057fa commit ca0bf83
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Lib/gftools/scripts/rename_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ def main(args=None):
parser.add_argument("font")
parser.add_argument("new_name", help="New family name")
parser.add_argument("-o", "--out", help="Output path")
parser.add_argument(
"--suffix", action="store_true", help="New name is added to old name"
)
parser.add_argument(
"--overwrite", action="store_true", help="New font is written on old filename"
)
parser.add_argument(
"--just-family",
action="store_true",
Expand All @@ -31,10 +37,14 @@ def main(args=None):

font = TTFont(args.font)
current_name = font_familyname(font)
if args.suffix:
args.new_name = current_name + args.new_name
rename_font(font, args.new_name, aggressive=not args.just_family)

if args.out:
out = args.out
elif args.overwrite:
out = args.font
else:
out = args.font.replace(
current_name.replace(" ", ""), args.new_name.replace(" ", "")
Expand Down

0 comments on commit ca0bf83

Please sign in to comment.