summaryrefslogtreecommitdiff
path: root/source/fitz/draw-glyph.c
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2016-09-28 16:46:10 +0100
committerRobin Watts <robin.watts@artifex.com>2016-10-05 19:37:11 +0100
commit9e88b088ea2ddcb6f85584750eb3c989af101905 (patch)
tree19db41ec596cc347fd1b77389821135f8e934e84 /source/fitz/draw-glyph.c
parent14109acf198d9371a4e2cb09ea4a125af67d441d (diff)
downloadmupdf-9e88b088ea2ddcb6f85584750eb3c989af101905.tar.xz
Move fz_font definition to be private.
Move the definition of fz_font to be in a private header file rather than in the public API. Add accessors for specific parts of the structure and use them as appropriate. The font flags, and the harfbuzz records remain public. This means that only 3 files now need access to the font implementation (font.c, pdf-font.c and pdf-type3.c). This may be able to be improved further in future.
Diffstat (limited to 'source/fitz/draw-glyph.c')
-rw-r--r--source/fitz/draw-glyph.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/source/fitz/draw-glyph.c b/source/fitz/draw-glyph.c
index dbaace9e..93bd62b3 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 (font->ft_face)
+ if (fz_font_ft_face(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 (font->ft_face)
+ if (fz_font_ft_face(font))
{
fz_matrix subpix_trm;
unsigned char qe, qf;
@@ -252,6 +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);
fz_var(locked);
fz_var(caching);
@@ -266,7 +267,7 @@ fz_render_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, fz_colo
}
else
{
- if (font->ft_face)
+ if (is_ft_font)
return NULL;
subpix_scissor.x0 = scissor->x0 - floorf(ctm->e);
subpix_scissor.y0 = scissor->y0 - floorf(ctm->f);
@@ -307,11 +308,11 @@ fz_render_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, fz_colo
fz_try(ctx)
{
- if (font->ft_face)
+ if (is_ft_font)
{
val = fz_render_ft_glyph(ctx, font, gid, &subpix_ctm, key.aa);
}
- else if (font->t3procs)
+ else if (fz_font_t3_procs(font))
{
/* We drop the glyphcache here, and execute the t3
* glyph code. The danger here is that some other
@@ -339,7 +340,7 @@ fz_render_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, fz_colo
/* If we throw an exception whilst caching,
* just ignore the exception and carry on. */
caching = 1;
- if (!font->ft_face)
+ if (!is_ft_font)
{
/* We had to unlock. Someone else might
* have rendered in the meantime */
@@ -413,6 +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);
if (size <= MAX_GLYPH_SIZE)
{
@@ -420,17 +422,17 @@ fz_render_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm,
}
else
{
- if (font->ft_face)
+ if (is_ft_font)
return NULL;
}
fz_try(ctx)
{
- if (font->ft_face)
+ if (is_ft_font)
{
val = fz_render_ft_glyph_pixmap(ctx, font, gid, &subpix_ctm, fz_text_aa_level(ctx));
}
- else if (font->t3procs)
+ else if (fz_font_t3_procs(font))
{
val = fz_render_t3_glyph_pixmap(ctx, font, gid, &subpix_ctm, NULL, scissor);
}