forked from minhngoc25a/freetype2
[truetype] Provide HVAR advance width variation as a service.
Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. * src/truetype/ttdriver.c (tt_service_metrics_variations): Updated. * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Prevent double adjustment of advance width. * src/sfnt/ttmtx.c: Include FT_SERVICE_METRICS_VARIATIONS_H. (tt_face_get_metrics): Apply metrics variations.
This commit is contained in:
parent
aa0c4b4f55
commit
3bd79cc257
19
ChangeLog
19
ChangeLog
|
@ -1,8 +1,25 @@
|
|||
2016-12-15 Werner Lemberg <wl@gnu.org>
|
||||
Dave Arnold <darnold@adobe.com>
|
||||
|
||||
[truetype] Provide HVAR advance width variation as a service.
|
||||
|
||||
Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.
|
||||
|
||||
* src/truetype/ttdriver.c (tt_service_metrics_variations): Updated.
|
||||
|
||||
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Prevent
|
||||
double adjustment of advance width.
|
||||
|
||||
* src/sfnt/ttmtx.c: Include FT_SERVICE_METRICS_VARIATIONS_H.
|
||||
(tt_face_get_metrics): Apply metrics variations.
|
||||
|
||||
2016-12-15 Dave Arnold <darnold@adobe.com>
|
||||
Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[truetype] Provide function to apply `HVAR' advance width variation.
|
||||
|
||||
Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.
|
||||
|
||||
* src/truetype/ttgxvar.c (tt_hadvance_adjust): New function.
|
||||
* src/truetype/ttgxvar.h: Updated.
|
||||
|
||||
|
@ -16,6 +33,8 @@
|
|||
|
||||
Activation of the code follows in another commit.
|
||||
|
||||
Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.
|
||||
|
||||
* include/freetype/ftmm.h (FT_Var_Named_Style): Add `psid' member.
|
||||
|
||||
* src/truetype/ttgxvar.h (GX_HVarData, GX_AxisCoords, GX_HVarRegion,
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
#include FT_INTERNAL_DEBUG_H
|
||||
#include FT_INTERNAL_STREAM_H
|
||||
#include FT_TRUETYPE_TAGS_H
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
#include FT_SERVICE_METRICS_VARIATIONS_H
|
||||
#endif
|
||||
|
||||
#include "ttmtx.h"
|
||||
|
||||
#include "sferrors.h"
|
||||
|
@ -214,6 +219,11 @@
|
|||
FT_ULong table_pos, table_size, table_end;
|
||||
FT_UShort k;
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
FT_Service_MetricsVariations var =
|
||||
(FT_Service_MetricsVariations)face->var;
|
||||
#endif
|
||||
|
||||
|
||||
if ( vertical )
|
||||
{
|
||||
|
@ -274,6 +284,34 @@
|
|||
*abearing = 0;
|
||||
*aadvance = 0;
|
||||
}
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
if ( var )
|
||||
{
|
||||
FT_Face f = FT_FACE( face );
|
||||
FT_Int a = (FT_Int)*aadvance;
|
||||
FT_Int b = (FT_Int)*abearing;
|
||||
|
||||
|
||||
if ( vertical )
|
||||
{
|
||||
if ( var->vadvance_adjust )
|
||||
var->vadvance_adjust( f, gindex, &a );
|
||||
if ( var->tsb_adjust )
|
||||
var->tsb_adjust( f, gindex, &b );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( var->hadvance_adjust )
|
||||
var->hadvance_adjust( f, gindex, &a );
|
||||
if ( var->lsb_adjust )
|
||||
var->lsb_adjust( f, gindex, &b );
|
||||
}
|
||||
|
||||
*aadvance = (FT_Short)a;
|
||||
*abearing = (FT_UShort)b;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -484,7 +484,7 @@
|
|||
FT_DEFINE_SERVICE_METRICSVARIATIONSREC(
|
||||
tt_service_metrics_variations,
|
||||
|
||||
(FT_HAdvance_Adjust_Func)NULL, /* hadvance_adjust */
|
||||
(FT_HAdvance_Adjust_Func)tt_hadvance_adjust, /* hadvance_adjust */
|
||||
(FT_LSB_Adjust_Func) NULL, /* lsb_adjust */
|
||||
(FT_RSB_Adjust_Func) NULL, /* rsb_adjust */
|
||||
|
||||
|
|
|
@ -2629,7 +2629,13 @@
|
|||
FT_Pos delta_y = FT_MulFix( deltas_y[j], apply );
|
||||
|
||||
|
||||
outline->points[j].x += delta_x;
|
||||
/* Experimental fix for double adjustment of advance width: */
|
||||
/* adjust phantom point 2 only if there's no HVAR. */
|
||||
/* */
|
||||
/* TODO: handle LSB (pp1) and VVAR (pp3, pp4) too */
|
||||
if ( j != ( n_points - 3 ) || blend->hvar_checked == FALSE )
|
||||
outline->points[j].x += delta_x;
|
||||
|
||||
outline->points[j].y += delta_y;
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
|
Loading…
Reference in New Issue