本文整理汇总了C++中FontPlatformData::hash方法的典型用法代码示例。如果您正苦于以下问题:C++ FontPlatformData::hash方法的具体用法?C++ FontPlatformData::hash怎么用?C++ FontPlatformData::hash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontPlatformData
的用法示例。
在下文中一共展示了FontPlatformData::hash方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFontDataForCharacters
const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
{
String familyName;
WCHAR name[LF_FACESIZE];
UChar character = characters[0];
const FontPlatformData& origFont = font.primaryFont()->fontDataForCharacter(character)->platformData();
unsigned unicodeRange = findCharUnicodeRange(character);
#if defined(IMLANG_FONT_LINK) && (IMLANG_FONT_LINK == 2)
if (IMLangFontLink2* langFontLink = getFontLinkInterface()) {
#else
if (IMLangFontLink* langFontLink = getFontLinkInterface()) {
#endif
HGDIOBJ oldFont = GetCurrentObject(g_screenDC, OBJ_FONT);
HFONT hfont = 0;
DWORD codePages = 0;
UINT codePage = 0;
// Try MLang font linking first.
langFontLink->GetCharCodePages(character, &codePages);
if (codePages && unicodeRange == cRangeSetCJK) {
// The CJK character may belong to multiple code pages. We want to
// do font linking against a single one of them, preferring the default
// code page for the user's locale.
const Vector<DWORD, 4>& CJKCodePageMasks = getCJKCodePageMasks();
unsigned numCodePages = CJKCodePageMasks.size();
for (unsigned i = 0; i < numCodePages; ++i) {
#if defined(IMLANG_FONT_LINK) && (IMLANG_FONT_LINK == 2)
hfont = createMLangFont(langFontLink, g_screenDC, CJKCodePageMasks[i]);
#else
hfont = createMLangFont(langFontLink, g_screenDC, origFont, CJKCodePageMasks[i]);
#endif
if (!hfont)
continue;
SelectObject(g_screenDC, hfont);
GetTextFace(g_screenDC, LF_FACESIZE, name);
if (hfont && !(codePages & CJKCodePageMasks[i])) {
// We asked about a code page that is not one of the code pages
// returned by MLang, so the font might not contain the character.
#if defined(IMLANG_FONT_LINK) && (IMLANG_FONT_LINK == 2)
if (!currentFontContainsCharacter(langFontLink, g_screenDC, character)) {
#else
if (!currentFontContainsCharacter(langFontLink, g_screenDC, hfont, character, name)) {
#endif
SelectObject(g_screenDC, oldFont);
langFontLink->ReleaseFont(hfont);
hfont = 0;
continue;
}
}
break;
}
} else {
#if defined(IMLANG_FONT_LINK) && (IMLANG_FONT_LINK == 2)
hfont = createMLangFont(langFontLink, g_screenDC, codePages, character);
#else
hfont = createMLangFont(langFontLink, g_screenDC, origFont, codePages);
#endif
SelectObject(g_screenDC, hfont);
GetTextFace(g_screenDC, LF_FACESIZE, name);
}
SelectObject(g_screenDC, oldFont);
if (hfont) {
familyName = name;
langFontLink->ReleaseFont(hfont);
} else
FontPlatformData::mapKnownFont(codePages, familyName);
}
if (familyName.isEmpty())
familyName = FontPlatformData::defaultFontFamily();
if (!familyName.isEmpty()) {
// FIXME: temporary workaround for Thai font problem
FontDescription fontDescription(font.fontDescription());
if (unicodeRange == cRangeThai && fontDescription.weight() > FontWeightNormal)
fontDescription.setWeight(FontWeightNormal);
FontPlatformData* result = getCachedFontPlatformData(fontDescription, familyName);
if (result && result->hash() != origFont.hash()) {
if (SimpleFontData* fontData = getCachedFontData(result, DoNotRetain))
return fontData;
}
}
return 0;
}
示例2: hash
static unsigned hash(const FontPlatformData& platformData)
{
return platformData.hash();
}
示例3: fontDescription
PassRefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, bool, const UChar* characters, int length)
{
String familyName;
WCHAR name[LF_FACESIZE];
UChar character = characters[0];
const FontPlatformData& origFont = originalFontData->platformData();
if (IMLangFontLinkType* langFontLink = getFontLinkInterface()) {
HGDIOBJ oldFont = GetCurrentObject(g_screenDC, OBJ_FONT);
HFONT hfont = 0;
DWORD codePages = 0;
UINT codePage = 0;
// Try MLang font linking first.
langFontLink->GetCharCodePages(character, &codePages);
if (codePages && u_getIntPropertyValue(character, UCHAR_UNIFIED_IDEOGRAPH)) {
// The CJK character may belong to multiple code pages. We want to
// do font linking against a single one of them, preferring the default
// code page for the user's locale.
const Vector<DWORD, 4>& CJKCodePageMasks = getCJKCodePageMasks();
unsigned numCodePages = CJKCodePageMasks.size();
for (unsigned i = 0; i < numCodePages; ++i) {
hfont = createMLangFont(langFontLink, g_screenDC, origFont, CJKCodePageMasks[i]);
if (!hfont)
continue;
SelectObject(g_screenDC, hfont);
GetTextFace(g_screenDC, LF_FACESIZE, name);
if (hfont && !(codePages & CJKCodePageMasks[i])) {
// We asked about a code page that is not one of the code pages
// returned by MLang, so the font might not contain the character.
if (!currentFontContainsCharacter(langFontLink, g_screenDC, hfont, character, name))
{
SelectObject(g_screenDC, oldFont);
langFontLink->ReleaseFont(hfont);
hfont = 0;
continue;
}
}
break;
}
} else {
hfont = createMLangFont(langFontLink, g_screenDC, origFont, codePages, character);
SelectObject(g_screenDC, hfont);
GetTextFace(g_screenDC, LF_FACESIZE, name);
}
SelectObject(g_screenDC, oldFont);
if (hfont) {
familyName = name;
langFontLink->ReleaseFont(hfont);
} else
FontPlatformData::mapKnownFont(codePages, familyName);
}
if (familyName.isEmpty())
familyName = FontPlatformData::defaultFontFamily();
if (!familyName.isEmpty()) {
// FIXME: temporary workaround for Thai font problem
FontDescription fontDescription(description);
if (ublock_getCode(c) == UBLOCK_THAI && fontDescription.weight() > FontWeightNormal)
fontDescription.setWeight(FontWeightNormal);
FontPlatformData* result = getCachedFontPlatformData(fontDescription, familyName);
if (result && result->hash() != origFont.hash()) {
if (RefPtr<SimpleFontData> fontData = getCachedFontData(result, DoNotRetain))
return fontData.release();
}
}
return 0;
}