diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-09-25 05:06:05 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-09-25 05:06:05 +0000 |
commit | 337eaca0d4cd1b1257bfd995e50bd4caac7565e9 (patch) | |
tree | e0f4cd22b7e9d8317a46fd56976e36d263555361 /Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp | |
parent | 8d248076273d5ed9ce79f6418b25a2b931be586c (diff) |
xetexdir: sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@42142 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp')
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
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 |