usp10: Store the GDEF table in the script cache.

To avoid reloading it all the time.
This commit is contained in:
Henri Verbeet 2011-06-07 19:44:46 +02:00 committed by Alexandre Julliard
parent 90cf60c796
commit 90d673e961
3 changed files with 12 additions and 10 deletions

View File

@ -1281,16 +1281,18 @@ static VOID *load_gdef_table(HDC hdc)
return GDEF_Table;
}
static void GDEF_UpdateGlyphProps(HDC hdc, const WORD *pwGlyphs, const WORD cGlyphs, WORD* pwLogClust, SCRIPT_GLYPHPROP *pGlyphProp)
static void GDEF_UpdateGlyphProps(HDC hdc, ScriptCache *psc, const WORD *pwGlyphs, const WORD cGlyphs, WORD* pwLogClust, SCRIPT_GLYPHPROP *pGlyphProp)
{
VOID* header = load_gdef_table(hdc);
int i;
if (!psc->GDEF_Table)
psc->GDEF_Table = load_gdef_table(hdc);
for (i = 0; i < cGlyphs; i++)
{
WORD class;
class = GDEF_get_glyph_class(header, pwGlyphs[i]);
class = GDEF_get_glyph_class(psc->GDEF_Table, pwGlyphs[i]);
switch (class)
{
@ -1322,8 +1324,6 @@ static void GDEF_UpdateGlyphProps(HDC hdc, const WORD *pwGlyphs, const WORD cGly
pGlyphProp[i].sva.fZeroWidth = 0;
}
}
HeapFree(GetProcessHeap(), 0, header);
}
static void UpdateClustersFromGlyphProp(const int cGlyphs, const int cChars, WORD* pwLogClust, SCRIPT_GLYPHPROP *pGlyphProp)
@ -2656,7 +2656,7 @@ static void ShapeCharGlyphProp_Default( HDC hdc, ScriptCache* psc, SCRIPT_ANALYS
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_CHARACTER;
}
GDEF_UpdateGlyphProps(hdc, pwGlyphs, cGlyphs, pwLogClust, pGlyphProp);
GDEF_UpdateGlyphProps(hdc, psc, pwGlyphs, cGlyphs, pwLogClust, pGlyphProp);
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
}
@ -2770,7 +2770,7 @@ static void ShapeCharGlyphProp_Arabic( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSI
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
GDEF_UpdateGlyphProps(hdc, pwGlyphs, cGlyphs, pwLogClust, pGlyphProp);
GDEF_UpdateGlyphProps(hdc, psc, pwGlyphs, cGlyphs, pwLogClust, pGlyphProp);
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
HeapFree(GetProcessHeap(),0,spaces);
}
@ -2838,7 +2838,7 @@ static void ShapeCharGlyphProp_Thai( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS
}
HeapFree(GetProcessHeap(),0,spaces);
GDEF_UpdateGlyphProps(hdc, pwGlyphs, cGlyphs, pwLogClust, pGlyphProp);
GDEF_UpdateGlyphProps(hdc, psc, pwGlyphs, cGlyphs, pwLogClust, pGlyphProp);
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
/* Do not allow justification between marks and their base */
@ -2881,7 +2881,7 @@ static void ShapeCharGlyphProp_None( HDC hdc, ScriptCache* psc, SCRIPT_ANALYSIS*
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
GDEF_UpdateGlyphProps(hdc, pwGlyphs, cGlyphs, pwLogClust, pGlyphProp);
GDEF_UpdateGlyphProps(hdc, psc, pwGlyphs, cGlyphs, pwLogClust, pGlyphProp);
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
}
@ -2917,7 +2917,7 @@ static void ShapeCharGlyphProp_Tibet( HDC hdc, ScriptCache* psc, SCRIPT_ANALYSIS
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
GDEF_UpdateGlyphProps(hdc, pwGlyphs, cGlyphs, pwLogClust, pGlyphProp);
GDEF_UpdateGlyphProps(hdc, psc, pwGlyphs, cGlyphs, pwLogClust, pGlyphProp);
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
/* Tibeten script does not set sva.fDiacritic or sva.fZeroWidth */

View File

@ -514,6 +514,7 @@ HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
heap_free(((ScriptCache *)*psc)->widths[i]);
}
heap_free(((ScriptCache *)*psc)->GSUB_Table);
heap_free(((ScriptCache *)*psc)->GDEF_Table);
heap_free(((ScriptCache *)*psc)->features);
heap_free(*psc);
*psc = NULL;

View File

@ -88,6 +88,7 @@ typedef struct {
WORD *glyphs[GLYPH_MAX / GLYPH_BLOCK_SIZE];
ABC *widths[GLYPH_MAX / GLYPH_BLOCK_SIZE];
LPVOID GSUB_Table;
LPVOID GDEF_Table;
INT feature_count;
LoadedFeature *features;