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)
# Make font atlas
self.font_atlas_image = make_font_glyph_atlas(data.font_glyphs_small, data.font_glyphs_dialogue, data.font_glyphs_kanji)
self.font_atlas_texture = texture_from_image(self.font_atlas_image)
self.font = BitmapFont.new()
self.font.add_texture(self.font_atlas_texture)
# self.font.extra_spacing_top = -2
# self.font.extra_spacing_bottom = -1
# self.font.extra_spacing_char = -1
# self.font.extra_spacing_space = 1
var glyph_table: PoolStringArray = StringLoader.glyph_tables.RPGe_dialog
var advance_table: PoolByteArray = data.RPGe_font_character_widths
for i in 256:
var s := glyph_table[i]
if len(s) == 1: # ignore icons etc. for now
var c := s.ord_at(0)
self.font.add_char(c, 0, Rect2((i%32)*16, (i/32)*12 + 32, advance_table[i], 12))
if c == 0x2019: # RIGHT SINGLE QUOTATION MARK
# Add for ' as well
self.font.add_char(0x27, 0, Rect2((i%32)*16, (i/32)*12 + 32, advance_table[i], 12))
# ThemeManager.theme.default_font = self.font
if 'RPGe_font_character_widths' in data:
self.font_atlas_image = make_font_glyph_atlas(data.font_glyphs_small, data.font_glyphs_dialogue, data.font_glyphs_kanji)
self.font_atlas_texture = texture_from_image(self.font_atlas_image)
self.font = BitmapFont.new()
self.font.add_texture(self.font_atlas_texture)
# self.font.extra_spacing_top = -2
# self.font.extra_spacing_bottom = -1
# self.font.extra_spacing_char = -1
# self.font.extra_spacing_space = 1
var glyph_table: PoolStringArray = StringLoader.glyph_tables.RPGe_dialog
var advance_table: PoolByteArray = data.RPGe_font_character_widths
for i in 256:
var s := glyph_table[i]
if len(s) == 1: # ignore icons etc. for now
var c := s.ord_at(0)
self.font.add_char(c, 0, Rect2((i%32)*16, (i/32)*12 + 32, advance_table[i], 12))
if c == 0x2019: # RIGHT SINGLE QUOTATION MARK
# Add for ' as well
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_pos_US := 0x12FE10