From a4c2a31138221165db524ca02f28f0b54698b305 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 22 Aug 2016 19:32:34 +0200 Subject: [truetype] Fix `MPS' instruction. According to Greg Hitchcock, MPS in DWrite really returns the point size. * src/truetype/ttobjs.h (TT_SizeRec): Add `point_size' member. * src/truetype/ttdriver.c (tt_size_request): Set `point_size'. * src/truetype/ttinterp.h (TT_ExecContextRec): Add `pointSize' member. * src/truetype/ttinterp.c (TT_Load_Context): Updated. (Ins_MPS): Fix instruction. --- src/truetype/ttdriver.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/truetype/ttdriver.c') diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 2659b9c9b..6520c93df 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -339,6 +339,25 @@ { error = tt_size_reset( ttsize ); ttsize->root.metrics = ttsize->metrics; + +#ifdef TT_USE_BYTECODE_INTERPRETER + /* for the `MPS' bytecode instruction we need the point size */ + { + FT_UInt resolution = ttsize->metrics.x_ppem > ttsize->metrics.y_ppem + ? req->horiResolution + : req->vertResolution; + + + /* if we don't have a resolution value, assume 72dpi */ + if ( req->type == FT_SIZE_REQUEST_TYPE_SCALES || + !resolution ) + resolution = 72; + + ttsize->point_size = FT_MulDiv( ttsize->ttmetrics.ppem, + 64 * 72, + resolution ); + } +#endif } return error; -- cgit v1.2.1