summaryrefslogtreecommitdiff
path: root/src/truetype/ttdriver.c
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2016-08-22 19:32:34 +0200
committerWerner Lemberg <wl@gnu.org>2016-08-22 19:32:34 +0200
commita4c2a31138221165db524ca02f28f0b54698b305 (patch)
treef91867676ccd45e8e99dbad8875371531df35efc /src/truetype/ttdriver.c
parent4927953f6ca331380de4536532cd2b239ad9a0e5 (diff)
downloadfreetype2-a4c2a31138221165db524ca02f28f0b54698b305.tar.gz
[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.
Diffstat (limited to 'src/truetype/ttdriver.c')
-rw-r--r--src/truetype/ttdriver.c19
1 files changed, 19 insertions, 0 deletions
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;