Browse Source

Merge branch 'cff-type2-fixes' of https://github.com/dougallj/stb

Sean Barrett 7 years ago
parent
commit
0b81a54354
1 changed files with 5 additions and 7 deletions
  1. 5 7
      stb_truetype.h

+ 5 - 7
stb_truetype.h

@@ -2172,7 +2172,7 @@ static int stbtt__run_charstring(const stbtt_fontinfo *info, int glyph_index, st
 
 
          // push immediate
          // push immediate
          if (b0 == 255) {
          if (b0 == 255) {
-            f = (float)stbtt__buf_get32(&b) / 0x10000;
+            f = (float)(stbtt_int32)stbtt__buf_get32(&b) / 0x10000;
          } else {
          } else {
             stbtt__buf_skip(&b, -1);
             stbtt__buf_skip(&b, -1);
             f = (float)(stbtt_int16)stbtt__cff_int(&b);
             f = (float)(stbtt_int16)stbtt__cff_int(&b);
@@ -2210,12 +2210,10 @@ static int stbtt__GetGlyphInfoT2(const stbtt_fontinfo *info, int glyph_index, in
 {
 {
    stbtt__csctx c = STBTT__CSCTX_INIT(1);
    stbtt__csctx c = STBTT__CSCTX_INIT(1);
    int r = stbtt__run_charstring(info, glyph_index, &c);
    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;
    return r ? c.num_vertices : 0;
 }
 }