Huw Davies : gdi32: Keep track of the number of unique fonts that are created and return this in the second DWORD of the GdiRealizationInfo structure .
Alexandre Julliard
julliard at winehq.org
Tue Aug 5 07:26:15 CDT 2008
Module: wine
Branch: master
Commit: 29637c14415fc8913eccf7eef145c876421232e8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=29637c14415fc8913eccf7eef145c876421232e8
Author: Huw Davies <daviesh at huw-davies-computer.local>
Date: Thu Jul 31 16:47:22 2008 +0100
gdi32: Keep track of the number of unique fonts that are created and return this in the second DWORD of the GdiRealizationInfo structure.
---
dlls/gdi32/font.c | 22 ++++++----------------
dlls/gdi32/freetype.c | 28 ++++++++++++++++++++++++++--
dlls/gdi32/gdi_private.h | 12 ++++++++++++
3 files changed, 44 insertions(+), 18 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 013cd2a..1e8cac3 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -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;
}
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index a2110ab..bb3c7d3 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -335,6 +335,7 @@ struct tagGdiFont {
FONTSIGNATURE fs;
GdiFont *base_font;
VOID *GSUB_Table;
+ DWORD cache_num;
};
typedef struct {
@@ -3113,7 +3114,14 @@ 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
*/
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index aa38b95..325c708 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -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 */
More information about the wine-cvs
mailing list