gdi32: Implement GetKerningPairs as a standard driver entry point.

This commit is contained in:
Alexandre Julliard 2011-10-20 16:39:53 +02:00
parent d63651fe18
commit 0c96820104
3 changed files with 23 additions and 19 deletions

View File

@ -2664,7 +2664,8 @@ DWORD WINAPI GetKerningPairsW( HDC hDC, DWORD cPairs,
LPKERNINGPAIR lpKerningPairs ) LPKERNINGPAIR lpKerningPairs )
{ {
DC *dc; DC *dc;
DWORD ret = 0; DWORD ret;
PHYSDEV dev;
TRACE("(%p,%d,%p)\n", hDC, cPairs, lpKerningPairs); TRACE("(%p,%d,%p)\n", hDC, cPairs, lpKerningPairs);
@ -2677,9 +2678,8 @@ DWORD WINAPI GetKerningPairsW( HDC hDC, DWORD cPairs,
dc = get_dc_ptr(hDC); dc = get_dc_ptr(hDC);
if (!dc) return 0; if (!dc) return 0;
if (dc->gdiFont) dev = GET_DC_PHYSDEV( dc, pGetKerningPairs );
ret = WineEngGetKerningPairs(dc->gdiFont, cPairs, lpKerningPairs); ret = dev->funcs->pGetKerningPairs( dev, cPairs, lpKerningPairs );
release_dc_ptr( dc ); release_dc_ptr( dc );
return ret; return ret;
} }

View File

@ -6896,7 +6896,10 @@ static DWORD parse_format0_kern_subtable(GdiFont *font,
return nPairs; return nPairs;
} }
DWORD WineEngGetKerningPairs(GdiFont *font, DWORD cPairs, KERNINGPAIR *kern_pair) /*************************************************************
* freetype_GetKerningPairs
*/
static DWORD freetype_GetKerningPairs( PHYSDEV dev, DWORD cPairs, KERNINGPAIR *kern_pair )
{ {
DWORD length; DWORD length;
void *buf; void *buf;
@ -6904,6 +6907,14 @@ DWORD WineEngGetKerningPairs(GdiFont *font, DWORD cPairs, KERNINGPAIR *kern_pair
const struct TT_kern_subtable *tt_kern_subtable; const struct TT_kern_subtable *tt_kern_subtable;
USHORT i, nTables; USHORT i, nTables;
USHORT *glyph_to_char; USHORT *glyph_to_char;
GdiFont *font;
struct freetype_physdev *physdev = get_freetype_dev( dev );
if (!(font = physdev->font))
{
dev = GET_NEXT_PHYSDEV( dev, pGetKerningPairs );
return dev->funcs->pGetKerningPairs( dev, cPairs, kern_pair );
}
GDI_CheckNotLock(); GDI_CheckNotLock();
EnterCriticalSection( &freetype_cs ); EnterCriticalSection( &freetype_cs );
@ -6913,11 +6924,11 @@ DWORD WineEngGetKerningPairs(GdiFont *font, DWORD cPairs, KERNINGPAIR *kern_pair
{ {
cPairs = min(cPairs, font->total_kern_pairs); cPairs = min(cPairs, font->total_kern_pairs);
memcpy(kern_pair, font->kern_pairs, cPairs * sizeof(*kern_pair)); memcpy(kern_pair, font->kern_pairs, cPairs * sizeof(*kern_pair));
LeaveCriticalSection( &freetype_cs );
return cPairs;
} }
else cPairs = font->total_kern_pairs;
LeaveCriticalSection( &freetype_cs ); LeaveCriticalSection( &freetype_cs );
return font->total_kern_pairs; return cPairs;
} }
font->total_kern_pairs = 0; font->total_kern_pairs = 0;
@ -7038,11 +7049,11 @@ DWORD WineEngGetKerningPairs(GdiFont *font, DWORD cPairs, KERNINGPAIR *kern_pair
{ {
cPairs = min(cPairs, font->total_kern_pairs); cPairs = min(cPairs, font->total_kern_pairs);
memcpy(kern_pair, font->kern_pairs, cPairs * sizeof(*kern_pair)); memcpy(kern_pair, font->kern_pairs, cPairs * sizeof(*kern_pair));
LeaveCriticalSection( &freetype_cs );
return cPairs;
} }
else cPairs = font->total_kern_pairs;
LeaveCriticalSection( &freetype_cs ); LeaveCriticalSection( &freetype_cs );
return font->total_kern_pairs; return cPairs;
} }
static const struct gdi_dc_funcs freetype_funcs = static const struct gdi_dc_funcs freetype_funcs =
@ -7097,7 +7108,7 @@ static const struct gdi_dc_funcs freetype_funcs =
freetype_GetGlyphOutline, /* pGetGlyphOutline */ freetype_GetGlyphOutline, /* pGetGlyphOutline */
NULL, /* pGetICMProfile */ NULL, /* pGetICMProfile */
NULL, /* pGetImage */ NULL, /* pGetImage */
NULL, /* pGetKerningPairs */ freetype_GetKerningPairs, /* pGetKerningPairs */
NULL, /* pGetNearestColor */ NULL, /* pGetNearestColor */
NULL, /* pGetOutlineTextMetrics */ NULL, /* pGetOutlineTextMetrics */
NULL, /* pGetPixel */ NULL, /* pGetPixel */
@ -7267,12 +7278,6 @@ BOOL WINAPI GetRasterizerCaps( LPRASTERIZER_STATUS lprs, UINT cbNumBytes)
return TRUE; return TRUE;
} }
DWORD WineEngGetKerningPairs(GdiFont *font, DWORD cPairs, KERNINGPAIR *kern_pair)
{
ERR("called but we don't have FreeType\n");
return 0;
}
BOOL WineEngRealizationInfo(GdiFont *font, realization_info_t *info) BOOL WineEngRealizationInfo(GdiFont *font, realization_info_t *info)
{ {
ERR("called but we don't have FreeType\n"); ERR("called but we don't have FreeType\n");

View File

@ -293,7 +293,6 @@ extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC_HIDDEN; extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC_HIDDEN;
extern BOOL WineEngDestroyFontInstance(HFONT handle) DECLSPEC_HIDDEN; extern BOOL WineEngDestroyFontInstance(HFONT handle) DECLSPEC_HIDDEN;
extern DWORD WineEngGetFontData(GdiFont*, DWORD, DWORD, LPVOID, DWORD) DECLSPEC_HIDDEN; extern DWORD WineEngGetFontData(GdiFont*, DWORD, DWORD, LPVOID, DWORD) DECLSPEC_HIDDEN;
extern DWORD WineEngGetKerningPairs(GdiFont*, DWORD, KERNINGPAIR *) DECLSPEC_HIDDEN;
extern BOOL WineEngGetLinkedHFont(DC *dc, WCHAR c, HFONT *new_hfont, UINT *glyph) DECLSPEC_HIDDEN; extern BOOL WineEngGetLinkedHFont(DC *dc, WCHAR c, HFONT *new_hfont, UINT *glyph) DECLSPEC_HIDDEN;
extern UINT WineEngGetOutlineTextMetrics(GdiFont*, UINT, LPOUTLINETEXTMETRICW) DECLSPEC_HIDDEN; extern UINT WineEngGetOutlineTextMetrics(GdiFont*, UINT, LPOUTLINETEXTMETRICW) DECLSPEC_HIDDEN;
extern UINT WineEngGetTextCharsetInfo(GdiFont *font, LPFONTSIGNATURE fs, DWORD flags) DECLSPEC_HIDDEN; extern UINT WineEngGetTextCharsetInfo(GdiFont *font, LPFONTSIGNATURE fs, DWORD flags) DECLSPEC_HIDDEN;