stb_truetype: Fix a couple of CFF bugs

The CFF/Type 2 changes broke including without STB_TRUETYPE_IMPLEMENTATION defined, and had a typo. Sorry!
This commit is contained in:
Dougall Johnson 2017-01-03 13:08:05 +11:00 committed by GitHub
parent 94374c99c8
commit 9bb7f80cb8

View File

@ -460,7 +460,7 @@ extern "C" {
// private structure // private structure
typedef struct typedef struct
{ {
stbtt_uint8 *data; unsigned char *data;
int cursor; int cursor;
int size; int size;
} stbtt__buf; } stbtt__buf;
@ -1752,7 +1752,7 @@ static void stbtt__track_vertex(stbtt__csctx *c, stbtt_int32 x, stbtt_int32 y)
c->started = 1; c->started = 1;
} }
static void stbtt__cstx_v(stbtt__csctx *c, stbtt_uint8 type, stbtt_int32 x, stbtt_int32 y, stbtt_int32 cx, stbtt_int32 cy, stbtt_int32 cx1, stbtt_int32 cy1) static void stbtt__csctx_v(stbtt__csctx *c, stbtt_uint8 type, stbtt_int32 x, stbtt_int32 y, stbtt_int32 cx, stbtt_int32 cy, stbtt_int32 cx1, stbtt_int32 cy1)
{ {
if (c->bounds) { if (c->bounds) {
stbtt__track_vertex(c, x, y); stbtt__track_vertex(c, x, y);
@ -1771,7 +1771,7 @@ static void stbtt__cstx_v(stbtt__csctx *c, stbtt_uint8 type, stbtt_int32 x, stbt
static void stbtt__csctx_close_shape(stbtt__csctx *ctx) static void stbtt__csctx_close_shape(stbtt__csctx *ctx)
{ {
if (ctx->first_x != ctx->x || ctx->first_y != ctx->y) if (ctx->first_x != ctx->x || ctx->first_y != ctx->y)
stbtt__cstx_v(ctx, STBTT_vline, (int)ctx->first_x, (int)ctx->first_y, 0, 0, 0, 0); stbtt__csctx_v(ctx, STBTT_vline, (int)ctx->first_x, (int)ctx->first_y, 0, 0, 0, 0);
} }
static void stbtt__csctx_rmove_to(stbtt__csctx *ctx, float dx, float dy) static void stbtt__csctx_rmove_to(stbtt__csctx *ctx, float dx, float dy)
@ -1779,14 +1779,14 @@ static void stbtt__csctx_rmove_to(stbtt__csctx *ctx, float dx, float dy)
stbtt__csctx_close_shape(ctx); stbtt__csctx_close_shape(ctx);
ctx->first_x = ctx->x = ctx->x + dx; ctx->first_x = ctx->x = ctx->x + dx;
ctx->first_y = ctx->y = ctx->y + dy; ctx->first_y = ctx->y = ctx->y + dy;
stbtt__cstx_v(ctx, STBTT_vmove, (int)ctx->x, (int)ctx->y, 0, 0, 0, 0); stbtt__csctx_v(ctx, STBTT_vmove, (int)ctx->x, (int)ctx->y, 0, 0, 0, 0);
} }
static void stbtt__csctx_rline_to(stbtt__csctx *ctx, float dx, float dy) static void stbtt__csctx_rline_to(stbtt__csctx *ctx, float dx, float dy)
{ {
ctx->x += dx; ctx->x += dx;
ctx->y += dy; ctx->y += dy;
stbtt__cstx_v(ctx, STBTT_vline, (int)ctx->x, (int)ctx->y, 0, 0, 0, 0); stbtt__csctx_v(ctx, STBTT_vline, (int)ctx->x, (int)ctx->y, 0, 0, 0, 0);
} }
static void stbtt__csctx_rccurve_to(stbtt__csctx *ctx, float dx1, float dy1, float dx2, float dy2, float dx3, float dy3) static void stbtt__csctx_rccurve_to(stbtt__csctx *ctx, float dx1, float dy1, float dx2, float dy2, float dx3, float dy3)
@ -1797,7 +1797,7 @@ static void stbtt__csctx_rccurve_to(stbtt__csctx *ctx, float dx1, float dy1, flo
float cy2 = cy1 + dy2; float cy2 = cy1 + dy2;
ctx->x = cx2 + dx3; ctx->x = cx2 + dx3;
ctx->y = cy2 + dy3; ctx->y = cy2 + dy3;
stbtt__cstx_v(ctx, STBTT_vcubic, (int)ctx->x, (int)ctx->y, (int)cx1, (int)cy1, (int)cx2, (int)cy2); stbtt__csctx_v(ctx, STBTT_vcubic, (int)ctx->x, (int)ctx->y, (int)cx1, (int)cy1, (int)cx2, (int)cy2);
} }
static stbtt__buf stbtt__get_subr(stbtt__buf idx, int n) static stbtt__buf stbtt__get_subr(stbtt__buf idx, int n)