freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] [freetype2] master 300da33 1/2: * src/truetype/ttgxvar.c


From: Behdad Esfahbod
Subject: Re: [ft-devel] [freetype2] master 300da33 1/2: * src/truetype/ttgxvar.c (ft_var_get_item_delta): Optimized.
Date: Thu, 1 Nov 2018 18:26:09 -0400

Eg.

../../../../util/hb-shape ../../../../../test/shaping/data/text-rendering-tests/fonts/TestHVAROne.otf --shaper=ot --verify --font-size=1000 --ned --remove-default-ignorables --font-funcs=ft --variations=wght=1000 --unicodes U+0041,U+0042,U+0043
Actual:   [A|address@hidden,0|address@hidden,0]
Expected: [A|address@hidden,0|address@hidden,0]
1 tests failed.
FAIL tests/HVAR-1.tests (exit status: 1)


On Thu, Nov 1, 2018 at 6:24 PM Behdad Esfahbod <address@hidden> wrote:
And you broke it.  Four of the harfbuzz/test/shaping/data/text-rendering-tests fail with this.

I actually appreciate if you don't touch that code.  It's been put in place *very* carefully.

On Wed, Oct 31, 2018 at 10:02 PM Alexei Podtelezhnikov <address@hidden> wrote:
branch: master
commit 300da33d61512fe98dc6f34e68fbc330120600ba
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>

    * src/truetype/ttgxvar.c (ft_var_get_item_delta): Optimized.
---
 ChangeLog              |  4 ++++
 src/truetype/ttgxvar.c | 44 ++++++++++++++++++++------------------------
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 94879e5..6379771 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-10-31  Alexei Podtelezhnikov  <address@hidden>
+
+       * src/truetype/ttgxvar.c (ft_var_get_item_delta): Optimized.
+
 2018-10-29  Werner Lemberg  <address@hidden>

        [base] Fix numeric overflow.
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 9f41d0e..336fad1 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -893,47 +893,43 @@
       /* inner loop steps through axes in this region */
       for ( j = 0; j < itemStore->axisCount; j++, axis++ )
       {
-        FT_Fixed  axisScalar;
-
-
         /* compute the scalar contribution of this axis; */
         /* ignore invalid ranges                         */
         if ( axis->startCoord > axis->peakCoord ||
              axis->peakCoord > axis->endCoord   )
-          axisScalar = FT_FIXED_ONE;
+          continue;

         else if ( axis->startCoord < 0 &&
                   axis->endCoord > 0   &&
                   axis->peakCoord != 0 )
-          axisScalar = FT_FIXED_ONE;
+          continue;

         /* peak of 0 means ignore this axis */
         else if ( axis->peakCoord == 0 )
-          axisScalar = FT_FIXED_ONE;
+          continue;

         /* ignore this region if coords are out of range */
-        else if ( face->blend->normalizedcoords[j] < axis->startCoord ||
-                  face->blend->normalizedcoords[j] > axis->endCoord   )
-          axisScalar = 0;
-
-        /* calculate a proportional factor */
-        else
+        else if ( face->blend->normalizedcoords[j] <= axis->startCoord ||
+                  face->blend->normalizedcoords[j] >= axis->endCoord   )
         {
-          if ( face->blend->normalizedcoords[j] == axis->peakCoord )
-            axisScalar = FT_FIXED_ONE;
-          else if ( face->blend->normalizedcoords[j] < axis->peakCoord )
-            axisScalar =
-              FT_DivFix( face->blend->normalizedcoords[j] - axis->startCoord,
-                         axis->peakCoord - axis->startCoord );
-          else
-            axisScalar =
-              FT_DivFix( axis->endCoord - face->blend->normalizedcoords[j],
-                         axis->endCoord - axis->peakCoord );
+          scalar = 0;
+          break;
         }

-        /* take product of all the axis scalars */
-        scalar = FT_MulFix( scalar, axisScalar );
+        else if ( face->blend->normalizedcoords[j] == axis->peakCoord )
+          continue;

+        /* cumulative product of all the axis scalars */
+        else if ( face->blend->normalizedcoords[j] < axis->peakCoord )
+          scalar =
+            FT_MulDiv( scalar,
+                       face->blend->normalizedcoords[j] - axis->startCoord,
+                       axis->peakCoord - axis->startCoord );
+        else
+          scalar =
+            FT_MulDiv( scalar,
+                       axis->endCoord - face->blend->normalizedcoords[j],
+                       axis->endCoord - axis->peakCoord );
       } /* per-axis loop */

       /* get the scaled delta for this region */



--


--
behdad
http://behdad.org/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]