Skip to content

Commit

Permalink
Always fallback to hardcoded font when default.png is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed May 1, 2024
1 parent 72ea074 commit e98906b
Show file tree
Hide file tree
Showing 9 changed files with 233 additions and 223 deletions.
8 changes: 8 additions & 0 deletions src/Drawer2D.c
Expand Up @@ -539,6 +539,12 @@ static void DrawBitmappedTextCore(struct Bitmap* bmp, struct DrawTextArgs* args,
static void DrawBitmappedText(struct Bitmap* bmp, struct DrawTextArgs* args, int x, int y) {
int offset = Drawer2D_ShadowOffset(args->font->size);

if (!fontBitmap.scan0) {
if (args->useShadow) FallbackFont_DrawText(args, bmp, x, y, true);
FallbackFont_DrawText(args, bmp, x, y, false);
return;
}

if (args->useShadow) {
DrawBitmappedTextCore(bmp, args, x + offset, y + offset, true);
}
Expand All @@ -550,6 +556,8 @@ static int MeasureBitmappedWidth(const struct DrawTextArgs* args) {
int xPadding, width;
cc_string text;

if (!fontBitmap.scan0) return FallbackFont_TextWidth(args);

/* adjust coords to make drawn text match GDI fonts */
xPadding = Drawer2D_XPadding(point);
width = 0;
Expand Down
3 changes: 0 additions & 3 deletions src/Platform_N64.c
Expand Up @@ -260,9 +260,6 @@ void Platform_Init(void) {
DisableFpuExceptions();

Platform_ReadonlyFilesystem = true;
// TODO: Redesign Drawer2D to better handle this
Options_SetBool(OPT_USE_CHAT_FONT, true);

dfs_init(DFS_DEFAULT_LOCATION);
timer_init();
rtc_init();
Expand Down
3 changes: 0 additions & 3 deletions src/Platform_NDS.c
Expand Up @@ -425,9 +425,6 @@ void Platform_Init(void) {
InitNetworking();

cpuStartTiming(1);
// TODO: Redesign Drawer2D to better handle this
Options_Load();
Options_SetBool(OPT_USE_CHAT_FONT, true);
}
void Platform_Free(void) { }

Expand Down
2 changes: 0 additions & 2 deletions src/Platform_PS1.c
Expand Up @@ -227,8 +227,6 @@ cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) {
void Platform_Init(void) {
ResetGraph(0);
Stopwatch_Init();

Options_SetBool(OPT_USE_CHAT_FONT, true);
}

void Platform_Free(void) { }
Expand Down
2 changes: 0 additions & 2 deletions src/Platform_Saturn.c
Expand Up @@ -213,8 +213,6 @@ cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) {
*#########################################################################################################################*/
void Platform_Init(void) {
Stopwatch_Init();

Options_SetBool(OPT_USE_CHAT_FONT, true);
}

void Platform_Free(void) { }
Expand Down
3 changes: 0 additions & 3 deletions src/Platform_Switch.c
Expand Up @@ -500,9 +500,6 @@ static void CreateRootDirectory(void) {
}

void Platform_Init(void) {
// TODO: Redesign Drawer2D to better handle this
//Options_SetBool(OPT_USE_CHAT_FONT, true);

CreateRootDirectory();
socketInitializeDefault();
}
Expand Down

0 comments on commit e98906b

Please sign in to comment.