bug 427084. Use GetGlyphIndiciesW rather than ScriptGetCMap for type1 fonts. r=vlad

git-svn-id: svn://10.0.0.236/trunk@249779 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pavlov%pavlov.net 2008-04-08 07:32:38 +00:00
parent a54780f61b
commit 770e9cd515

View File

@ -1533,12 +1533,20 @@ public:
PRUnichar str[1] = { (PRUnichar)ch };
WORD glyph[1];
PRBool hasGlyph = PR_FALSE;
if (aFontEntry->mIsType1) {
// Type1 fonts and uniscribe APIs don't get along. ScriptGetCMap will return E_HANDLE
DWORD ret = GetGlyphIndicesW(dc, str, 1, glyph, GGI_MARK_NONEXISTING_GLYPHS);
if (ret != GDI_ERROR && glyph[0] != 0xFFFF)
hasGlyph = PR_TRUE;
} else {
// ScriptGetCMap works better than GetGlyphIndicesW for things like bitmap/vector fonts
HRESULT rv = ScriptGetCMap(dc, font->ScriptCache(), str, 1, 0, glyph);
if (rv == S_OK)
hasGlyph = PR_TRUE;
}
ReleaseDC(NULL, dc);
if (rv == S_OK) {
if (hasGlyph) {
aFontEntry->mCharacterMap.set(ch);
return PR_TRUE;
}