Skip to content

Commit

Permalink
Expanded the battle and menu heading font an extra 32 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
kiij committed Mar 21, 2015
1 parent 62d4e43 commit 90f9557
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
8 changes: 8 additions & 0 deletions coilsnake/model/eb/fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ def from_files(self, image_file, widths_file, image_format="png", widths_format=
widths_dict = yml_load(widths_file)
self.character_widths = map(lambda i: widths_dict[i], range(self.tileset.num_tiles_maximum))

def image_size(self):
if self.num_characters == 96:
arr = _FONT_IMAGE_ARRANGEMENT_96
elif self.num_characters == 128:
arr = _FONT_IMAGE_ARRANGEMENT_128

return arr.width * self.tileset.tile_width, arr.height * self.tileset.tile_height


_CREDITS_PREVIEW_SUBPALETTES = [
[1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1],
Expand Down
16 changes: 9 additions & 7 deletions coilsnake/modules/eb/FontModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def __init__(self):
self.fonts = [
EbFont(num_characters=128, tile_width=16, tile_height=16),
EbFont(num_characters=128, tile_width=16, tile_height=16),
EbFont(num_characters=96, tile_width=8, tile_height=16),
EbFont(num_characters=96, tile_width=8, tile_height=8),
EbFont(num_characters=128, tile_width=8, tile_height=16),
EbFont(num_characters=128, tile_width=8, tile_height=8),
EbFont(num_characters=128, tile_width=16, tile_height=16)
]
self.credits_font = EbCreditsFont()
Expand Down Expand Up @@ -105,19 +105,21 @@ def upgrade_project(self, old_version, new_version, rom, resource_open_r, resour
if old_version == new_version:
return
elif old_version == 5:
# Expand fonts 0, 1, and 4 from 96 characters to 128 characters
for i in [0, 1, 4]:
# Expand all the fonts from 96 characters to 128 characters
for i, font in enumerate(self.fonts):
log.debug("Expanding font #{}".format(FONT_FILENAMES[i]))
image_resource_name = "Fonts/" + FONT_FILENAMES[i]
widths_resource_name = "Fonts/" + FONT_FILENAMES[i] + "_widths"
new_image_w, new_image_h = font.image_size()

# Expand the image

with resource_open_r(image_resource_name, 'png') as image_file:
image = open_indexed_image(image_file)

expanded_image = Image.new("P", (256, 128), None)
for y in xrange(128):
for x in xrange(256):
expanded_image = Image.new("P", (new_image_w, new_image_h), None)
for y in xrange(new_image_h):
for x in xrange(new_image_w):
expanded_image.putpixel((x, y), 1)
FONT_IMAGE_PALETTE.to_image(expanded_image)
expanded_image.paste(image, (0, 0))
Expand Down

0 comments on commit 90f9557

Please sign in to comment.