usp10: Cache OUTLINETEXTMETRICW in addition to TEXTMETRICW.

This commit is contained in:
Aric Stewart 2012-07-31 08:49:57 -05:00 committed by Alexandre Julliard
parent 552db7aade
commit ef5daa9aa5
2 changed files with 10 additions and 0 deletions

View File

@ -788,6 +788,7 @@ static inline BOOL set_cache_glyph_widths(SCRIPT_CACHE *psc, WORD glyph, ABC *ab
static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc) static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
{ {
ScriptCache *sc; ScriptCache *sc;
int size;
if (!psc) return E_INVALIDARG; if (!psc) return E_INVALIDARG;
if (*psc) return S_OK; if (*psc) return S_OK;
@ -799,6 +800,13 @@ static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
heap_free(sc); heap_free(sc);
return E_INVALIDARG; return E_INVALIDARG;
} }
size = GetOutlineTextMetricsW(hdc, 0, NULL);
if (size)
{
sc->otm = heap_alloc(size);
sc->otm->otmSize = size;
GetOutlineTextMetricsW(hdc, size, sc->otm);
}
if (!GetObjectW(GetCurrentObject(hdc, OBJ_FONT), sizeof(LOGFONTW), &sc->lf)) if (!GetObjectW(GetCurrentObject(hdc, OBJ_FONT), sizeof(LOGFONTW), &sc->lf))
{ {
heap_free(sc); heap_free(sc);
@ -998,6 +1006,7 @@ HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
heap_free(((ScriptCache *)*psc)->scripts[i].languages); heap_free(((ScriptCache *)*psc)->scripts[i].languages);
} }
heap_free(((ScriptCache *)*psc)->scripts); heap_free(((ScriptCache *)*psc)->scripts);
heap_free(((ScriptCache *)*psc)->otm);
heap_free(*psc); heap_free(*psc);
*psc = NULL; *psc = NULL;
} }

View File

@ -159,6 +159,7 @@ typedef struct {
typedef struct { typedef struct {
LOGFONTW lf; LOGFONTW lf;
TEXTMETRICW tm; TEXTMETRICW tm;
OUTLINETEXTMETRICW *otm;
BOOL sfnt; BOOL sfnt;
CacheGlyphPage *page[0x10]; CacheGlyphPage *page[0x10];
ABC *widths[GLYPH_MAX / GLYPH_BLOCK_SIZE]; ABC *widths[GLYPH_MAX / GLYPH_BLOCK_SIZE];