summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/web2c/xetexdir/ChangeLog8
-rw-r--r--Build/source/texk/web2c/xetexdir/MathTable.h5
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp30
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 <kakuto@fuk.kinidai.ac.jp>
+
+ * MathTable.h, XeTeXOTMath.cpp: Sync with the upstream..
+
+2016-09-24 Akira Kakuto <kakuto@fuk.kinidai.ac.jp>
+
+ * xetex.web: Sync with the upstream..
+
2016-02-09 Akira Kakuto <kakuto@fuk.kinidai.ac.jp>
* 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