Don't force RPGe font loading

This commit is contained in:
Luke Hubmayer-Werner 2023-12-06 16:51:48 +10:30
parent 4d941207e5
commit 10669e0c1f
1 changed files with 20 additions and 19 deletions

View File

@ -536,25 +536,26 @@ func load_from_structs(data: Dictionary):
MapLoader.update_worldmap_block_tile_ids(worldmap_block_tile_ids) MapLoader.update_worldmap_block_tile_ids(worldmap_block_tile_ids)
# Make font atlas # Make font atlas
self.font_atlas_image = make_font_glyph_atlas(data.font_glyphs_small, data.font_glyphs_dialogue, data.font_glyphs_kanji) if 'RPGe_font_character_widths' in data:
self.font_atlas_texture = texture_from_image(self.font_atlas_image) self.font_atlas_image = make_font_glyph_atlas(data.font_glyphs_small, data.font_glyphs_dialogue, data.font_glyphs_kanji)
self.font = BitmapFont.new() self.font_atlas_texture = texture_from_image(self.font_atlas_image)
self.font.add_texture(self.font_atlas_texture) self.font = BitmapFont.new()
# self.font.extra_spacing_top = -2 self.font.add_texture(self.font_atlas_texture)
# self.font.extra_spacing_bottom = -1 # self.font.extra_spacing_top = -2
# self.font.extra_spacing_char = -1 # self.font.extra_spacing_bottom = -1
# self.font.extra_spacing_space = 1 # self.font.extra_spacing_char = -1
var glyph_table: PoolStringArray = StringLoader.glyph_tables.RPGe_dialog # self.font.extra_spacing_space = 1
var advance_table: PoolByteArray = data.RPGe_font_character_widths var glyph_table: PoolStringArray = StringLoader.glyph_tables.RPGe_dialog
for i in 256: var advance_table: PoolByteArray = data.RPGe_font_character_widths
var s := glyph_table[i] for i in 256:
if len(s) == 1: # ignore icons etc. for now var s := glyph_table[i]
var c := s.ord_at(0) if len(s) == 1: # ignore icons etc. for now
self.font.add_char(c, 0, Rect2((i%32)*16, (i/32)*12 + 32, advance_table[i], 12)) var c := s.ord_at(0)
if c == 0x2019: # RIGHT SINGLE QUOTATION MARK self.font.add_char(c, 0, Rect2((i%32)*16, (i/32)*12 + 32, advance_table[i], 12))
# Add for ' as well if c == 0x2019: # RIGHT SINGLE QUOTATION MARK
self.font.add_char(0x27, 0, Rect2((i%32)*16, (i/32)*12 + 32, advance_table[i], 12)) # Add for ' as well
# ThemeManager.theme.default_font = self.font self.font.add_char(0x27, 0, Rect2((i%32)*16, (i/32)*12 + 32, advance_table[i], 12))
# ThemeManager.theme.default_font = self.font
const gba_marker := 'FINAL FANTASY V ADVANCE SYGMAB' const gba_marker := 'FINAL FANTASY V ADVANCE SYGMAB'
const gba_marker_pos_US := 0x12FE10 const gba_marker_pos_US := 0x12FE10