texlive[42499] Build/source/libs/graphite2: graphite2 1.3.9

commits+kakuto at tug.org commits+kakuto at tug.org
Sun Nov 13 08:32:27 CET 2016


Revision: 42499
          http://tug.org/svn/texlive?view=revision&revision=42499
Author:   kakuto
Date:     2016-11-13 08:32:27 +0100 (Sun, 13 Nov 2016)
Log Message:
-----------
graphite2 1.3.9

Modified Paths:
--------------
    trunk/Build/source/libs/graphite2/ChangeLog
    trunk/Build/source/libs/graphite2/configure
    trunk/Build/source/libs/graphite2/graphite2-PATCHES/ChangeLog
    trunk/Build/source/libs/graphite2/graphite2-PATCHES/TL-Changes
    trunk/Build/source/libs/graphite2/graphite2-src/ChangeLog
    trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Face.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Intervals.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Segment.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Silf.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Collider.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Pass.h
    trunk/Build/source/libs/graphite2/version.ac

Modified: trunk/Build/source/libs/graphite2/ChangeLog
===================================================================
--- trunk/Build/source/libs/graphite2/ChangeLog	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/ChangeLog	2016-11-13 07:32:27 UTC (rev 42499)
@@ -1,3 +1,8 @@
+2016-11-13  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
+
+	Import graphite2-1.3.9.
+	* version.ac: Adjusted.
+
 2016-03-31  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	Import graphite2-1.3.8.

Modified: trunk/Build/source/libs/graphite2/configure
===================================================================
--- trunk/Build/source/libs/graphite2/configure	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/configure	2016-11-13 07:32:27 UTC (rev 42499)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for graphite2 (TeX Live) 1.3.8.
+# Generated by GNU Autoconf 2.69 for graphite2 (TeX Live) 1.3.9.
 #
 # Report bugs to <tex-k at tug.org>.
 #
@@ -579,8 +579,8 @@
 # Identity of this package.
 PACKAGE_NAME='graphite2 (TeX Live)'
 PACKAGE_TARNAME='graphite2--tex-live-'
-PACKAGE_VERSION='1.3.8'
-PACKAGE_STRING='graphite2 (TeX Live) 1.3.8'
+PACKAGE_VERSION='1.3.9'
+PACKAGE_STRING='graphite2 (TeX Live) 1.3.9'
 PACKAGE_BUGREPORT='tex-k at tug.org'
 PACKAGE_URL=''
 
