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


C++ SimpleFontData::containsCharacters方法代码示例

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


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

示例1: getFontDataForCharacters

const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
{
    SimpleFontData* fontData = 0;
    fontData = getCachedFontData(font.fontDescription(), font.family().family());
    if (!fontData->containsCharacters(characters, length))
        fontData = getSimilarFontPlatformData(font);
    if (!fontData->containsCharacters(characters, length))
        fontData = getLastResortFallbackFont(font.fontDescription());
    
    ASSERT(fontData);
    return fontData;
}
开发者ID:mikedougherty,项目名称:webkit,代码行数:12,代码来源:FontCacheWx.cpp

示例2: getFontDataForCharacters

const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
{
#if defined(USE_FREETYPE)
    FcResult fresult;
    FontPlatformData* prim = const_cast<FontPlatformData*>(&font.primaryFont()->platformData());

    if (!prim->m_fallbacks)
        prim->m_fallbacks = FcFontSort(NULL, prim->m_pattern, FcTrue, NULL, &fresult);

    FcFontSet* fs = prim->m_fallbacks;

    for (int i = 0; i < fs->nfont; i++) {
        FcPattern* fin = FcFontRenderPrepare(NULL, prim->m_pattern, fs->fonts[i]);
        cairo_font_face_t* fontFace = cairo_ft_font_face_create_for_pattern(fin);
        FontPlatformData alternateFont(fontFace, font.fontDescription().computedPixelSize(), false, false);
        cairo_font_face_destroy(fontFace);
        alternateFont.m_pattern = fin;
        SimpleFontData* sfd = getCachedFontData(&alternateFont);
        if (sfd->containsCharacters(characters, length))
            return sfd;
    }
#endif

    return 0;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:25,代码来源:FontCacheGtk.cpp

示例3: getFontDataForCharacters

const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
{
    FcResult fresult;
    // Avoid copying FontPlatformData.
    FontPlatformData* prim = const_cast<FontPlatformData*>(&font.primaryFont()->m_font);

    if (!prim->m_fallbacks)
        prim->m_fallbacks = FcFontSort(NULL, prim->m_pattern, FcTrue, NULL, &fresult);

    FcFontSet* fs = prim->m_fallbacks;
    
    FT_Library library = FontPlatformData::m_library;

    FcChar8* fc_filename;
    char* filename;
    int id;
    FT_Face face;
    for (int i = 0; i < fs->nfont; i++) {
        FcPattern* fin = FcFontRenderPrepare(0, prim->m_pattern, fs->fonts[i]);

        if (FcPatternGetString(fin, FC_FILE, 0, &fc_filename) != FcResultMatch)
            continue;

        filename = (char *) fc_filename; // Use C cast as FcChar is a fontconfig type.

        if (FcPatternGetInteger(fin, FC_INDEX, 0, &id) != FcResultMatch)
            continue;

        if (FT_Error error = FT_New_Face(library, filename, id, &face))
            continue;

        // FIXME: is it really necessary ?
        FT_Set_Pixel_Sizes(face, 0, static_cast<uint> (font.fontDescription().computedSize()));

        FontPlatformData alternateFont(face, font.fontDescription().computedPixelSize(), false, false);
        // FIXME: FT_Done_Face(face); we should clean the face correctly the FT_Face but we can't do that here...
        alternateFont.m_pattern = fin;
        SimpleFontData* sfd = getCachedFontData(&alternateFont);
        if (sfd->containsCharacters(characters, length))
            return sfd;
    }
    return 0;
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:43,代码来源:BCFontCacheFreetype.cpp


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