From 1dad328fe9839d57f8282129b3cb9c6a9b75f9c2 Mon Sep 17 00:00:00 2001 From: Jai <814683@qq.com> Date: Fri, 16 Dec 2022 12:20:03 +0800 Subject: [PATCH] Fix the problem that nk_font_bake_pack uses ttc font offset incorrectly (#456) --- nuklear.h | 2 +- src/nuklear_font.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nuklear.h b/nuklear.h index d115913..c76926a 100644 --- a/nuklear.h +++ b/nuklear.h @@ -16619,7 +16619,7 @@ nk_font_bake_pack(struct nk_font_baker *baker, struct stbtt_fontinfo *font_info = &baker->build[i++].info; font_info->userdata = alloc; - if (!stbtt_InitFont(font_info, (const unsigned char*)it->ttf_blob, 0)) + if (!stbtt_InitFont(font_info, (const unsigned char*)it->ttf_blob, stbtt_GetFontOffsetForIndex((const unsigned char*)it->ttf_blob, 0))) return nk_false; } while ((it = it->n) != config_iter); } diff --git a/src/nuklear_font.c b/src/nuklear_font.c index 49df38e..431ed80 100644 --- a/src/nuklear_font.c +++ b/src/nuklear_font.c @@ -194,7 +194,7 @@ nk_font_bake_pack(struct nk_font_baker *baker, struct stbtt_fontinfo *font_info = &baker->build[i++].info; font_info->userdata = alloc; - if (!stbtt_InitFont(font_info, (const unsigned char*)it->ttf_blob, 0)) + if (!stbtt_InitFont(font_info, (const unsigned char*)it->ttf_blob, stbtt_GetFontOffsetForIndex((const unsigned char*)it->ttf_blob, 0))) return nk_false; } while ((it = it->n) != config_iter); }