зеркало из https://github.com/mozilla/gecko-dev.git
bug 985220 pt 2 - replace the use of GetGlyphIndicesW with ScriptGetCMap in gfxGDIFont::GetGlyph. r=jdaggett
This commit is contained in:
Родитель
088699795b
Коммит
9d9eaef84f
|
@ -49,7 +49,8 @@ gfxGDIFont::gfxGDIFont(GDIFontEntry *aFontEntry,
|
|||
mFontFace(nullptr),
|
||||
mMetrics(nullptr),
|
||||
mSpaceGlyph(0),
|
||||
mNeedsBold(aNeedsBold)
|
||||
mNeedsBold(aNeedsBold),
|
||||
mScriptCache(nullptr)
|
||||
{
|
||||
if (FontCanSupportGraphite()) {
|
||||
mGraphiteShaper = new gfxGraphiteShaper(this);
|
||||
|
@ -68,6 +69,9 @@ gfxGDIFont::~gfxGDIFont()
|
|||
if (mFont) {
|
||||
::DeleteObject(mFont);
|
||||
}
|
||||
if (mScriptCache) {
|
||||
ScriptFreeCache(&mScriptCache);
|
||||
}
|
||||
delete mMetrics;
|
||||
}
|
||||
|
||||
|
@ -448,15 +452,16 @@ gfxGDIFont::GetGlyph(uint32_t aUnicode, uint32_t aVarSelector)
|
|||
return gid;
|
||||
}
|
||||
|
||||
AutoDC dc;
|
||||
AutoSelectFont fs(dc.GetDC(), GetHFONT());
|
||||
|
||||
wchar_t ch = aUnicode;
|
||||
WORD glyph;
|
||||
DWORD ret = GetGlyphIndicesW(dc.GetDC(), &ch, 1, &glyph,
|
||||
GGI_MARK_NONEXISTING_GLYPHS);
|
||||
if (ret == GDI_ERROR || glyph == 0xFFFF) {
|
||||
return 0;
|
||||
DWORD ret = ScriptGetCMap(nullptr, &mScriptCache, &ch, 1, 0, &glyph);
|
||||
if (ret == E_PENDING) {
|
||||
AutoDC dc;
|
||||
AutoSelectFont fs(dc.GetDC(), GetHFONT());
|
||||
ret = ScriptGetCMap(dc.GetDC(), &mScriptCache, &ch, 1, 0, &glyph);
|
||||
}
|
||||
if (ret != S_OK) {
|
||||
glyph = 0;
|
||||
}
|
||||
|
||||
mGlyphIDs->Put(aUnicode, glyph);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "nsHashKeys.h"
|
||||
|
||||
#include "cairo.h"
|
||||
#include "usp10.h"
|
||||
|
||||
class gfxGDIFont : public gfxFont
|
||||
{
|
||||
|
@ -96,6 +97,7 @@ protected:
|
|||
|
||||
// cache of glyph IDs (used for non-sfnt fonts only)
|
||||
nsAutoPtr<nsDataHashtable<nsUint32HashKey,uint32_t> > mGlyphIDs;
|
||||
SCRIPT_CACHE mScriptCache;
|
||||
|
||||
// cache of glyph widths in 16.16 fixed-point pixels
|
||||
nsAutoPtr<nsDataHashtable<nsUint32HashKey,int32_t> > mGlyphWidths;
|
||||
|
|
Загрузка…
Ссылка в новой задаче