diff --git a/graphics/text/textgen b/graphics/text/textgen index b647a5f3..36bd0dc1 100755 --- a/graphics/text/textgen +++ b/graphics/text/textgen @@ -138,9 +138,11 @@ class Font(object): return command_line - def render_text(self, text, output_filename, + def get_command(self, text, output_filename, color=COLOR_WHITE, bgcolor=BACKGROUND_COLOR): - """Render text to a file with the given background color.""" + """Get command line to render text to a file + with the given background color. + """ if UPPERCASE_FONT: text = text.upper() @@ -152,13 +154,14 @@ class Font(object): command_line.append(output_filename) - invoke_command(command_line) + return command_line def generate_graphics(graphics, color=COLOR_WHITE, bgcolor=BACKGROUND_COLOR): for name, text in sorted(graphics.items()): print("# %s.gif: '%s'" % (name, text)) - font.render_text(text, '%s.gif' % name, - color=color, bgcolor=bgcolor) + cmd = font.get_command(text, '%s.gif' % name, + color=color, bgcolor=bgcolor) + invoke_command(cmd) def generate_kerning_test(): pairs = [] @@ -169,7 +172,8 @@ def generate_kerning_test(): if font.kerning_adjust(char1, char2) != 0: pairs.append(char1 + char2) - font.render_text(" ".join(pairs), "kerning.gif") + cmd = font.get_command(" ".join(pairs), "kerning.gif") + invoke_command(cmd) font = Font('fontchars', kerning_table=FONT_KERNING_RULES)