@@ -1254,7 +1254,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures graphite2 (TeX Live) 1.3.8 to adapt to many kinds of systems.
+\`configure' configures graphite2 (TeX Live) 1.3.9 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1321,7 +1321,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of graphite2 (TeX Live) 1.3.8:";;
+     short | recursive ) echo "Configuration of graphite2 (TeX Live) 1.3.9:";;
    esac
   cat <<\_ACEOF
 
@@ -1419,7 +1419,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-graphite2 (TeX Live) configure 1.3.8
+graphite2 (TeX Live) configure 1.3.9
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1558,7 +1558,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by graphite2 (TeX Live) $as_me 1.3.8, which was
+It was created by graphite2 (TeX Live) $as_me 1.3.9, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3481,7 +3481,7 @@
 
 # Define the identity of the package.
  PACKAGE='graphite2--tex-live-'
- VERSION='1.3.8'
+ VERSION='1.3.9'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -5577,7 +5577,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by graphite2 (TeX Live) $as_me 1.3.8, which was
+This file was extended by graphite2 (TeX Live) $as_me 1.3.9, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5643,7 +5643,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-graphite2 (TeX Live) config.status 1.3.8
+graphite2 (TeX Live) config.status 1.3.9
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

Modified: trunk/Build/source/libs/graphite2/graphite2-PATCHES/ChangeLog
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-PATCHES/ChangeLog	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/graphite2-PATCHES/ChangeLog	2016-11-13 07:32:27 UTC (rev 42499)
@@ -1,3 +1,8 @@
+2016-11-13  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
+
+	Imported graphite2-1.3.9 source tree from:
+	  http://sourceforge.net/projects/silgraphite/files/graphite2/
+
 2016-03-31  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	Imported graphite2-1.3.8 source tree from:

Modified: trunk/Build/source/libs/graphite2/graphite2-PATCHES/TL-Changes
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-PATCHES/TL-Changes	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/graphite2-PATCHES/TL-Changes	2016-11-13 07:32:27 UTC (rev 42499)
@@ -1,4 +1,4 @@
-Changes applied to the graphite2-1.3.8/ tree as obtained from:
+Changes applied to the graphite2-1.3.9/ tree as obtained from:
 	http://sourceforge.net/projects/silgraphite/files/graphite2/
 
 Removed unused dirs:

Modified: trunk/Build/source/libs/graphite2/graphite2-src/ChangeLog
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/ChangeLog	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/graphite2-src/ChangeLog	2016-11-13 07:32:27 UTC (rev 42499)
@@ -1,3 +1,11 @@
+1.3.9
+    . Add Collision COLL_ISSPACE to allow for visible spaces in collision avoidance
+    . Add segment and pass direction information to tracing output
+    . Bug fix rule length testing in 32-bit
+    . Increase slanted margin distances for collision avoidance
+    . Change kerning algorithm to simple outline expansion. Seems to make no visible difference.
+    . Add trace2svg to test tools
+
 1.3.8
     . Various bug fixes arising from fuzzing
     . Fix regression that stopped piglatin from working

Modified: trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h	2016-11-13 07:32:27 UTC (rev 42499)
@@ -30,7 +30,7 @@
 
 #define GR2_VERSION_MAJOR   1
 #define GR2_VERSION_MINOR   3
-#define GR2_VERSION_BUGFIX  8
+#define GR2_VERSION_BUGFIX  9
 
 #ifdef __cplusplus
 extern "C"

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp	2016-11-13 07:32:27 UTC (rev 42499)
@@ -306,6 +306,7 @@
         float seq_above_wt = cslot->seqAboveWt();
         float seq_below_wt = cslot->seqBelowWt();
         float seq_valign_wt = cslot->seqValignWt();
+        float lmargin = _margin;
         // if isAfter, invert orderFlags for diagonal orders.
         if (isAfter)
         {
@@ -334,6 +335,7 @@
                     torg = _currOffset.x;
                     cmin = _limit.bl.x + torg;
                     cmax = _limit.tr.x - tbb.xi + tbb.xa + torg;
+                    lmargin = _margin;
                     break;
                 case 1 :	// y direction
                     vmin = max(max(bb.yi - tbb.ya + sy, tsb.di - sb.da + tx - sd), sb.si - tsb.sa - tx + ss);
@@ -345,6 +347,7 @@
                     torg = _currOffset.y;
                     cmin = _limit.bl.y + torg;
                     cmax = _limit.tr.y - tbb.yi + tbb.ya + torg;
+                    lmargin = _margin;
                     break;
                 case 2 :    // sum - moving along the positively-sloped vector, so the boundaries are the
                             // negatively-sloped boundaries.
@@ -357,6 +360,7 @@
                     torg = _currOffset.x + _currOffset.y;
                     cmin = _limit.bl.x + _limit.bl.y + torg;
                     cmax = _limit.tr.x + _limit.tr.y - tsb.si + tsb.sa + torg;
+                    lmargin = _margin / ISQRT2;
                     break;
                 case 3 :    // diff - moving along the negatively-sloped vector, so the boundaries are the
                             // positively-sloped boundaries.
@@ -369,6 +373,7 @@
                     torg = _currOffset.x - _currOffset.y;
                     cmin = _limit.bl.x - _limit.tr.y + torg;
                     cmax = _limit.tr.x - _limit.bl.y - tsb.di + tsb.da + torg;
+                    lmargin = _margin / ISQRT2;
                     break;
                 default :
                     continue;
@@ -470,7 +475,7 @@
                 }
             }
 
-            if (vmax < cmin - _margin || vmin > cmax + _margin || omax < otmin - _margin || omin > otmax + _margin)
+            if (vmax < cmin - lmargin || vmin > cmax + lmargin || omax < otmin - lmargin || omin > otmax + lmargin)
                 continue;
 
             // Process sub-boxes that are defined for this glyph.
@@ -509,7 +514,7 @@
                             omax = ssb.sa + ss;
                             break;
                     }
-                    if (vmax < cmin - _margin || vmin > cmax + _margin || omax < otmin - _margin || omin > otmax + _margin)
+                    if (vmax < cmin - lmargin || vmin > cmax + lmargin || omax < otmin - lmargin || omin > otmax + lmargin)
                         continue;
 
 #if !defined GRAPHITE2_NTRACING
@@ -517,11 +522,11 @@
                         dbgout->setenv(1, reinterpret_cast<void *>(j));
 #endif
                     if (omin > otmax)
-                        _ranges[i].weightedAxis(i, vmin - _margin, vmax + _margin, 0, 0, 0, 0, 0,
-                                                sqr(_margin - omin + otmax) * _marginWt, false);
+                        _ranges[i].weightedAxis(i, vmin - lmargin, vmax + lmargin, 0, 0, 0, 0, 0,
+                                                sqr(lmargin - omin + otmax) * _marginWt, false);
                     else if (omax < otmin)
-                        _ranges[i].weightedAxis(i, vmin - _margin, vmax + _margin, 0, 0, 0, 0, 0,
-                                                sqr(_margin - otmin + omax) * _marginWt, false);
+                        _ranges[i].weightedAxis(i, vmin - lmargin, vmax + lmargin, 0, 0, 0, 0, 0,
+                                                sqr(lmargin - otmin + omax) * _marginWt, false);
                     else
                         _ranges[i].exclude_with_margins(vmin, vmax, i);
                     anyhits = true;
@@ -537,11 +542,11 @@
 #endif
                 isCol = true;
                 if (omin > otmax)
-                    _ranges[i].weightedAxis(i, vmin - _margin, vmax + _margin, 0, 0, 0, 0, 0,
-                                            sqr(_margin - omin + otmax) * _marginWt, false);
+                    _ranges[i].weightedAxis(i, vmin - lmargin, vmax + lmargin, 0, 0, 0, 0, 0,
+                                            sqr(lmargin - omin + otmax) * _marginWt, false);
                 else if (omax < otmin)
-                    _ranges[i].weightedAxis(i, vmin - _margin, vmax + _margin, 0, 0, 0, 0, 0,
-                                            sqr(_margin - otmin + omax) * _marginWt, false);
+                    _ranges[i].weightedAxis(i, vmin - lmargin, vmax + lmargin, 0, 0, 0, 0, 0,
+                                            sqr(lmargin - otmin + omax) * _marginWt, false);
                 else
                     _ranges[i].exclude_with_margins(vmin, vmax, i);
 
@@ -752,7 +757,7 @@
 }
 
 // Return the given edge of the glyph at height y, taking any slant box into account.
-static float get_edge(Segment *seg, const Slot *s, const Position &shift, float y, float width, bool isRight)
+static float get_edge(Segment *seg, const Slot *s, const Position &shift, float y, float width, float margin, bool isRight)
 {
     const GlyphCache &gc = seg->getFace()->glyphs();
     unsigned short gid = s->gid();
@@ -767,15 +772,15 @@
         {
             const BBox &sbb = gc.getSubBoundingBBox(gid, i);
             const SlantBox &ssb = gc.getSubBoundingSlantBox(gid, i);
-            if (sy + sbb.yi > y + width / 2 || sy + sbb.ya < y - width / 2)
+            if (sy + sbb.yi - margin > y + width / 2 || sy + sbb.ya + margin < y - width / 2)
                 continue;
             if (isRight)
             {
-                float x = sx + sbb.xa;
+                float x = sx + sbb.xa + margin;
                 if (x > res)
                 {
-                    float td = sx - sy + ssb.da + y;
-                    float ts = sx + sy + ssb.sa - y;
+                    float td = sx - sy + ssb.da + margin + y;
+                    float ts = sx + sy + ssb.sa + margin - y;
                     x = localmax(td - width / 2, td + width / 2,  ts - width / 2, ts + width / 2, x);
                     if (x > res)
                         res = x;
@@ -783,11 +788,11 @@
             }
             else
             {
-                float x = sx + sbb.xi;
+                float x = sx + sbb.xi - margin;
                 if (x < res)
                 {
-                    float td = sx - sy + ssb.di + y;
-                    float ts = sx + sy + ssb.si - y;
+                    float td = sx - sy + ssb.di - margin + y;
+                    float ts = sx + sy + ssb.si - margin - y;
                     x = localmin(td - width / 2, td + width / 2, ts - width / 2, ts + width / 2, x);
                     if (x < res)
                         res = x;
@@ -802,9 +807,9 @@
         float td = sx - sy + y;
         float ts = sx + sy - y;
         if (isRight)
-            res = localmax(td + sb.da - width / 2, td + sb.da + width / 2, ts + sb.sa - width / 2, ts + sb.sa + width / 2, sx + bb.xa);
+            res = localmax(td + sb.da - width / 2, td + sb.da + width / 2, ts + sb.sa - width / 2, ts + sb.sa + width / 2, sx + bb.xa) + margin;
         else
-            res = localmin(td + sb.di - width / 2, td + sb.di + width / 2, ts + sb.si - width / 2, ts + sb.si + width / 2, sx + bb.xi);
+            res = localmin(td + sb.di - width / 2, td + sb.di + width / 2, ts + sb.si - width / 2, ts + sb.si + width / 2, sx + bb.xi) - margin;
     }
     return res;
 }
@@ -865,6 +870,7 @@
                     _edges.pop_back();
             }
         }
+        goto done;
     }
     numSlices = _edges.size();
 
@@ -896,7 +902,7 @@
             float y = _miny - 1 + (i + .5f) * _sliceWidth; // vertical center of slice
             if ((dir & 1) && x < _edges[i])
             {
-                t = get_edge(seg, s, c->shift(), y, _sliceWidth, false);
+                t = get_edge(seg, s, c->shift(), y, _sliceWidth, margin, false);
                 if (t < _edges[i])
                 {
                     _edges[i] = t;
@@ -906,7 +912,7 @@
             }
             else if (!(dir & 1) && x > _edges[i])
             {
-                t = get_edge(seg, s, c->shift(), y, _sliceWidth, true);
+                t = get_edge(seg, s, c->shift(), y, _sliceWidth, margin, true);
                 if (t > _edges[i])
                 {
                     _edges[i] = t;
@@ -916,6 +922,7 @@
             }
         }
     }
+    done:
     _mingap = (float)1e38;
     _target = aSlot;
     _margin = margin;
@@ -946,22 +953,17 @@
     if (smin > smax)
         return false;
     bool collides = false;
-    float below = smin > 0 ? _edges[smin-1] * rtl : 1e38f;
-    float here = _edges[smin] * rtl;
-    float above = smin < (int)_edges.size() - 1 ? _edges[smin+1] * rtl : 1e38f;
 
     for (int i = smin; i <= smax; ++i)
     {
         float t;
+        float here = _edges[i] * rtl;
         float y = (float)(_miny - 1 + (i + .5f) * _sliceWidth);  // vertical center of slice
-        if (    (x > here - _mingap - currSpace)
-             || (x > below - _mingap - currSpace)
-             || (x > above - _mingap - currSpace))
+        if (    (x > here - _mingap - currSpace) )
         {
             // 2 * currSpace to account for the space that is already separating them and the space we want to add
-            float m = get_edge(seg, slot, currShift, y, _sliceWidth, rtl > 0) * rtl + 2 * currSpace;
-            // Check slices above and below (if any).
-            t = min(min(here, below), above) - m;
+            float m = get_edge(seg, slot, currShift, y, _sliceWidth, 0., rtl > 0) * rtl + 2 * currSpace;
+            t = here - m;
             // _mingap is positive to shrink
             if (t < _mingap)
             {
@@ -977,8 +979,6 @@
             }
 #endif
         }
-        below = here; here = above;
-        above = i < (int)_edges.size() - 2 ? _edges[i+2] * rtl : 1e38f;
     }
     return collides;   // note that true is not a necessarily reliable value
     
@@ -987,9 +987,10 @@
 
 // Return the amount to kern by.
 Position KernCollider::resolve(GR_MAYBE_UNUSED Segment *seg, GR_MAYBE_UNUSED Slot *slot,
-        int dir, float margin, GR_MAYBE_UNUSED json * const dbgout)
+        int dir, GR_MAYBE_UNUSED json * const dbgout)
 {
-    float resultNeeded = (1 - 2 * (dir & 1)) * (_mingap - margin);
+    float resultNeeded = (1 - 2 * (dir & 1)) * _mingap;
+    // float resultNeeded = (1 - 2 * (dir & 1)) * (_mingap - margin);
     float result = min(_limit.tr.x - _offsetPrev.x, max(resultNeeded, _limit.bl.x - _offsetPrev.x));
 
 #if !defined GRAPHITE2_NTRACING
@@ -998,7 +999,6 @@
         *dbgout << json::object // slot
                 << "slot" << objectid(dslot(seg, _target))
 				<< "gid" << _target->gid()
-                << "margin" << _margin
                 << "limit" << _limit
                 << "miny" << _miny
                 << "maxy" << _maxy
@@ -1093,3 +1093,7 @@
     	return 0;
 }
 
+bool SlotCollision::ignore() const
+{
+	return ((flags() & SlotCollision::COLL_IGNORE) || (flags() & SlotCollision::COLL_ISSPACE));
+}

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Face.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Face.cpp	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Face.cpp	2016-11-13 07:32:27 UTC (rev 42499)
@@ -190,9 +190,10 @@
 #if !defined GRAPHITE2_NTRACING
     if (dbgout)
 {
-        seg->positionSlots(0, 0, 0, aSilf->dir());
+        seg->positionSlots(0, 0, 0, seg->currdir());
         *dbgout             << json::item
                             << json::close // Close up the passes array
+                << "outputdir" << (seg->currdir() ? "rtl" : "ltr")
                 << "output" << json::array;
         for(Slot * s = seg->first(); s; s = s->next())
             *dbgout     << dslot(seg, s);
@@ -331,10 +332,12 @@
         uncompressed_size  = hdr & 0x07ffffff;
         uncompressed_table = gralloc<byte>(uncompressed_size);
         if (!e.test(!uncompressed_table || uncompressed_size < 4, E_OUTOFMEM))
+        {
             memset(uncompressed_table, 0, 4);   // make sure version number is initialised
             // coverity[forward_null : FALSE] - uncompressed_table has been checked so can't be null
             // coverity[checked_return : FALSE] - we test e later
             e.test(lz4::decompress(p, _sz - 2*sizeof(uint32), uncompressed_table, uncompressed_size) != signed(uncompressed_size), E_SHRINKERFAILED);
+        }
         break;
     }
 

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Intervals.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Intervals.cpp	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Intervals.cpp	2016-11-13 07:32:27 UTC (rev 42499)
@@ -59,7 +59,9 @@
 inline
 uint8 Zones::Exclusion::outcode(float val) const {
     float p = val;
-    return ((p >= xm) << 1) | (p < x);
+    //float d = std::numeric_limits<float>::epsilon();
+    float d = 0.;
+    return ((p - xm >= d) << 1) | (x - p > d);
 }
 
 void Zones::exclude_with_margins(float xmin, float xmax, int axis) {
@@ -74,6 +76,9 @@
 inline
 bool separated(float a, float b) {
     return a != b;
+    //int exp;
+    //float res = frexpf(fabs(a - b), &exp);
+    //return (*(unsigned int *)(&res) > 4);
     //return std::fabs(a-b) > std::numeric_limits<float>::epsilon(); // std::epsilon may not work. but 0.5 fails exising 64 bit tests
     //return std::fabs(a-b) > 0.5f;
 }

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp	2016-11-13 07:32:27 UTC (rev 42499)
@@ -523,7 +523,7 @@
                 if (r != re)
                 {
                     const int adv = doAction(r->rule->action, slot, m);
-                    dumpRuleEventOutput(fsm, m, *r->rule, slot);
+                    dumpRuleEventOutput(fsm, *r->rule, slot);
                     if (r->rule->action->deletes()) fsm.slots.collectGarbage(slot);
                     adjustSlot(adv, slot, fsm.slots);
                     *fsm.dbgout << "cursor" << objectid(dslot(&fsm.slots.segment, slot))
@@ -579,7 +579,7 @@
 }
 
 
-void Pass::dumpRuleEventOutput(const FiniteStateMachine & fsm, Machine & m, const Rule & r, Slot * const last_slot) const
+void Pass::dumpRuleEventOutput(const FiniteStateMachine & fsm, const Rule & r, Slot * const last_slot) const
 {
     *fsm.dbgout     << json::item << json::flat << json::object
                         << "id"     << &r - m_rules
@@ -597,7 +597,7 @@
                     << json::close // close "input"
                     << "slots"  << json::array;
     const Position rsb_prepos = last_slot ? last_slot->origin() : fsm.slots.segment.advance();
-    fsm.slots.segment.positionSlots(0, 0, 0, m.slotMap().dir());
+    fsm.slots.segment.positionSlots(0, 0, 0, fsm.slots.segment.currdir());
 
     for(Slot * slot = output_slot(fsm.slots, 0); slot != last_slot; slot = slot->next())
         *fsm.dbgout     << dslot(&fsm.slots.segment, slot);
@@ -635,7 +635,7 @@
 bool Pass::testConstraint(const Rule & r, Machine & m) const
 {
     const uint16 curr_context = m.slotMap().context();
-    if (unsigned(r.sort - r.preContext) > m.slotMap().size() - curr_context
+    if (unsigned(r.sort + curr_context - r.preContext) > m.slotMap().size()
         || curr_context - r.preContext < 0) return false;
 
     vm::slotref * map = m.slotMap().begin() + curr_context - r.preContext;
@@ -879,8 +879,11 @@
         const SlotCollision * c = seg->collisionInfo(s);
         const Rect &bbox = seg->theGlyphBBoxTemporary(s->gid());
         float y = s->origin().y + c->shift().y;
-        ymax = max(y + bbox.tr.y, ymax);
-        ymin = min(y + bbox.bl.y, ymin);
+        if (!(c->flags() & SlotCollision::COLL_ISSPACE))
+        {
+            ymax = max(y + bbox.tr.y, ymax);
+            ymin = min(y + bbox.bl.y, ymin);
+        }
         if (start && (c->flags() & (SlotCollision::COLL_KERN | SlotCollision::COLL_FIX))
                         == (SlotCollision::COLL_KERN | SlotCollision::COLL_FIX))
             resolveKern(seg, s, start, dir, ymin, ymax, dbgout);
@@ -962,8 +965,8 @@
     {
         SlotCollision *cNbor = seg->collisionInfo(nbor);
         bool sameCluster = nbor->isChildOf(base);
-        if (nbor != slotFix         // don't process if this is the slot of interest
-                      && !(cNbor->flags() & SlotCollision::COLL_IGNORE)    // don't process if ignoring
+        if (nbor != slotFix         						// don't process if this is the slot of interest
+                      && !(cNbor->ignore())    				// don't process if ignoring
                       && (nbor == base || sameCluster       // process if in the same cluster as slotFix
                             || !inKernCluster(seg, nbor)    // or this cluster is not to be kerned
                             || (rtl ^ ignoreForKern))       // or it comes before(ltr) or after(rtl)
@@ -1052,7 +1055,7 @@
             return 0.;
         const Rect &bb = seg->theGlyphBBoxTemporary(nbor->gid());
         SlotCollision *cNbor = seg->collisionInfo(nbor);
-        if (bb.bl.y == 0.f && bb.tr.y == 0.f)
+        if ((bb.bl.y == 0.f && bb.tr.y == 0.f) || (cNbor->flags() & SlotCollision::COLL_ISSPACE))
         {
             if (m_kernColls == InWord)
                 break;
@@ -1066,7 +1069,7 @@
             float y = nbor->origin().y + cNbor->shift().y;
             ymax = max(y + bb.tr.y, ymax);
             ymin = min(y + bb.bl.y, ymin);
-            if (nbor != slotFix && !(cNbor->flags() & SlotCollision::COLL_IGNORE))
+            if (nbor != slotFix && !cNbor->ignore())
             {
                 seenEnd = true;
                 if (!isInit)
@@ -1089,7 +1092,7 @@
     }
     if (collides)
     {
-        Position mv = coll.resolve(seg, slotFix, dir, cFix->margin(), dbgout);
+        Position mv = coll.resolve(seg, slotFix, dir, dbgout);
         coll.shift(mv, dir);
         Position delta = slotFix->advancePos() + mv - cFix->shift();
         slotFix->advance(delta);

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Segment.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Segment.cpp	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Segment.cpp	2016-11-13 07:32:27 UTC (rev 42499)
@@ -412,8 +412,9 @@
     Position currpos(0., 0.);
     float clusterMin = 0.;
     Rect bbox;
+    bool reorder = (currdir() != isRtl);
 
-    if (currdir() != isRtl)
+    if (reorder)
     {
         Slot *temp;
         reverseSlots();
@@ -443,6 +444,8 @@
                 currpos = s->finalise(this, font, currpos, bbox, 0, clusterMin = currpos.x, isRtl, isFinal);
         }
     }
+    if (reorder)
+        reverseSlots();
     return currpos;
 }
 

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Silf.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Silf.cpp	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Silf.cpp	2016-11-13 07:32:27 UTC (rev 42499)
@@ -384,9 +384,12 @@
             if (dbgout)
             {
                 *dbgout << json::item << json::object
+//							<< "pindex" << i   // for debugging
                             << "id"     << -1
+                            << "slotsdir" << (seg->currdir() ? "rtl" : "ltr")
+                            << "passdir" << (m_dir & 1 ? "rtl" : "ltr")
                             << "slots"  << json::array;
-                seg->positionSlots(0, 0, 0, m_dir);
+                seg->positionSlots(0, 0, 0, seg->currdir());
                 for(Slot * s = seg->first(); s; s = s->next())
                     *dbgout     << dslot(seg, s);
                 *dbgout         << json::close
@@ -408,9 +411,12 @@
         if (dbgout)
         {
             *dbgout << json::item << json::object
+//						<< "pindex" << i   // for debugging
                         << "id"     << i+1
+                        << "slotsdir" << (seg->currdir() ? "rtl" : "ltr")
+                        << "passdir" << ((m_dir & 1) ^ m_passes[i].reverseDir() ? "rtl" : "ltr")
                         << "slots"  << json::array;
-            seg->positionSlots(0, 0, 0, m_dir);
+            seg->positionSlots(0, 0, 0, seg->currdir());
             for(Slot * s = seg->first(); s; s = s->next())
                 *dbgout     << dslot(seg, s);
             *dbgout         << json::close;

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Collider.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Collider.h	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Collider.h	2016-11-13 07:32:27 UTC (rev 42499)
@@ -54,7 +54,8 @@
         COLL_KERN = 16,     // collisions with this glyph are fixed by adding kerning space after it
         COLL_ISCOL = 32,    // this glyph has a collision
         COLL_KNOWN = 64,    // we've figured out what's happening with this glyph
-        COLL_TEMPLOCK = 128,    // Lock glyphs that have been given priority positioning
+        COLL_ISSPACE = 128,		// treat this glyph as a space with regard to kerning
+        COLL_TEMPLOCK = 256,    // Lock glyphs that have been given priority positioning
         ////COLL_JUMPABLE = 128,    // moving glyphs may jump this stationary glyph in any direction - DELETE
         ////COLL_OVERLAP = 256,    // use maxoverlap to restrict - DELETE
     };
@@ -93,6 +94,7 @@
     SLOTCOLSETUINTPROP(seqValignWt, setSeqValignWt)
 
     float getKern(int dir) const;
+    bool ignore() const;
     
 private:
     Rect        _limit;
@@ -191,7 +193,7 @@
             const Position &currShift, const Position &offsetPrev, int dir,
             float ymin, float ymax, json * const dbgout);
     bool mergeSlot(Segment *seg, Slot *slot, const Position &currShift, float currSpace, int dir, json * const dbgout);
-    Position resolve(Segment *seg, Slot *slot, int dir, float margin, json * const dbgout);
+    Position resolve(Segment *seg, Slot *slot, int dir, json * const dbgout);
     void shift(const Position &mv, int dir);
 
     CLASS_NEW_DELETE;

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Pass.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Pass.h	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Pass.h	2016-11-13 07:32:27 UTC (rev 42499)
@@ -74,7 +74,7 @@
     uint16  glyphToCol(const uint16 gid) const;
     bool    runFSM(FiniteStateMachine & fsm, Slot * slot) const;
     void    dumpRuleEventConsidered(const FiniteStateMachine & fsm, const RuleEntry & re) const;
-    void    dumpRuleEventOutput(const FiniteStateMachine & fsm, vm::Machine & m, const Rule & r, Slot * os) const;
+    void    dumpRuleEventOutput(const FiniteStateMachine & fsm, const Rule & r, Slot * os) const;
     void    adjustSlot(int delta, Slot * & slot_out, SlotMap &) const;
     bool    collisionShift(Segment *seg, int dir, json * const dbgout) const;
     bool    collisionKern(Segment *seg, int dir, json * const dbgout) const;

Modified: trunk/Build/source/libs/graphite2/version.ac
===================================================================
--- trunk/Build/source/libs/graphite2/version.ac	2016-11-13 02:18:48 UTC (rev 42498)
+++ trunk/Build/source/libs/graphite2/version.ac	2016-11-13 07:32:27 UTC (rev 42499)
@@ -8,4 +8,4 @@
 dnl --------------------------------------------------------
 dnl
 dnl  m4-include this file to define the current graphite2 version
-m4_define([graphite2_version], [1.3.8])
+m4_define([graphite2_version], [1.3.9])



More information about the tex-live-commits mailing list