diff --git a/c/spot/source/GPOS.c b/c/spot/source/GPOS.c index 7b83350d..947c719d 100644 --- a/c/spot/source/GPOS.c +++ b/c/spot/source/GPOS.c @@ -1894,31 +1894,89 @@ static void proofPosPair2(PosPairFormat2 *fmt, IntX glyphtoproof1, IntX glyphtop } /* skip proofing glyph if all pos values are 0. */ if (label[0] != '\0') { - if (isVert) - proofCheckAdvance(proofctx, abs(vwidth) + abs(vwidth2)); - else - proofCheckAdvance(proofctx, width + width2); - proofClearOptions(&options); - if (isVert) - options.newvwidth = vwidth + yadv; - else - options.newwidth = width + xadv; - proofDrawGlyph(proofctx, - g1, ANNOT_SHOWIT, /* glyphId,glyphflags */ - nam1, ANNOT_SHOWIT | (isVert ? ANNOT_ATRIGHT : ANNOT_ATBOTTOM), /* glyphname,glyphnameflags */ - NULL, 0, /* altlabel,altlabelflags */ - 0, 0, /* originDx,originDy */ - 0, 0, /* origin,originflags */ - (isVert) ? vwidth : width, 0, /* width,widthflags */ - &options, (isVert) ? yorig : DEFAULT_YORIG_KANJI, (VORGfound != 0) ? "*" : ""); - proofDrawGlyph(proofctx, - g2, ANNOT_SHOWIT, /* glyphId,glyphflags */ - nam2, ANNOT_SHOWIT | (isVert ? ANNOT_ATRIGHTDOWN1 : ANNOT_ATBOTTOMDOWN1), /* glyphname,glyphnameflags */ - label, ANNOT_SHOWIT | ANNOT_BOLD | (isVert ? ANNOT_ATRIGHTDOWN2 : ANNOT_ATBOTTOMDOWN2), /* altlabel,altlabelflags */ - xpla, ((isVert) ? (-1) : (1)) * ypla, /* originDx,originDy */ - 0, 0, /* origin,originflags */ - (isVert) ? vwidth2 : width2, 0, /* width,widthflags */ - NULL, (isVert) ? yorig2 : DEFAULT_YORIG_KANJI, ""); + if (((featuretag == STR2TAG("kern")) || + (featuretag == STR2TAG("vkrn"))) && + proofIsAltKanjiKern()) { + ValueRecord leftvr, rightvr; + Card16 lvfmt, rvfmt; + IntX doLeft, doRight; + IntX awidth = width; + IntX awidth2 = width2; + + clearValueRecord(&leftvr); + clearValueRecord(&rightvr); + doLeft = GPOSlookupFeatureGlyph((featuretag == STR2TAG("vkrn")) ? (STR2TAG("vpal")) : (STR2TAG("palt")), + g1, &lvfmt, &leftvr); + doRight = GPOSlookupFeatureGlyph((featuretag == STR2TAG("vkrn")) ? (STR2TAG("vpal")) : (STR2TAG("palt")), + g2, &rvfmt, &rightvr); + if (doLeft) { + awidth += leftvr.XAdvance; + vwidth = -(abs(vwidth) + leftvr.YAdvance); + } + + if (doRight) { + awidth2 += rightvr.XAdvance; + vwidth2 = -(abs(vwidth2) + rightvr.YAdvance); + } + + if (isVert) + proofCheckAdvance(proofctx, abs(vwidth) + abs(vwidth2)); + else + proofCheckAdvance(proofctx, awidth + awidth2); + proofClearOptions(&options); + if (isVert) { + if (yadv) + options.newvwidth = -(abs(vwidth) + yadv); + else + options.newvwidth = -(abs(vwidth) + xadv); + } else { + options.newwidth = awidth + xadv; + } + proofDrawGlyph(proofctx, + g1, ANNOT_SHOWIT, /* glyphId,glyphflags */ + nam1, ANNOT_SHOWIT | (isVert ? ANNOT_ATRIGHT : ANNOT_ATBOTTOM), /* glyphname,glyphnameflags */ + NULL, 0, /* altlabel,altlabelflags */ + (doLeft) ? (leftvr.XPlacement) : 0, ((isVert) ? (-1) : (1)) * ((doLeft) ? (leftvr.YPlacement) : 0), /* originDx,originDy */ + 0, 0, /* origin,originflags */ + (isVert) ? vwidth : awidth, 0, /* width,widthflags */ + &options, (isVert) ? yorig : DEFAULT_YORIG_KANJI, (VORGfound != 0) ? "*" : ""); + + proofDrawGlyph(proofctx, + g2, ANNOT_SHOWIT, /* glyphId,glyphflags */ + nam2, ANNOT_SHOWIT | (isVert ? ANNOT_ATRIGHTDOWN1 : ANNOT_ATBOTTOMDOWN1), /* glyphname,glyphnameflags */ + label, ANNOT_SHOWIT | ANNOT_EMPHASIS | (isVert ? ANNOT_ATRIGHTDOWN2 : ANNOT_ATBOTTOMDOWN2), /* altlabel,altlabelflags */ + (doRight) ? (rightvr.XPlacement + xpla) : xpla, ((isVert) ? (-1) : (1)) * ((doRight) ? (rightvr.YPlacement + ypla) : ypla), /* originDx,originDy */ + 0, 0, /* origin,originflags */ + (isVert) ? vwidth2 : awidth2, 0, /* width,widthflags */ + NULL, (isVert) ? yorig2 : DEFAULT_YORIG_KANJI, ""); + } else /* don't use alt metrics */ + { + if (isVert) + proofCheckAdvance(proofctx, abs(vwidth) + abs(vwidth2)); + else + proofCheckAdvance(proofctx, width + width2); + proofClearOptions(&options); + if (isVert) + options.newvwidth = vwidth + yadv; + else + options.newwidth = width + xadv; + proofDrawGlyph(proofctx, + g1, ANNOT_SHOWIT, /* glyphId,glyphflags */ + nam1, ANNOT_SHOWIT | (isVert ? ANNOT_ATRIGHT : ANNOT_ATBOTTOM), /* glyphname,glyphnameflags */ + NULL, 0, /* altlabel,altlabelflags */ + 0, 0, /* originDx,originDy */ + 0, 0, /* origin,originflags */ + (isVert) ? vwidth : width, 0, /* width,widthflags */ + &options, (isVert) ? yorig : DEFAULT_YORIG_KANJI, (VORGfound != 0) ? "*" : ""); + proofDrawGlyph(proofctx, + g2, ANNOT_SHOWIT, /* glyphId,glyphflags */ + nam2, ANNOT_SHOWIT | (isVert ? ANNOT_ATRIGHTDOWN1 : ANNOT_ATBOTTOMDOWN1), /* glyphname,glyphnameflags */ + label, ANNOT_SHOWIT | ANNOT_BOLD | (isVert ? ANNOT_ATRIGHTDOWN2 : ANNOT_ATBOTTOMDOWN2), /* altlabel,altlabelflags */ + xpla, ((isVert) ? (-1) : (1)) * ypla, /* originDx,originDy */ + 0, 0, /* origin,originflags */ + (isVert) ? vwidth2 : width2, 0, /* width,widthflags */ + NULL, (isVert) ? yorig2 : DEFAULT_YORIG_KANJI, ""); + } proofThinspace(proofctx, 2); } /* end if kern pair has a non-zero value. */ } /* end if sorting kern pairs for output - else */