[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.
This commit is contained in:
parent
4927953f6c
commit
a4c2a31138
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
||||||
|
2016-08-16 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
|
[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.
|
||||||
|
|
||||||
2016-08-16 Werner Lemberg <wl@gnu.org>
|
2016-08-16 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
[lzw] Optimize last commit.
|
[lzw] Optimize last commit.
|
||||||
|
|
|
@ -339,6 +339,25 @@
|
||||||
{
|
{
|
||||||
error = tt_size_reset( ttsize );
|
error = tt_size_reset( ttsize );
|
||||||
ttsize->root.metrics = ttsize->metrics;
|
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;
|
return error;
|
||||||
|
|
|
@ -397,6 +397,7 @@
|
||||||
exec->maxIDefs = size->max_instruction_defs;
|
exec->maxIDefs = size->max_instruction_defs;
|
||||||
exec->FDefs = size->function_defs;
|
exec->FDefs = size->function_defs;
|
||||||
exec->IDefs = size->instruction_defs;
|
exec->IDefs = size->instruction_defs;
|
||||||
|
exec->pointSize = size->point_size;
|
||||||
exec->tt_metrics = size->ttmetrics;
|
exec->tt_metrics = size->ttmetrics;
|
||||||
exec->metrics = size->metrics;
|
exec->metrics = size->metrics;
|
||||||
|
|
||||||
|
@ -2580,13 +2581,20 @@
|
||||||
Ins_MPS( TT_ExecContext exc,
|
Ins_MPS( TT_ExecContext exc,
|
||||||
FT_Long* args )
|
FT_Long* args )
|
||||||
{
|
{
|
||||||
/* Note: The point size should be irrelevant in a given font program; */
|
if ( NO_SUBPIXEL_HINTING )
|
||||||
/* we thus decide to return only the PPEM value. */
|
{
|
||||||
#if 0
|
/* Microsoft's GDI bytecode interpreter always returns value 12; */
|
||||||
args[0] = exc->metrics.pointSize;
|
/* we return the current PPEM value instead. */
|
||||||
#else
|
args[0] = exc->func_cur_ppem( exc );
|
||||||
args[0] = exc->func_cur_ppem( exc );
|
}
|
||||||
#endif
|
else
|
||||||
|
{
|
||||||
|
/* A possible practical application of the MPS instruction is to */
|
||||||
|
/* implement optical scaling and similar features, which should be */
|
||||||
|
/* based on perceptual attributes, thus independent of the */
|
||||||
|
/* resolution. */
|
||||||
|
args[0] = exc->pointSize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -170,6 +170,7 @@ FT_BEGIN_HEADER
|
||||||
pts,
|
pts,
|
||||||
twilight;
|
twilight;
|
||||||
|
|
||||||
|
FT_Long pointSize; /* in 26.6 format */
|
||||||
FT_Size_Metrics metrics;
|
FT_Size_Metrics metrics;
|
||||||
TT_Size_Metrics tt_metrics; /* size metrics */
|
TT_Size_Metrics tt_metrics; /* size metrics */
|
||||||
|
|
||||||
|
|
|
@ -286,6 +286,8 @@ FT_BEGIN_HEADER
|
||||||
|
|
||||||
#ifdef TT_USE_BYTECODE_INTERPRETER
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
||||||
|
|
||||||
|
FT_Long point_size; /* for the `MPS' bytecode instruction */
|
||||||
|
|
||||||
FT_UInt num_function_defs; /* number of function definitions */
|
FT_UInt num_function_defs; /* number of function definitions */
|
||||||
FT_UInt max_function_defs;
|
FT_UInt max_function_defs;
|
||||||
TT_DefArray function_defs; /* table of function definitions */
|
TT_DefArray function_defs; /* table of function definitions */
|
||||||
|
|
Loading…
Reference in New Issue