summaryrefslogtreecommitdiff
path: root/xps
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-02-13 17:53:21 +0000
committerRobin Watts <robin.watts@artifex.com>2012-02-13 22:05:12 +0000
commitd4c73c65888e422f8b5d5c102ce80f4e82622bfb (patch)
treef9879093e06204e8e85842996dab3a91bd3df0e9 /xps
parente9c534aee18fa86a61decb9f7c17b3d28ead94dc (diff)
downloadmupdf-d4c73c65888e422f8b5d5c102ce80f4e82622bfb.tar.xz
Add locking around freetype calls.
We only open one instance of freetype per document. We therefore have to ensure that only 1 call to it takes place at a time. We introduce a lock for this purpose (FZ_LOCK_FREETYPE), and arrange to take/release it as required. We also update the font context so it is properly shared.
Diffstat (limited to 'xps')
-rw-r--r--xps/xps_glyphs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/xps/xps_glyphs.c b/xps/xps_glyphs.c
index dc85f0ae..f7098ed1 100644
--- a/xps/xps_glyphs.c
+++ b/xps/xps_glyphs.c
@@ -58,10 +58,13 @@ xps_measure_font_glyph(xps_document *doc, fz_font *font, int gid, xps_glyph_metr
int mask = FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING | FT_LOAD_IGNORE_TRANSFORM;
FT_Face face = font->ft_face;
FT_Fixed hadv, vadv;
+ fz_context *ctx = doc->ctx;
+ fz_lock(ctx, FZ_LOCK_FREETYPE);
FT_Set_Char_Size(face, 64, 64, 72, 72);
FT_Get_Advance(face, gid, mask, &hadv);
FT_Get_Advance(face, gid, mask | FT_LOAD_VERTICAL_LAYOUT, &vadv);
+ fz_unlock(ctx, FZ_LOCK_FREETYPE);
mtx->hadv = hadv / 65536.0f;
mtx->vadv = vadv / 65536.0f;