[truetype] Avoid code duplication. * src/truetype/ttobjs.c (tt_size_run_prep): Scale CVT values in this function. (tt_size_ready_bytecode): Updated. * src/truetype/ttgload.c (tt_loader_init): Updated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
diff --git a/ChangeLog b/ChangeLog
index 48df20a..25877da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2019-05-16 Werner Lemberg <wl@gnu.org>
+
+ [truetype] Avoid code duplication.
+
+ * src/truetype/ttobjs.c (tt_size_run_prep): Scale CVT values in this
+ function.
+ (tt_size_ready_bytecode): Updated.
+ * src/truetype/ttgload.c (tt_loader_init): Updated.
+
2019-05-13 Jouk Jansen <joukj@hrem.nano.tudelft.nl>
* vms_make.com: Updated. Handle `bzip2' directory, too.
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 0111c40..84b65d4 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -2681,11 +2681,6 @@
if ( reexecute )
{
- FT_UInt i;
-
-
- for ( i = 0; i < size->cvt_size; i++ )
- size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
error = tt_size_run_prep( size, pedantic );
if ( error )
return error;
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index f3a432c..98a9fa4 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -937,8 +937,20 @@
TT_Face face = (TT_Face)size->root.face;
TT_ExecContext exec;
FT_Error error;
+ FT_UInt i;
+ /* Scale the cvt values to the new ppem. */
+ /* By default, we use the y ppem value for scaling. */
+ FT_TRACE6(( "CVT values:\n" ));
+ for ( i = 0; i < size->cvt_size; i++ )
+ {
+ size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
+ FT_TRACE6(( " %3d: %d (%f)\n",
+ i, face->cvt[i], size->cvt[i] / 64.0 ));
+ }
+ FT_TRACE6(( "\n" ));
+
exec = size->context;
error = TT_Load_Context( exec, face, size );
@@ -1171,20 +1183,8 @@
if ( size->cvt_ready < 0 )
{
FT_UInt i;
- TT_Face face = (TT_Face)size->root.face;
- /* Scale the cvt values to the new ppem. */
- /* By default, we use the y ppem value for scaling. */
- FT_TRACE6(( "CVT values:\n" ));
- for ( i = 0; i < size->cvt_size; i++ )
- {
- size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
- FT_TRACE6(( " %3d: %d (%f)\n",
- i, face->cvt[i], size->cvt[i] / 64.0 ));
- }
- FT_TRACE6(( "\n" ));
-
/* all twilight points are originally zero */
for ( i = 0; i < (FT_UInt)size->twilight.n_points; i++ )
{