- def _prepare_glyph(self, image_map, glyph, current_words, lines):
+ def _prepare_glyph(self, glyph, current_words):
+ glyphs = []
size = self.font.size(' '.join(current_words[:-1] + ['']))
x = size[0] * EIGHT_BIT_SCALE + self.padding
size = self.font.size(' '.join(current_words[:-1] + ['']))
x = size[0] * EIGHT_BIT_SCALE + self.padding
for glyph_key in glyph.glyph_keys:
image_name, colour = MARKUP_MAP[glyph_key]
if colour is None:
colour = self.colour
image = resources.get_image(
image_name, transforms=(EIGHT_BIT, blender(colour)))
for glyph_key in glyph.glyph_keys:
image_name, colour = MARKUP_MAP[glyph_key]
if colour is None:
colour = self.colour
image = resources.get_image(
image_name, transforms=(EIGHT_BIT, blender(colour)))
- yield ' '.join(current_words[:-1])
- current_words = []
+ yield (' '.join(current_words[:-1]), glyphs)
+ current_words, glyphs = [], []
if glyph is not None:
word = glyph.markup_text
remaining_words.insert(0, word)
if current_words and words_fit(current_words):
line_count += 1
if glyph is not None:
word = glyph.markup_text
remaining_words.insert(0, word)
if current_words and words_fit(current_words):
line_count += 1
line_surface = self.render_line(line)
line_rect = line_surface.get_rect()
rendered_lines.append(line_surface)
width = max(width, line_rect.width + self.padding * 2)
height += line_rect.height
line_surface = self.render_line(line)
line_rect = line_surface.get_rect()
rendered_lines.append(line_surface)
width = max(width, line_rect.width + self.padding * 2)
height += line_rect.height
x += self.padding
self.surface.blit(line_surface, (x, y))
y += line_surface.get_rect().height
x += self.padding
self.surface.blit(line_surface, (x, y))
y += line_surface.get_rect().height