gdi32: Keep track of the number of unique fonts that are created and return this in the second DWORD of the GdiRealizationInfo structure.

This commit is contained in:
Huw Davies 2008-07-31 16:47:22 +01:00 committed by Alexandre Julliard
parent 2d6d879562
commit 29637c1441
3 changed files with 44 additions and 18 deletions

View File

@ -3254,14 +3254,6 @@ BOOL WINAPI FontIsLinked(HDC hdc)
return ret;
}
typedef struct
{
DWORD flags; /* 1 for bitmap fonts, 3 for scalable fonts */
DWORD unknown1; /* keeps incrementing - num of fonts that have been created or selected into a dc ?? */
DWORD unknown2; /* fixed for a given font - looks like it could be the order of the face in the font list or the order
in which the face was first rendered. */
} realization_info_t;
/*************************************************************
* GdiRealizationInfo (GDI32.@)
*
@ -3269,14 +3261,12 @@ typedef struct
*/
BOOL WINAPI GdiRealizationInfo(HDC hdc, realization_info_t *info)
{
UINT otm_size;
FIXME("(%p, %p): stub!\n", hdc, info);
DC *dc = get_dc_ptr(hdc);
BOOL ret = FALSE;
info->flags = 1;
otm_size = GetOutlineTextMetricsW(hdc, 0, NULL);
if(otm_size) info->flags |= 2; /* scalable */
if (!dc) return FALSE;
if (dc->gdiFont) ret = WineEngRealizationInfo(dc->gdiFont, info);
release_dc_ptr(dc);
info->unknown1 = -1;
info->unknown2 = -1;
return TRUE;
return ret;
}

View File

@ -335,6 +335,7 @@ struct tagGdiFont {
FONTSIGNATURE fs;
GdiFont *base_font;
VOID *GSUB_Table;
DWORD cache_num;
};
typedef struct {
@ -3113,6 +3114,13 @@ static GdiFont *find_in_cache(HFONT hfont, const LOGFONTW *plf, const FMAT2 *pma
return NULL;
}
static void add_to_cache(GdiFont *font)
{
static DWORD cache_num = 1;
font->cache_num = cache_num++;
list_add_head(&gdi_font_list, &font->entry);
}
/*************************************************************
* create_child_font_list
@ -3604,7 +3612,7 @@ found:
TRACE("caching: gdiFont=%p hfont=%p\n", ret, hfont);
list_add_head(&gdi_font_list, &ret->entry);
add_to_cache(ret);
LeaveCriticalSection( &freetype_cs );
return ret;
}
@ -5748,6 +5756,22 @@ BOOL WINAPI GetRasterizerCaps( LPRASTERIZER_STATUS lprs, UINT cbNumBytes)
return TRUE;
}
/*************************************************************
* WineEngRealizationInfo
*/
BOOL WineEngRealizationInfo(GdiFont *font, realization_info_t *info)
{
FIXME("(%p, %p): stub!\n", font, info);
info->flags = 1;
if(FT_IS_SCALABLE(font->ft_face))
info->flags |= 2;
info->cache_num = font->cache_num;
info->unknown2 = -1;
return TRUE;
}
/*************************************************************************
* Kerning support for TrueType fonts
*/

View File

@ -420,6 +420,17 @@ extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) DE
extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk ) DECLSPEC_HIDDEN;
/* freetype.c */
/* Undocumented structure filled in by GdiRealizationInfo */
typedef struct
{
DWORD flags; /* 1 for bitmap fonts, 3 for scalable fonts */
DWORD cache_num; /* keeps incrementing - num of fonts that have been created allowing for caching?? */
DWORD unknown2; /* fixed for a given font - looks like it could be the order of the face in the font list or the order
in which the face was first rendered. */
} realization_info_t;
extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC_HIDDEN;
extern GdiFont* WineEngCreateFontInstance(DC*, HFONT) DECLSPEC_HIDDEN;
@ -447,6 +458,7 @@ extern INT WineEngGetTextFace(GdiFont*, INT, LPWSTR) DECLSPEC_HIDDEN;
extern BOOL WineEngGetTextMetrics(GdiFont*, LPTEXTMETRICW) DECLSPEC_HIDDEN;
extern BOOL WineEngFontIsLinked(GdiFont*) DECLSPEC_HIDDEN;
extern BOOL WineEngInit(void) DECLSPEC_HIDDEN;
extern BOOL WineEngRealizationInfo(GdiFont*, realization_info_t*) DECLSPEC_HIDDEN;
extern BOOL WineEngRemoveFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
/* gdiobj.c */