Skip to content

Commit

Permalink
client/font.c: add font not found check
Browse files Browse the repository at this point in the history
  • Loading branch information
LizzyFleckenstein03 committed Aug 19, 2024
1 parent 38ac8ff commit 9ca651f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/client/font.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#define STB_TRUETYPE_IMPLEMENTATION
#include <stb_truetype.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "client/client.h"
#include "client/font.h"
#include "client/opengl.h"
Expand Down Expand Up @@ -29,6 +31,10 @@ static VertexLayout font_vertex_layout = {
void font_init()
{
unsigned char *ttf = (unsigned char *) read_file(ASSET_PATH "fonts/Minecraftia.ttf");
if (!ttf) {
fprintf(stderr, "[error] could not load Minecraftia.ttf\n");
abort();
}

unsigned char font_atlas_data[font_atlas_size*font_atlas_size];
stbtt_BakeFontBitmap(ttf, 0, 24.0, font_atlas_data,
Expand Down

0 comments on commit 9ca651f

Please sign in to comment.