[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master 3bd79cc 3/3: [truetype] Provide HVAR advance width va
From: |
Werner LEMBERG |
Subject: |
[freetype2] master 3bd79cc 3/3: [truetype] Provide HVAR advance width variation as a service. |
Date: |
Thu, 15 Dec 2016 13:39:17 +0000 (UTC) |
branch: master
commit 3bd79cc257499f1850a1bace21f3ae371e3b40f0
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>
[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.
---
ChangeLog | 19 +++++++++++++++++++
src/sfnt/ttmtx.c | 38 ++++++++++++++++++++++++++++++++++++++
src/truetype/ttdriver.c | 2 +-
src/truetype/ttgxvar.c | 8 +++++++-
4 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5408870..5a1b3ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,25 @@
+2016-12-15 Werner Lemberg <address@hidden>
+ Dave Arnold <address@hidden>
+
+ [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 <address@hidden>
Werner Lemberg <address@hidden>
[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,
diff --git a/src/sfnt/ttmtx.c b/src/sfnt/ttmtx.c
index 186f873..117a1c8 100644
--- a/src/sfnt/ttmtx.c
+++ b/src/sfnt/ttmtx.c
@@ -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
}
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 2a5319e..93385a5 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -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 */
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index c4eb125..affa619 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master 3bd79cc 3/3: [truetype] Provide HVAR advance width variation as a service.,
Werner LEMBERG <=