diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-02-15 16:30:50 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-02-15 16:33:10 +0100 |
commit | 5dcb64bc4074e583a3fd2155c17a270feccac39f (patch) | |
tree | 5ba145ec51c5f412d168ef979e14d21f60880825 /source/fitz | |
parent | 2198dc6bf7e23d06fc7ebf972ef3226aea1505b1 (diff) | |
download | mupdf-5dcb64bc4074e583a3fd2155c17a270feccac39f.tar.xz |
Convert line cap types to freetype linecap types properly.
Don't just cast an enum to another.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/font.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/source/fitz/font.c b/source/fitz/font.c index bfe91cf4..b3403229 100644 --- a/source/fitz/font.c +++ b/source/fitz/font.c @@ -717,6 +717,7 @@ do_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_mat FT_Stroker stroker; FT_Glyph glyph; FT_Stroker_LineJoin line_join; + FT_Stroker_LineCap line_cap; fz_matrix local_trm = *trm; fz_adjust_ft_glyph_width(ctx, font, gid, &local_trm); @@ -755,22 +756,19 @@ do_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_mat return NULL; } -#if FREETYPE_MAJOR * 10000 + FREETYPE_MINOR * 100 + FREETYPE_PATCH > 20405 - /* New freetype */ line_join = state->linejoin == FZ_LINEJOIN_MITER ? FT_STROKER_LINEJOIN_MITER_FIXED : state->linejoin == FZ_LINEJOIN_ROUND ? FT_STROKER_LINEJOIN_ROUND : state->linejoin == FZ_LINEJOIN_BEVEL ? FT_STROKER_LINEJOIN_BEVEL : FT_STROKER_LINEJOIN_MITER_VARIABLE; -#else - /* Old freetype */ - line_join = - state->linejoin == FZ_LINEJOIN_MITER ? FT_STROKER_LINEJOIN_MITER : - state->linejoin == FZ_LINEJOIN_ROUND ? FT_STROKER_LINEJOIN_ROUND : - state->linejoin == FZ_LINEJOIN_BEVEL ? FT_STROKER_LINEJOIN_BEVEL : - FT_STROKER_LINEJOIN_MITER; -#endif - FT_Stroker_Set(stroker, linewidth, (FT_Stroker_LineCap)state->start_cap, line_join, state->miterlimit * 65536); + line_cap = + state->start_cap == FZ_LINECAP_BUTT ? FT_STROKER_LINECAP_BUTT : + state->start_cap == FZ_LINECAP_ROUND ? FT_STROKER_LINECAP_ROUND : + state->start_cap == FZ_LINECAP_SQUARE ? FT_STROKER_LINECAP_SQUARE : + state->start_cap == FZ_LINECAP_TRIANGLE ? FT_STROKER_LINECAP_BUTT : + FT_STROKER_LINECAP_BUTT; + + FT_Stroker_Set(stroker, linewidth, line_cap, line_join, state->miterlimit * 65536); fterr = FT_Get_Glyph(face->glyph, &glyph); if (fterr) |