当前位置: 首页>>代码示例>>C++>>正文


C++ XeTeXFontInst::unitsToPoints方法代码示例

本文整理汇总了C++中XeTeXFontInst::unitsToPoints方法的典型用法代码示例。如果您正苦于以下问题:C++ XeTeXFontInst::unitsToPoints方法的具体用法?C++ XeTeXFontInst::unitsToPoints怎么用?C++ XeTeXFontInst::unitsToPoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XeTeXFontInst的用法示例。


在下文中一共展示了XeTeXFontInst::unitsToPoints方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
开发者ID:texlive,项目名称:texlive-source,代码行数:34,代码来源:XeTeXOTMath.cpp

示例2:

int
ot_part_full_advance(int f, const GlyphAssembly* a, int i)
{
    int rval = 0;

    if (fontarea[f] == OTGR_FONT_FLAG) {
        XeTeXFontInst*  font = (XeTeXFontInst*)getFont((XeTeXLayoutEngine)fontlayoutengine[f]);
        rval = D2Fix(font->unitsToPoints(SWAP(a->partRecords[i].fullAdvance)));
    }

    return rval;
}
开发者ID:texlive,项目名称:texlive-source,代码行数:12,代码来源:XeTeXOTMath.cpp

示例3: getMathConstant

int
get_ot_math_constant(int f, int n)
{
    int rval = 0;

    if (fontarea[f] == OTGR_FONT_FLAG) {
        XeTeXFontInst*  font = (XeTeXFontInst*)getFont((XeTeXLayoutEngine)fontlayoutengine[f]);
        rval = getMathConstant(font, (mathConstantIndex)n);
        /* scale according to font size, except the ones that are percentages */
        if (n > scriptScriptPercentScaleDown && n < radicalDegreeBottomRaisePercent)
            rval = D2Fix(font->unitsToPoints(rval));
    }
    return rval;
}
开发者ID:texlive,项目名称:texlive-source,代码行数:14,代码来源:XeTeXOTMath.cpp

示例4: getMathKernAt

int
get_ot_math_kern(int f, int g, int sf, int sg, int cmd, int shift)
{
    int rval = 0;

    if (fontarea[f] == OTGR_FONT_FLAG) {
        XeTeXFontInst* font = (XeTeXFontInst*)getFont((XeTeXLayoutEngine)fontlayoutengine[f]);
        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);

            kern = getMathKernAt(f, g, topRight, corr_height_top);
            skern = getMathKernAt(sf, sg, bottomLeft, corr_height_top);
            rval = kern + skern;

            kern = getMathKernAt(f, g, topRight, corr_height_bot);
            skern = getMathKernAt(sf, sg, bottomLeft, corr_height_bot);
            if ((kern + skern) < rval)
                rval = kern + skern;

        } else if (cmd == sub_cmd) { // subscript
            corr_height_top =  font->pointsToUnits(glyph_height(sf, sg) - shift);
            corr_height_bot = -font->pointsToUnits(glyph_depth(f, g));

            kern = getMathKernAt(f, g, bottomRight, corr_height_top);
            skern = getMathKernAt(sf, sg, topLeft, corr_height_top);
            rval = kern + skern;

            kern = getMathKernAt(f, g, bottomRight, corr_height_bot);
            skern = getMathKernAt(sf, sg, topLeft, corr_height_bot);
            if ((kern + skern) < rval)
                rval = kern + skern;

        } else {
            assert(0); // we should not reach here
        }

        rval = D2Fix(font->unitsToPoints(rval));
    }

    return rval;
}
开发者ID:texlive,项目名称:texlive-source,代码行数:47,代码来源:XeTeXOTMath.cpp


注:本文中的XeTeXFontInst::unitsToPoints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。