restore style for TTF cache

This commit is contained in:
Vincent Wei
2019-03-04 14:37:59 +08:00
parent 682c81d636
commit 10e55b0d4f
3 changed files with 11 additions and 8 deletions

View File

@@ -88,6 +88,7 @@ typedef struct _HashDirectory {
typedef struct _FontCache {
/* Information about font */
char df_name[LEN_UNIDEVFONT_NAME + 1];
int style;
int fontsize;
int rotation;
int refers;
@@ -459,7 +460,7 @@ __mg_ttc_write(HCACHE hCache, TTFCACHEINFO *data, int size)
ndir : how many hash entries in the cache
makeHashKey : the function which make the hash key */
HCACHE
__mg_ttc_create(const char *df_name, int size, int rotation,
__mg_ttc_create(const char *df_name, int style, int size, int rotation,
int nblk, int blksize, int ndir, MakeHashKeyFunc makeHashKey)
{
CacheQueueNode *temp;
@@ -479,6 +480,7 @@ __mg_ttc_create(const char *df_name, int size, int rotation,
memset(temp->cache.df_name, 0, LEN_UNIDEVFONT_NAME + 1);
strncpy(temp->cache.df_name, df_name, LEN_UNIDEVFONT_NAME);
temp->cache.style = style & FS_RENDER_MASK;
temp->cache.fontsize = size;
temp->cache.rotation = rotation;
temp->cache.blkSize = blksize;
@@ -568,10 +570,8 @@ __mg_ttc_sys_deinit(void)
}
}
HCACHE
__mg_ttc_is_exist(const char *df_name, int size, int rotation)
__mg_ttc_is_exist(const char *df_name, int style, int size, int rotation)
{
CacheQueueNode *p;
@@ -582,6 +582,7 @@ __mg_ttc_is_exist(const char *df_name, int size, int rotation)
p = __mg_globalCache.queueDummyHead.nextCache;
while (p != &__mg_globalCache.queueDummyHead) {
if (strncmp(p->cache.df_name, df_name, LEN_UNIDEVFONT_NAME) == 0
&& p->cache.style == (style & FS_RENDER_MASK)
&& p->cache.fontsize == size
&& p->cache.rotation == rotation) {
return (HCACHE) p;

View File

@@ -840,7 +840,7 @@ new_instance (LOGFONT* logfont, DEVFONT* devfont, BOOL need_sbc_font)
if (!(logfont->style & FS_OTHER_TTFNOCACHE)) {
HCACHE hCache = __mg_ttc_is_exist(devfont->name,
logfont->size, logfont->rotation);
logfont->style, logfont->size, logfont->rotation);
DP(("__mg_ttc_is_exist() return %p\n", hCache));
/* No this style's cache */
if (hCache == 0) {
@@ -870,7 +870,7 @@ new_instance (LOGFONT* logfont, DEVFONT* devfont, BOOL need_sbc_font)
rows, col, blksize, (int)(blksize-sizeof(TTFCACHEINFO)), nblk));
ft_inst_info->cache = __mg_ttc_create(devfont->name,
logfont->size, logfont->rotation,
logfont->style, logfont->size, logfont->rotation,
nblk , blksize, _TTF_HASH_NDIR, make_hash_key);
DP(("__mg_ttc_create() return %p\n", ft_inst_info->cache));

View File

@@ -126,9 +126,11 @@ typedef struct tagTTFCACHEINFO {
void *bitmap;
} TTFCACHEINFO, *PTTFCACHEINFO;
extern HCACHE __mg_ttc_create(const char *df_name, int size, int rotation,
extern HCACHE __mg_ttc_create(const char *df_name,
int style, int size, int rotation,
int nblk, int blksize, int ndir, MakeHashKeyFunc makeHashKey);
extern HCACHE __mg_ttc_is_exist(const char *df_name, int size, int rotation);
extern HCACHE __mg_ttc_is_exist(const char *df_name,
int style, int size, int rotation);
extern int __mg_ttc_write(HCACHE hCache, TTFCACHEINFO *data, int size);
extern void __mg_ttc_release(HCACHE hCache);