diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-11-13 07:32:27 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-11-13 07:32:27 +0000 |
commit | 31c15130a103fbd3517f42309188fbcb65ea27f5 (patch) | |
tree | 381ed32bdc26a9209cba7ceb160fc29970cf3f97 /Build | |
parent | 1c7ded83a3eef46f44c46128e3dd85118846ca4b (diff) |
graphite2 1.3.9
git-svn-id: svn://tug.org/texlive/trunk@42499 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
15 files changed, 112 insertions, 68 deletions
diff --git a/Build/source/libs/graphite2/ChangeLog b/Build/source/libs/graphite2/ChangeLog index 5eeb7b27a45..9f2b805b389 100644 --- a/Build/source/libs/graphite2/ChangeLog +++ b/Build/source/libs/graphite2/ChangeLog @@ -1,3 +1,8 @@ +2016-11-13 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + Import graphite2-1.3.9. + * version.ac: Adjusted. + 2016-03-31 Akira Kakuto <kakuto@fuk.kindai.ac.jp> Import graphite2-1.3.8. diff --git a/Build/source/libs/graphite2/configure b/Build/source/libs/graphite2/configure index cae346d51c8..9ea7060c29c 100755 --- a/Build/source/libs/graphite2/configure +++ b/Build/source/libs/graphite2/configure @@ -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@tug.org>. # @@ -579,8 +579,8 @@ MAKEFLAGS= # 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@tug.org' PACKAGE_URL='' @@ -1254,7 +1254,7 @@ if test "$ac_init_help" = "long"; then # 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 @@ fi 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 @@ fi 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 @@ cat >config.log <<_ACEOF 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 @@ fi # 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 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # 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 @@ _ACEOF 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\\" diff --git a/Build/source/libs/graphite2/graphite2-PATCHES/ChangeLog b/Build/source/libs/graphite2/graphite2-PATCHES/ChangeLog index b6bfed95e91..6394156bb04 100644 --- a/Build/source/libs/graphite2/graphite2-PATCHES/ChangeLog +++ b/Build/source/libs/graphite2/graphite2-PATCHES/ChangeLog @@ -1,3 +1,8 @@ +2016-11-13 Akira Kakuto <kakuto@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@fuk.kindai.ac.jp> Imported graphite2-1.3.8 source tree from: diff --git a/Build/source/libs/graphite2/graphite2-PATCHES/TL-Changes b/Build/source/libs/graphite2/graphite2-PATCHES/TL-Changes index cd121bf6a43..d17789537ed 100644 --- a/Build/source/libs/graphite2/graphite2-PATCHES/TL-Changes +++ b/Build/source/libs/graphite2/graphite2-PATCHES/TL-Changes @@ -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: diff --git a/Build/source/libs/graphite2/graphite2-src/ChangeLog b/Build/source/libs/graphite2/graphite2-src/ChangeLog index d55a2ab2724..b46562047a0 100644 --- a/Build/source/libs/graphite2/graphite2-src/ChangeLog +++ b/Build/source/libs/graphite2/graphite2-src/ChangeLog @@ -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 diff --git a/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h b/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h index 1f2ca4eaff7..b0de8e82b7c 100644 --- a/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h +++ b/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h @@ -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" diff --git a/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp b/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp index 2df46ebc4de..ba59d9231be 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp @@ -306,6 +306,7 @@ bool ShiftCollider::mergeSlot(Segment *seg, Slot *slot, const Position &currShif 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 @@ bool ShiftCollider::mergeSlot(Segment *seg, Slot *slot, const Position &currShif 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 @@ bool ShiftCollider::mergeSlot(Segment *seg, Slot *slot, const Position &currShif 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 @@ bool ShiftCollider::mergeSlot(Segment *seg, Slot *slot, const Position &currShif 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 @@ bool ShiftCollider::mergeSlot(Segment *seg, Slot *slot, const Position &currShif 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 @@ bool ShiftCollider::mergeSlot(Segment *seg, Slot *slot, const Position &currShif } } - 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 @@ bool ShiftCollider::mergeSlot(Segment *seg, Slot *slot, const Position &currShif 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 @@ bool ShiftCollider::mergeSlot(Segment *seg, Slot *slot, const Position &currShif 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 @@ bool ShiftCollider::mergeSlot(Segment *seg, Slot *slot, const Position &currShif #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 @@ static float localmin(float al, float au, float bl, float bu, float x) } // 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 @@ static float get_edge(Segment *seg, const Slot *s, const Position &shift, float { 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 @@ static float get_edge(Segment *seg, const Slot *s, const Position &shift, float } 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 @@ static float get_edge(Segment *seg, const Slot *s, const Position &shift, float 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 @@ bool KernCollider::initSlot(Segment *seg, Slot *aSlot, const Rect &limit, float _edges.pop_back(); } } + goto done; } numSlices = _edges.size(); @@ -896,7 +902,7 @@ bool KernCollider::initSlot(Segment *seg, Slot *aSlot, const Rect &limit, float 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 @@ bool KernCollider::initSlot(Segment *seg, Slot *aSlot, const Rect &limit, float } 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 @@ bool KernCollider::initSlot(Segment *seg, Slot *aSlot, const Rect &limit, float } } } + done: _mingap = (float)1e38; _target = aSlot; _margin = margin; @@ -946,22 +953,17 @@ bool KernCollider::mergeSlot(Segment *seg, Slot *slot, const Position &currShift 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 @@ bool KernCollider::mergeSlot(Segment *seg, Slot *slot, const Position &currShift } #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 @@ bool KernCollider::mergeSlot(Segment *seg, Slot *slot, const Position &currShift // 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 @@ Position KernCollider::resolve(GR_MAYBE_UNUSED Segment *seg, GR_MAYBE_UNUSED Slo *dbgout << json::object // slot << "slot" << objectid(dslot(seg, _target)) << "gid" << _target->gid() - << "margin" << _margin << "limit" << _limit << "miny" << _miny << "maxy" << _maxy @@ -1093,3 +1093,7 @@ float SlotCollision::getKern(int dir) const return 0; } +bool SlotCollision::ignore() const +{ + return ((flags() & SlotCollision::COLL_IGNORE) || (flags() & SlotCollision::COLL_ISSPACE)); +} diff --git a/Build/source/libs/graphite2/graphite2-src/src/Face.cpp b/Build/source/libs/graphite2/graphite2-src/src/Face.cpp index 1ab7a60f490..81b5ced8c18 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/Face.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/Face.cpp @@ -190,9 +190,10 @@ bool Face::runGraphite(Segment *seg, const Silf *aSilf) const #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 @@ Error Face::Table::decompress() 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; } diff --git a/Build/source/libs/graphite2/graphite2-src/src/Intervals.cpp b/Build/source/libs/graphite2/graphite2-src/src/Intervals.cpp index 1e34e598715..9b1da5a1b99 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/Intervals.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/Intervals.cpp @@ -59,7 +59,9 @@ Zones::Exclusion & Zones::Exclusion::operator += (Exclusion const & rhs) { 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 @@ namespace 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; } diff --git a/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp b/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp index 7289406c092..69ad700c86a 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp @@ -523,7 +523,7 @@ void Pass::findNDoRule(Slot * & slot, Machine &m, FiniteStateMachine & fsm) cons 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::dumpRuleEventConsidered(const FiniteStateMachine & fsm, const RuleEnt } -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 @@ void Pass::dumpRuleEventOutput(const FiniteStateMachine & fsm, Machine & m, cons << 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::testPassConstraint(Machine & m) const 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 @@ bool Pass::collisionKern(Segment *seg, int dir, json * const dbgout) const 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 @@ bool Pass::resolveCollisions(Segment *seg, Slot *slotFix, Slot *start, { 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 @@ float Pass::resolveKern(Segment *seg, Slot *slotFix, GR_MAYBE_UNUSED Slot *start 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 Pass::resolveKern(Segment *seg, Slot *slotFix, GR_MAYBE_UNUSED Slot *start 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 @@ float Pass::resolveKern(Segment *seg, Slot *slotFix, GR_MAYBE_UNUSED Slot *start } 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); diff --git a/Build/source/libs/graphite2/graphite2-src/src/Segment.cpp b/Build/source/libs/graphite2/graphite2-src/src/Segment.cpp index 966f75784dd..3020bfd36d0 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/Segment.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/Segment.cpp @@ -412,8 +412,9 @@ Position Segment::positionSlots(const Font *font, Slot * iStart, Slot * iEnd, bo 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 @@ Position Segment::positionSlots(const Font *font, Slot * iStart, Slot * iEnd, bo currpos = s->finalise(this, font, currpos, bbox, 0, clusterMin = currpos.x, isRtl, isFinal); } } + if (reorder) + reverseSlots(); return currpos; } diff --git a/Build/source/libs/graphite2/graphite2-src/src/Silf.cpp b/Build/source/libs/graphite2/graphite2-src/src/Silf.cpp index 02876881e6f..72a22cd4686 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/Silf.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/Silf.cpp @@ -384,9 +384,12 @@ bool Silf::runGraphite(Segment *seg, uint8 firstPass, uint8 lastPass, int dobidi 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 @@ bool Silf::runGraphite(Segment *seg, uint8 firstPass, uint8 lastPass, int dobidi 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; diff --git a/Build/source/libs/graphite2/graphite2-src/src/inc/Collider.h b/Build/source/libs/graphite2/graphite2-src/src/inc/Collider.h index bcbf3a22490..84008128ab4 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/inc/Collider.h +++ b/Build/source/libs/graphite2/graphite2-src/src/inc/Collider.h @@ -54,7 +54,8 @@ public: 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 @@ public: SLOTCOLSETUINTPROP(seqValignWt, setSeqValignWt) float getKern(int dir) const; + bool ignore() const; private: Rect _limit; @@ -191,7 +193,7 @@ public: 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; diff --git a/Build/source/libs/graphite2/graphite2-src/src/inc/Pass.h b/Build/source/libs/graphite2/graphite2-src/src/inc/Pass.h index 82da2caf15e..074d501d95b 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/inc/Pass.h +++ b/Build/source/libs/graphite2/graphite2-src/src/inc/Pass.h @@ -74,7 +74,7 @@ private: 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; diff --git a/Build/source/libs/graphite2/version.ac b/Build/source/libs/graphite2/version.ac index 026ebf1be1f..5fee7ff758f 100644 --- a/Build/source/libs/graphite2/version.ac +++ b/Build/source/libs/graphite2/version.ac @@ -8,4 +8,4 @@ dnl 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]) |