Skip to content

Commit

Permalink
Allow specifying ownership
Browse files Browse the repository at this point in the history
API breaking change to loading baked font!!
  • Loading branch information
tcdude committed Jul 31, 2024
1 parent 7f2bbe4 commit 929ab75
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Sources/krink/graphics2/ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ void kr_ttf_load(kr_ttf_font_t *font, int size) {
}

void kr_ttf_load_baked_font(kr_ttf_font_t *font, kr_ttf_font_t *origin, int size,
kinc_g4_texture_t *tex, float xoff, float yoff) {
kinc_g4_texture_t *tex, float xoff, float yoff, bool owns_texture) {

if (!prepare_font_load(font, size)) return;

Expand All @@ -269,7 +269,7 @@ void kr_ttf_load_baked_font(kr_ttf_font_t *font, kr_ttf_font_t *origin, int size
}
img->first_unused_y = origin_img->first_unused_y + (int)(yoff + 0.5f);
}
img->owns_tex = true;
img->owns_tex = owns_texture;
img->tex = tex;
}

Expand Down
3 changes: 2 additions & 1 deletion Sources/krink/graphics2/ttf.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ void kr_ttf_load(kr_ttf_font_t *font, int size);
/// <param name="tex">The texture that contains the font</param>
/// <param name="xoff">Offset of the baked font in the texture</param>
/// <param name="yoff">Offset of the baked font in the texture</param>
/// <param name="owns_texture">Whether the font owns the texture</param>
void kr_ttf_load_baked_font(kr_ttf_font_t *font, kr_ttf_font_t *origin, int size,
kinc_g4_texture_t *tex, float xoff, float yoff);
kinc_g4_texture_t *tex, float xoff, float yoff, bool owns_texture);

/// <summary>
/// Returns the normalized font height in pixel.
Expand Down

0 comments on commit 929ab75

Please sign in to comment.