本文整理汇总了C++中XeTeXFontInst::getMathTable方法的典型用法代码示例。如果您正苦于以下问题:C++ XeTeXFontInst::getMathTable方法的具体用法?C++ XeTeXFontInst::getMathTable怎么用?C++ XeTeXFontInst::getMathTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XeTeXFontInst
的用法示例。
在下文中一共展示了XeTeXFontInst::getMathTable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SWAP
int
get_ot_math_ital_corr(int f, int g)
{
int rval = 0;
if (fontarea[f] == OTGR_FONT_FLAG) {
XeTeXFontInst* font = (XeTeXFontInst*)getFont((XeTeXLayoutEngine)fontlayoutengine[f]);
const char* table = font->getMathTable();
if (table == NULL)
return rval;
uint16_t offset = SWAP(((const MathTableHeader*)table)->mathGlyphInfo);
if (offset == 0)
return rval;
const MathGlyphInfo* glyphInfo = (const MathGlyphInfo*)(table + offset);
offset = SWAP(glyphInfo->mathItalicsCorrectionInfo);
if (offset == 0)
return rval;
const MathItalicsCorrectionInfo* italCorrInfo = (const MathItalicsCorrectionInfo*)(((const char*)glyphInfo) + offset);
offset = SWAP(italCorrInfo->coverage);
if (offset == 0)
return rval;
const Coverage* coverage = (const Coverage*)(((const char*)italCorrInfo) + offset);
int32_t index = getCoverage(coverage, g);
if (index >= 0 && index < SWAP(italCorrInfo->italicsCorrectionCount))
rval = D2Fix(font->unitsToPoints(SWAP(italCorrInfo->italicsCorrection[index].value)));
}
return rval;
}
示例2: if
static int
getMathKernAt(int f, int g, MathKernSide side, int height)
{
int rval = 0;
if (fontarea[f] == OTGR_FONT_FLAG) {
XeTeXFontInst* font = (XeTeXFontInst*)getFont((XeTeXLayoutEngine)fontlayoutengine[f]);
const char* table = font->getMathTable();
if (table == NULL)
return rval;
uint16_t offset = SWAP(((const MathTableHeader*)table)->mathGlyphInfo);
if (offset == 0)
return rval;
const MathGlyphInfo* glyphInfo = (const MathGlyphInfo*)(table + offset);
offset = SWAP(glyphInfo->mathKernInfo);
if (offset == 0)
return rval;
const MathKernInfo* mathKernInfo = (const MathKernInfo*)(((const char*)glyphInfo) + offset);
offset = SWAP(mathKernInfo->coverage);
if (offset == 0)
return rval;
const Coverage* coverage = (const Coverage*)(((const char*)mathKernInfo) + offset);
int32_t index = getCoverage(coverage, g);
if (index >= 0 && index < SWAP(mathKernInfo->kernInfoCount)) {
if (side == topRight)
offset = SWAP(mathKernInfo->kernInfo[index].topRight);
else if (side == bottomRight)
offset = SWAP(mathKernInfo->kernInfo[index].bottomRight);
else if (side == topLeft)
offset = SWAP(mathKernInfo->kernInfo[index].topLeft);
else if (side == bottomLeft)
offset = SWAP(mathKernInfo->kernInfo[index].bottomLeft);
else
assert(0); // we should not reach here
if (offset == 0)
return rval;
const MathKernTable* kernTable = (const MathKernTable*)(((const char*)mathKernInfo) + offset);
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);
else {
for (int i = 0; i < count; i++) {
if (height > SWAP(kernTable->height[i].value)) {
rval = SWAP(kernTable->kern[i+1].value);
break;
}
}
}
//fprintf(stderr, " kern: %f %f\n", font->unitsToPoints(height), font->unitsToPoints(rval));
}
}
return rval;
}