summaryrefslogtreecommitdiff
path: root/source/fitz/font.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2017-06-15 17:57:28 +0100
committerRobin Watts <robin.watts@artifex.com>2017-06-22 14:59:43 +0100
commit2764ef8c0fd10d16a41842e8834efb1bd17e65d8 (patch)
treec1811c37e5314d59754e82a467ca88c775e7cd16 /source/fitz/font.c
parentdd58ea5e2ff7e6b61cc5a5b6fd950fb62e92b8be (diff)
downloadmupdf-2764ef8c0fd10d16a41842e8834efb1bd17e65d8.tar.xz
Move rasterizer/anti-alias choices into the draw device.
We still use the fz_context versions as the default, but these can be overridden with draw device options.
Diffstat (limited to 'source/fitz/font.c')
-rw-r--r--source/fitz/font.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/source/fitz/font.c b/source/fitz/font.c
index 77041dd8..79b17458 100644
--- a/source/fitz/font.c
+++ b/source/fitz/font.c
@@ -2,6 +2,7 @@
#include "mupdf/ucdn.h"
#include "fitz-imp.h"
#include "font-imp.h"
+#include "draw-imp.h"
#include <ft2build.h>
#include "hb.h"
@@ -678,7 +679,7 @@ retry_unhinted:
FT_Outline_Translate(&face->glyph->outline, -strength * 32, -strength * 32);
}
- fterr = FT_Render_Glyph(face->glyph, fz_text_aa_level(ctx) > 0 ? FT_RENDER_MODE_NORMAL : FT_RENDER_MODE_MONO);
+ fterr = FT_Render_Glyph(face->glyph, aa > 0 ? FT_RENDER_MODE_NORMAL : FT_RENDER_MODE_MONO);
if (fterr)
{
fz_warn(ctx, "freetype render glyph (gid %d): %s", gid, ft_error_string(fterr));
@@ -746,7 +747,7 @@ fz_render_ft_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm
/* Takes the freetype lock, and returns with it held */
static FT_Glyph
-do_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *state)
+do_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *state, int aa)
{
FT_Face face = font->ft_face;
float expansion = fz_matrix_expansion(ctm);
@@ -829,7 +830,7 @@ do_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_mat
FT_Stroker_Done(stroker);
- fterr = FT_Glyph_To_Bitmap(&glyph, fz_text_aa_level(ctx) > 0 ? FT_RENDER_MODE_NORMAL : FT_RENDER_MODE_MONO, 0, 1);
+ fterr = FT_Glyph_To_Bitmap(&glyph, aa > 0 ? FT_RENDER_MODE_NORMAL : FT_RENDER_MODE_MONO, 0, 1);
if (fterr)
{
fz_warn(ctx, "FT_Glyph_To_Bitmap: %s", ft_error_string(fterr));
@@ -840,9 +841,9 @@ do_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_mat
}
fz_pixmap *
-fz_render_ft_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *state)
+fz_render_ft_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *state, int aa)
{
- FT_Glyph glyph = do_render_ft_stroked_glyph(ctx, font, gid, trm, ctm, state);
+ FT_Glyph glyph = do_render_ft_stroked_glyph(ctx, font, gid, trm, ctm, state, aa);
FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph;
fz_pixmap *pixmap;
@@ -870,9 +871,9 @@ fz_render_ft_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const
}
fz_glyph *
-fz_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *state)
+fz_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *state, int aa)
{
- FT_Glyph glyph = do_render_ft_stroked_glyph(ctx, font, gid, trm, ctm, state);
+ FT_Glyph glyph = do_render_ft_stroked_glyph(ctx, font, gid, trm, ctm, state, aa);
FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph;
fz_glyph *result;
@@ -1253,7 +1254,7 @@ fz_run_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, f
}
fz_pixmap *
-fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_colorspace *model, const fz_irect *scissor)
+fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_colorspace *model, const fz_irect *scissor, int aa)
{
fz_display_list *list;
fz_rect bounds;
@@ -1333,9 +1334,9 @@ fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matr
}
fz_glyph *
-fz_render_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_colorspace *model, const fz_irect *scissor)
+fz_render_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_colorspace *model, const fz_irect *scissor, int aa)
{
- fz_pixmap *pixmap = fz_render_t3_glyph_pixmap(ctx, font, gid, trm, model, scissor);
+ fz_pixmap *pixmap = fz_render_t3_glyph_pixmap(ctx, font, gid, trm, model, scissor, aa);
return fz_new_glyph_from_pixmap(ctx, pixmap);
}