Skip to content

Commit 929ab75

Browse files
committed
Allow specifying ownership
API breaking change to loading baked font!!
1 parent 7f2bbe4 commit 929ab75

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Sources/krink/graphics2/ttf.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ void kr_ttf_load(kr_ttf_font_t *font, int size) {
244244
}
245245

246246
void kr_ttf_load_baked_font(kr_ttf_font_t *font, kr_ttf_font_t *origin, int size,
247-
kinc_g4_texture_t *tex, float xoff, float yoff) {
247+
kinc_g4_texture_t *tex, float xoff, float yoff, bool owns_texture) {
248248

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

@@ -269,7 +269,7 @@ void kr_ttf_load_baked_font(kr_ttf_font_t *font, kr_ttf_font_t *origin, int size
269269
}
270270
img->first_unused_y = origin_img->first_unused_y + (int)(yoff + 0.5f);
271271
}
272-
img->owns_tex = true;
272+
img->owns_tex = owns_texture;
273273
img->tex = tex;
274274
}
275275

Sources/krink/graphics2/ttf.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ void kr_ttf_load(kr_ttf_font_t *font, int size);
6565
/// <param name="tex">The texture that contains the font</param>
6666
/// <param name="xoff">Offset of the baked font in the texture</param>
6767
/// <param name="yoff">Offset of the baked font in the texture</param>
68+
/// <param name="owns_texture">Whether the font owns the texture</param>
6869
void kr_ttf_load_baked_font(kr_ttf_font_t *font, kr_ttf_font_t *origin, int size,
69-
kinc_g4_texture_t *tex, float xoff, float yoff);
70+
kinc_g4_texture_t *tex, float xoff, float yoff, bool owns_texture);
7071

7172
/// <summary>
7273
/// Returns the normalized font height in pixel.

0 commit comments

Comments
 (0)