From 84fd09ea5383262c1993ab52981ad3a3186ee15b Mon Sep 17 00:00:00 2001 From: Dougall Johnson Date: Sat, 14 Oct 2017 11:58:03 +1100 Subject: [PATCH 1/2] stb_truetype: Fix sign error in CFF push immediate --- stb_truetype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stb_truetype.h b/stb_truetype.h index cec2425..6a6e584 100644 --- a/stb_truetype.h +++ b/stb_truetype.h @@ -2172,7 +2172,7 @@ static int stbtt__run_charstring(const stbtt_fontinfo *info, int glyph_index, st // push immediate if (b0 == 255) { - f = (float)stbtt__buf_get32(&b) / 0x10000; + f = (float)(stbtt_int32)stbtt__buf_get32(&b) / 0x10000; } else { stbtt__buf_skip(&b, -1); f = (float)(stbtt_int16)stbtt__cff_int(&b); From 1f2b4271e3d6c4abc143d15ae4be6a47685f230b Mon Sep 17 00:00:00 2001 From: Dougall Johnson Date: Sat, 14 Oct 2017 11:59:09 +1100 Subject: [PATCH 2/2] stb_truetype: Fix CFF GetGlyphBox optional params Fixes #404 --- stb_truetype.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/stb_truetype.h b/stb_truetype.h index 6a6e584..0cb2fdc 100644 --- a/stb_truetype.h +++ b/stb_truetype.h @@ -2210,12 +2210,10 @@ static int stbtt__GetGlyphInfoT2(const stbtt_fontinfo *info, int glyph_index, in { stbtt__csctx c = STBTT__CSCTX_INIT(1); int r = stbtt__run_charstring(info, glyph_index, &c); - if (x0) { - *x0 = r ? c.min_x : 0; - *y0 = r ? c.min_y : 0; - *x1 = r ? c.max_x : 0; - *y1 = r ? c.max_y : 0; - } + if (x0) *x0 = r ? c.min_x : 0; + if (y0) *y0 = r ? c.min_y : 0; + if (x1) *x1 = r ? c.max_x : 0; + if (y1) *y1 = r ? c.max_y : 0; return r ? c.num_vertices : 0; }