@@ -365,7 +365,7 @@ def set_dark_colors(
365365
366366
367367def draw (
368- font_path : str ,
368+ font_paths : list [ pathlib . Path ] ,
369369 text : None | str ,
370370 features : str ,
371371 foreground : None | str ,
@@ -379,19 +379,22 @@ def draw(
379379 bounds = None
380380 lines : list [GlyphLine ] = []
381381 y = margin
382- font = Font (font_path )
382+ fonts = [ Font (font_path ) for font_path in font_paths ]
383383
384- if text is None :
385- text = font .sample_text
384+ fonts_locations = []
385+ if len (fonts ) == 1 :
386+ fonts_locations = [(fonts [0 ], location ) for location in fonts [0 ].locations ]
387+ else :
388+ fonts_locations = [(font , {}) for font in fonts ]
386389
387- if text is None :
388- raise ValueError ("No text provided and no sample text in the font" )
389-
390- locations = font .locations
391- for location in reversed (locations ):
390+ for font , location in reversed (fonts_locations ):
392391 font .set_location (location )
393392
394- text_lines = list (reversed (text .split ("\n " )))
393+ sample_text = text or font .sample_text
394+ if not sample_text :
395+ raise ValueError ("No text provided and no sample text in the font" )
396+
397+ text_lines = list (reversed (sample_text .split ("\n " )))
395398 if justify :
396399 max_width = 0
397400 for text_line in text_lines :
@@ -479,7 +482,7 @@ def parseColor(color):
479482
480483def main (argv = None ):
481484 parser = argparse .ArgumentParser (description = "Create SVG sample." )
482- parser .add_argument ("font " , help = "input font" )
485+ parser .add_argument ("fonts " , help = "input font" , nargs = "+" , type = pathlib . Path )
483486 parser .add_argument ("-t" , "--text" , help = "input text" )
484487 parser .add_argument ("-f" , "--features" , help = "input features" )
485488 parser .add_argument (
@@ -498,7 +501,7 @@ def main(argv=None):
498501 args = parser .parse_args (argv )
499502
500503 draw (
501- args .font ,
504+ args .fonts ,
502505 args .text ,
503506 args .features ,
504507 args .foreground ,
0 commit comments