From 337eaca0d4cd1b1257bfd995e50bd4caac7565e9 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Sun, 25 Sep 2016 05:06:05 +0000 Subject: xetexdir: sync with the upstream git-svn-id: svn://tug.org/texlive/trunk@42142 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/xetexdir/ChangeLog | 8 +++++++ Build/source/texk/web2c/xetexdir/MathTable.h | 5 ++++ Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp | 30 ++++++++++-------------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Build/source/texk/web2c/xetexdir/ChangeLog b/Build/source/texk/web2c/xetexdir/ChangeLog index 5be5a6d5fed..9f661c4f6e2 100644 --- a/Build/source/texk/web2c/xetexdir/ChangeLog +++ b/Build/source/texk/web2c/xetexdir/ChangeLog @@ -1,3 +1,11 @@ +2016-09-25 Akira Kakuto + + * MathTable.h, XeTeXOTMath.cpp: Sync with the upstream.. + +2016-09-24 Akira Kakuto + + * xetex.web: Sync with the upstream.. + 2016-02-09 Akira Kakuto * XeTeX_ext.c: Revert the change on 2015-11-06. diff --git a/Build/source/texk/web2c/xetexdir/MathTable.h b/Build/source/texk/web2c/xetexdir/MathTable.h index e302ee17d15..589cc1a2658 100644 --- a/Build/source/texk/web2c/xetexdir/MathTable.h +++ b/Build/source/texk/web2c/xetexdir/MathTable.h @@ -251,7 +251,12 @@ typedef struct { typedef struct { uint16_t heightCount; MathValueRecord height[ANY_NUMBER]; +/* + * The offset of this will vary depending on the size of the height[] array, + * so we have to compute it at runtime, not refer to a fixed field offset. + * MathValueRecord kern[ANY_NUMBER]; + */ } MathKernTable; typedef struct { diff --git a/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp b/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp index 720c558063d..9892157336f 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp @@ -435,24 +435,20 @@ getMathKernAt(int f, int g, MathKernSide side, int height) uint16_t count = SWAP(kernTable->heightCount); - // XXX: the following makes no sense WRT my understanding of the - // spec! it is just how things worked for me. - if (count == 0) - rval = SWAP(kernTable->kern[-1].value); - else if (height < SWAP(kernTable->height[0].value)) - rval = SWAP(kernTable->kern[1].value); - else if (height > SWAP(kernTable->height[count].value)) - rval = SWAP(kernTable->kern[count+1].value); + // kern[] array immediately follows the height[] array with |count| elements + const MathValueRecord* kern = &kernTable->height[0] + count; + + if (count == 0 || height < SWAP(kernTable->height[0].value)) + rval = SWAP(kern[0].value); else { + rval = SWAP(kern[count].value); for (int i = 0; i < count; i++) { - if (height > SWAP(kernTable->height[i].value)) { - rval = SWAP(kernTable->kern[i+1].value); + if (height <= SWAP(kernTable->height[i].value)) { + rval = SWAP(kern[i].value); break; } } } - - //fprintf(stderr, " kern: %f %f\n", font->unitsToPoints(height), font->unitsToPoints(rval)); } } @@ -499,11 +495,9 @@ get_ot_math_kern(int f, int g, int sf, int sg, int cmd, int shift) int kern = 0, skern = 0; float corr_height_top = 0.0, corr_height_bot = 0.0; - shift = Fix2D(shift); - if (cmd == sup_cmd) { // superscript corr_height_top = font->pointsToUnits(glyph_height(f, g)); - corr_height_bot = -font->pointsToUnits(glyph_depth(sf, sg) + shift); + corr_height_bot = -font->pointsToUnits(glyph_depth(sf, sg) + Fix2D(shift)); kern = getMathKernAt(f, g, topRight, corr_height_top); skern = getMathKernAt(sf, sg, bottomLeft, corr_height_top); @@ -515,7 +509,7 @@ get_ot_math_kern(int f, int g, int sf, int sg, int cmd, int shift) rval = kern + skern; } else if (cmd == sub_cmd) { // subscript - corr_height_top = font->pointsToUnits(glyph_height(sf, sg) - shift); + corr_height_top = font->pointsToUnits(glyph_height(sf, sg) - Fix2D(shift)); corr_height_bot = -font->pointsToUnits(glyph_depth(f, g)); kern = getMathKernAt(f, g, bottomRight, corr_height_top); @@ -531,10 +525,10 @@ get_ot_math_kern(int f, int g, int sf, int sg, int cmd, int shift) assert(0); // we should not reach here } - rval = D2Fix(font->unitsToPoints(rval)); + return D2Fix(font->unitsToPoints(rval)); } - return rval; + return 0; } int -- cgit v1.2.3