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


C++ SkScalerContext::generateCharToGlyph方法代码示例

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


在下文中一共展示了SkScalerContext::generateCharToGlyph方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: charToGlyphID

uint16_t SkScalerContext::charToGlyphID(SkUnichar uni) {
    unsigned glyphID = this->generateCharToGlyph(uni);

    if (0 == glyphID) {   // try auxcontext
        SkScalerContext* ctx = this->loadAuxContext();
        if (NULL != ctx) {
            glyphID = ctx->generateCharToGlyph(uni);
            if (0 != glyphID) {   // only fiddle with it if its not missing
                glyphID += this->getGlyphCount();
                if (glyphID > 0xFFFF) {
                    glyphID = 0;
                }
            }
        }
    }
#ifdef TRACK_MISSING_CHARS
    if (0 == glyphID) {
        bool announce = false;
        if (uni > 0xFFFF) {   // we don't record these
            announce = true;
        } else {
            unsigned index = uni >> 3;
            unsigned mask = 1 << (uni & 7);
            SkASSERT(index < SK_ARRAY_COUNT(gMissingChars));
            if ((gMissingChars[index] & mask) == 0) {
                gMissingChars[index] |= mask;
                announce = true;
            }
        }
        if (announce) {
            printf(">>> MISSING CHAR <<< 0x%04X\n", uni);
        }
    }
开发者ID:Html5Lexloo,项目名称:o3d,代码行数:33,代码来源:SkScalerContext.cpp

示例2: getContextFromChar

SkScalerContext* SkScalerContext::getContextFromChar(SkUnichar uni, unsigned& glyphID) {
    SkScalerContext* ctx = this;
    for (;;) {
        glyphID = ctx->generateCharToGlyph(uni);
        if (glyphID) {
            break;  // found it
        }
        ctx = ctx->getNextContext();
        if (NULL == ctx) {
            return NULL;
        }
    }
    return ctx;
}
开发者ID:4Fwolf,项目名称:mt6572_x201,代码行数:14,代码来源:SkScalerContext.cpp

示例3: getBaseGlyphCount

/*  This loops through all available fallback contexts (if needed) until it
    finds some context that can handle the unichar and return it.

    As this is somewhat expensive operation, it should only be done on the first
    char of a run.
 */
unsigned SkScalerContext::getBaseGlyphCount(SkUnichar uni) {
    SkScalerContext* ctx = this;
    unsigned glyphID;
    for (;;) {
        glyphID = ctx->generateCharToGlyph(uni);
        if (glyphID) {
            break;  // found it
        }
        ctx = ctx->getNextContext();
        if (NULL == ctx) {
            SkDebugf("--- no context for char %x\n", uni);
            // just return the original context (this)
            return this->fBaseGlyphCount;
        }
    }
    return ctx->fBaseGlyphCount;
}
开发者ID:Cue,项目名称:skia,代码行数:23,代码来源:SkScalerContext.cpp

示例4: getContextFromChar

SkScalerContext* SkScalerContext::getContextFromChar(SkUnichar uni,
                                                     uint16_t* glyphID) {
    SkScalerContext* ctx = this;
    for (;;) {
        const uint16_t glyph = ctx->generateCharToGlyph(uni);
        if (glyph) {
            if (NULL != glyphID) {
                *glyphID = glyph;
            }
            break;  // found it
        }
        ctx = ctx->getNextContext();
        if (NULL == ctx) {
            return NULL;
        }
    }
    return ctx;
}
开发者ID:rzr,项目名称:Tizen_Crosswalk,代码行数:18,代码来源:SkScalerContext.cpp

示例5: charToGlyphID

/*  This loops through all available fallback contexts (if needed) until it
    finds some context that can handle the unichar. If all fail, returns 0
 */
uint16_t SkScalerContext::charToGlyphID(SkUnichar uni) {
    SkScalerContext* ctx = this;
    unsigned glyphID;
    for (;;) {
        glyphID = ctx->generateCharToGlyph(uni);
        if (glyphID) {
            break;  // found it
        }
        ctx = ctx->getNextContext();
        if (NULL == ctx) {
            return 0;   // no more contexts, return missing glyph
        }
    }
    // add the ctx's base, making glyphID unique for chain of contexts
    glyphID += ctx->fBaseGlyphCount;
    // check for overflow of 16bits, since our glyphID cannot exceed that
    if (glyphID > 0xFFFF) {
        glyphID = 0;
    }
    return SkToU16(glyphID);
}
开发者ID:BBKeeper,项目名称:Skia,代码行数:24,代码来源:SkScalerContext.cpp


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