Skip to content

Commit

Permalink
font: Set "Unbounded-Regular" as the default font
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Shishkin <[email protected]>
  • Loading branch information
virtuoso committed Oct 5, 2024
1 parent 668808e commit b4faa9b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/clap.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ struct clap_context *clap_init(struct clap_config *cfg, int argc, char **argv, c
log_init(log_flags);
(void)librarian_init(ctx->cfg.base_url);
if (ctx->cfg.font)
font_init();
font_init(ctx->cfg.default_font_name);
if (ctx->cfg.sound)
sound_init();
if (ctx->cfg.phys)
Expand Down
1 change: 1 addition & 0 deletions core/clap.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct clap_config {
graphics : 1;
const char *title;
const char *base_url;
const char *default_font_name;
unsigned int width;
unsigned int height;
void (*frame_cb)(void *data);
Expand Down
8 changes: 6 additions & 2 deletions core/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,15 @@ void font_put(struct font *font)
ref_put(font);
}

int font_init(void)
#define DEFAULT_FONT_NAME "ofl/Unbounded-Regular.ttf"
int font_init(const char *default_font_name)
{
CHECK0(FT_Init_FreeType(&ft));

default_font = font_open("LiberationSansBold.ttf", 64);
if (!default_font_name)
default_font_name = DEFAULT_FONT_NAME;

default_font = font_open(default_font_name, 32);
if (!default_font) {
err("couldn't load default font\n");
return -1;
Expand Down
2 changes: 1 addition & 1 deletion core/font.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct glyph {
};

struct font;
int font_init(void);
int font_init(const char *default_font_name);
void font_done(void);
const char *font_name(struct font *font);
struct font *font_open(const char *name, unsigned int size);
Expand Down
2 changes: 1 addition & 1 deletion core/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ ui_render_string(struct ui *ui, struct font *font, struct ui_element *parent,
return uit.uietex;
}

static const char *menu_font = "Rancho-Regular.ttf";
static const char *menu_font = "ofl/Unbounded-Regular.ttf";
static struct ui_element *ui_roll_element;

static void ui_roll_done(void)
Expand Down
2 changes: 1 addition & 1 deletion demo/ldjam56/asset

0 comments on commit b4faa9b

Please sign in to comment.