本文整理汇总了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;
}
示例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;
}
示例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;
}