Skip to content

Commit 24eebf8

Browse files
committed
Improve font loading slightly
No point copying the font data since it's already required to be in RAM for the current font implementation
1 parent ed447a3 commit 24eebf8

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

source/font.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ Font::Font(const u8 *nftr, u32 nftrSize) {
2424
// Load character glyphs
2525
tileAmount = (chunkSize - 0x10) / tileSize;
2626
ptr += 4;
27-
fontTiles = new u8[tileSize * tileAmount];
28-
tonccpy(fontTiles, ptr, tileSize * tileAmount);
27+
fontTiles = (u8 *)ptr;
2928

3029
// Load character widths
3130
ptr = nftr + 0x24;
@@ -34,8 +33,7 @@ Font::Font(const u8 *nftr, u32 nftrSize) {
3433
ptr = nftr + locHDWC - 4;
3534
tonccpy(&chunkSize, ptr, 4);
3635
ptr += 4 + 8;
37-
fontWidths = new u8[3 * tileAmount];
38-
tonccpy(fontWidths, ptr, 3 * tileAmount);
36+
fontWidths = (u8 *)ptr;
3937

4038
// Load character maps
4139
fontMap = new u16[tileAmount];
@@ -96,10 +94,6 @@ Font::Font(const u8 *nftr, u32 nftrSize) {
9694
}
9795

9896
Font::~Font(void) {
99-
if(fontTiles)
100-
delete[] fontTiles;
101-
if(fontWidths)
102-
delete[] fontWidths;
10397
if(fontMap)
10498
delete[] fontMap;
10599
}

0 commit comments

Comments
 (0)