mirror of
https://github.com/freedoom/freedoom.git
synced 2025-09-01 13:25:46 -04:00
parallel_textgen: separate font_render and invoke_command
Replace font_render with get_command which returns the command line instead of executing it. Move invoke_command to font_render callers.
This commit is contained in:
parent
e94bcdd9ea
commit
946db56ccd
1 changed files with 10 additions and 6 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue