summaryrefslogtreecommitdiff
path: root/source/fitz
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2016-10-02 13:23:30 -0400
committerRobin Watts <robin.watts@artifex.com>2016-10-07 16:56:46 +0100
commitf5263de25f42552fce13944b23238676503d0e9d (patch)
tree134493fbf676873854a37a8e9a7351f13a8c4713 /source/fitz
parent21b695f447ad3fa852e11a4f20b0576ab75b527f (diff)
downloadmupdf-f5263de25f42552fce13944b23238676503d0e9d.tar.xz
Add ctx to fz_font functions.
Diffstat (limited to 'source/fitz')
-rw-r--r--source/fitz/draw-glyph.c12
-rw-r--r--source/fitz/font.c10
-rw-r--r--source/fitz/stext-device.c6
-rw-r--r--source/fitz/stext-output.c20
-rw-r--r--source/fitz/svg-device.c2
-rw-r--r--source/fitz/trace-device.c2
6 files changed, 26 insertions, 26 deletions
diff --git a/source/fitz/draw-glyph.c b/source/fitz/draw-glyph.c
index 93bd62b3..a0c47b74 100644
--- a/source/fitz/draw-glyph.c
+++ b/source/fitz/draw-glyph.c
@@ -175,7 +175,7 @@ fz_subpixel_adjust(fz_context *ctx, fz_matrix *ctm, fz_matrix *subpix_ctm, unsig
fz_glyph *
fz_render_stroked_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *stroke, const fz_irect *scissor)
{
- if (fz_font_ft_face(font))
+ if (fz_font_ft_face(ctx, font))
{
fz_matrix subpix_trm;
unsigned char qe, qf;
@@ -191,7 +191,7 @@ fz_render_stroked_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm,
fz_pixmap *
fz_render_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *stroke, const fz_irect *scissor)
{
- if (fz_font_ft_face(font))
+ if (fz_font_ft_face(ctx, font))
{
fz_matrix subpix_trm;
unsigned char qe, qf;
@@ -252,7 +252,7 @@ fz_render_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, fz_colo
int do_cache, locked, caching;
fz_glyph_cache_entry *entry;
unsigned hash;
- int is_ft_font = !!fz_font_ft_face(font);
+ int is_ft_font = !!fz_font_ft_face(ctx, font);
fz_var(locked);
fz_var(caching);
@@ -312,7 +312,7 @@ fz_render_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, fz_colo
{
val = fz_render_ft_glyph(ctx, font, gid, &subpix_ctm, key.aa);
}
- else if (fz_font_t3_procs(font))
+ else if (fz_font_t3_procs(ctx, font))
{
/* We drop the glyphcache here, and execute the t3
* glyph code. The danger here is that some other
@@ -414,7 +414,7 @@ fz_render_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm,
unsigned char qe, qf;
fz_matrix subpix_ctm;
float size = fz_subpixel_adjust(ctx, ctm, &subpix_ctm, &qe, &qf);
- int is_ft_font = !!fz_font_ft_face(font);
+ int is_ft_font = !!fz_font_ft_face(ctx, font);
if (size <= MAX_GLYPH_SIZE)
{
@@ -432,7 +432,7 @@ fz_render_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm,
{
val = fz_render_ft_glyph_pixmap(ctx, font, gid, &subpix_ctm, fz_text_aa_level(ctx));
}
- else if (fz_font_t3_procs(font))
+ else if (fz_font_t3_procs(ctx, font))
{
val = fz_render_t3_glyph_pixmap(ctx, font, gid, &subpix_ctm, NULL, scissor);
}
diff --git a/source/fitz/font.c b/source/fitz/font.c
index c5e6503e..6d86133c 100644
--- a/source/fitz/font.c
+++ b/source/fitz/font.c
@@ -1543,22 +1543,22 @@ fz_encode_character_with_fallback(fz_context *ctx, fz_font *user_font, int unico
return *out_font = user_font, 0;
}
-const char *fz_font_name(fz_font *font)
+const char *fz_font_name(fz_context *ctx, fz_font *font)
{
return font ? font->name : "";
}
-fz_buffer **fz_font_t3_procs(fz_font *font)
+fz_buffer **fz_font_t3_procs(fz_context *ctx, fz_font *font)
{
return font ? font->t3procs : NULL;
}
-fz_rect *fz_font_bbox(fz_font *font)
+fz_rect *fz_font_bbox(fz_context *ctx, fz_font *font)
{
return font ? &font->bbox : NULL;
}
-void *fz_font_ft_face(fz_font *font)
+void *fz_font_ft_face(fz_context *ctx, fz_font *font)
{
return font ? font->ft_face : NULL;
}
@@ -1568,7 +1568,7 @@ fz_font_flags_t *fz_font_flags(fz_font *font)
return font ? &font->flags : NULL;
}
-fz_shaper_data_t *fz_font_shaper_data(fz_font *font)
+fz_shaper_data_t *fz_font_shaper_data(fz_context *ctx, fz_font *font)
{
return font ? &font->shaper_data : NULL;
}
diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c
index 007a6a2a..c5073455 100644
--- a/source/fitz/stext-device.c
+++ b/source/fitz/stext-device.c
@@ -784,9 +784,9 @@ static void
fz_stext_extract(fz_context *ctx, fz_stext_device *dev, fz_text_span *span, const fz_matrix *ctm, fz_stext_style *style)
{
fz_font *font = span->font;
- FT_Face face = fz_font_ft_face(font);
- fz_buffer **t3procs = fz_font_t3_procs(font);
- fz_rect *bbox = fz_font_bbox(font);
+ FT_Face face = fz_font_ft_face(ctx, font);
+ fz_buffer **t3procs = fz_font_t3_procs(ctx, font);
+ fz_rect *bbox = fz_font_bbox(ctx, font);
fz_matrix tm = span->trm;
fz_matrix trm;
float adv;
diff --git a/source/fitz/stext-output.c b/source/fitz/stext-output.c
index 39d97dc3..a6c51cb8 100644
--- a/source/fitz/stext-output.c
+++ b/source/fitz/stext-output.c
@@ -8,23 +8,23 @@
/* XML, HTML and plain-text output */
-static int font_is_bold(fz_font *font)
+static int font_is_bold(fz_context *ctx, fz_font *font)
{
- FT_Face face = fz_font_ft_face(font);
+ FT_Face face = fz_font_ft_face(ctx, font);
if (face && (face->style_flags & FT_STYLE_FLAG_BOLD))
return 1;
- if (strstr(fz_font_name(font), "Bold"))
+ if (strstr(fz_font_name(ctx, font), "Bold"))
return 1;
return 0;
}
-static int font_is_italic(fz_font *font)
+static int font_is_italic(fz_context *ctx, fz_font *font)
{
- FT_Face face = fz_font_ft_face(font);
+ FT_Face face = fz_font_ft_face(ctx, font);
const char *name;
if (face && (face->style_flags & FT_STYLE_FLAG_ITALIC))
return 1;
- name = fz_font_name(font);
+ name = fz_font_name(ctx, font);
if (strstr(name, "Italic") || strstr(name, "Oblique"))
return 1;
return 0;
@@ -55,14 +55,14 @@ fz_print_style_end(fz_context *ctx, fz_output *out, fz_stext_style *style)
static void
fz_print_style(fz_context *ctx, fz_output *out, fz_stext_style *style)
{
- const char *name = fz_font_name(style->font);
+ const char *name = fz_font_name(ctx, style->font);
const char *s = strchr(name, '+');
s = s ? s + 1 : name;
fz_printf(ctx, out, "span.s%d{font-family:\"%s\";font-size:%gpt;",
style->id, s, style->size);
- if (font_is_italic(style->font))
+ if (font_is_italic(ctx, style->font))
fz_printf(ctx, out, "font-style:italic;");
- if (font_is_bold(style->font))
+ if (font_is_bold(ctx, style->font))
fz_printf(ctx, out, "font-weight:bold;");
fz_printf(ctx, out, "}\n");
}
@@ -319,7 +319,7 @@ fz_print_stext_page_xml(fz_context *ctx, fz_output *out, fz_stext_page *page)
fz_printf(ctx, out, "</span>\n");
}
style = ch->style;
- name = fz_font_name(style->font);
+ name = fz_font_name(ctx, style->font);
s = strchr(name, '+');
s = s ? s + 1 : name;
fz_printf(ctx, out, "<span bbox=\"%g %g %g %g\" font=\"%s\" size=\"%g\">\n",
diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c
index 1484dddd..7397d059 100644
--- a/source/fitz/svg-device.c
+++ b/source/fitz/svg-device.c
@@ -274,7 +274,7 @@ svg_dev_text_span(fz_context *ctx, svg_device *sdev, const fz_matrix *ctm, const
fz_printf(ctx, out, " transform=\"matrix(%g,%g,%g,%g,%g,%g)\"",
local_trm.a, local_trm.b, local_trm.c, local_trm.d, local_trm.e, local_trm.f);
fz_printf(ctx, out, " font-size=\"%g\"", size);
- fz_printf(ctx, out, " font-family=\"%s\"", fz_font_name(span->font));
+ fz_printf(ctx, out, " font-family=\"%s\"", fz_font_name(ctx, span->font));
/* Leading (and repeated) whitespace presents a problem for SVG
* text, so elide it here. */
diff --git a/source/fitz/trace-device.c b/source/fitz/trace-device.c
index bcb68bf8..881d7567 100644
--- a/source/fitz/trace-device.c
+++ b/source/fitz/trace-device.c
@@ -39,7 +39,7 @@ static void
fz_trace_text_span(fz_context *ctx, fz_output *out, fz_text_span *span)
{
int i;
- fz_printf(ctx, out, "<span font=\"%s\" wmode=\"%d\"", fz_font_name(span->font), span->wmode);
+ fz_printf(ctx, out, "<span font=\"%s\" wmode=\"%d\"", fz_font_name(ctx, span->font), span->wmode);
fz_printf(ctx, out, " trm=\"%g %g %g %g\">\n", span->trm.a, span->trm.b, span->trm.c, span->trm.d);
for (i = 0; i < span->len; i++)
{