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

View File

@ -6896,7 +6896,10 @@ static DWORD parse_format0_kern_subtable(GdiFont *font,
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;
void *buf;
@ -6904,6 +6907,14 @@ DWORD WineEngGetKerningPairs(GdiFont *font, DWORD cPairs, KERNINGPAIR *kern_pair
const struct TT_kern_subtable *tt_kern_subtable;
USHORT i, nTables;
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();
EnterCriticalSection( &freetype_cs );
@ -6913,11 +6924,11 @@ DWORD WineEngGetKerningPairs(GdiFont *font, DWORD cPairs, KERNINGPAIR *kern_pair
{
cPairs = min(cPairs, font->total_kern_pairs);
memcpy(kern_pair, font->kern_pairs, cPairs * sizeof(*kern_pair));
LeaveCriticalSection( &freetype_cs );
return cPairs;
}
else cPairs = font->total_kern_pairs;
LeaveCriticalSection( &freetype_cs );
return font->total_kern_pairs;
return cPairs;
}
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);
memcpy(kern_pair, font->kern_pairs, cPairs * sizeof(*kern_pair));
LeaveCriticalSection( &freetype_cs );
return cPairs;
}
else cPairs = font->total_kern_pairs;
LeaveCriticalSection( &freetype_cs );
return font->total_kern_pairs;
return cPairs;
}
static const struct gdi_dc_funcs freetype_funcs =
@ -7097,7 +7108,7 @@ static const struct gdi_dc_funcs freetype_funcs =
freetype_GetGlyphOutline, /* pGetGlyphOutline */
NULL, /* pGetICMProfile */
NULL, /* pGetImage */
NULL, /* pGetKerningPairs */
freetype_GetKerningPairs, /* pGetKerningPairs */
NULL, /* pGetNearestColor */
NULL, /* pGetOutlineTextMetrics */
NULL, /* pGetPixel */
@ -7267,12 +7278,6 @@ BOOL WINAPI GetRasterizerCaps( LPRASTERIZER_STATUS lprs, UINT cbNumBytes)
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)
{
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 BOOL WineEngDestroyFontInstance(HFONT handle) 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 UINT WineEngGetOutlineTextMetrics(GdiFont*, UINT, LPOUTLINETEXTMETRICW) DECLSPEC_HIDDEN;
extern UINT WineEngGetTextCharsetInfo(GdiFont *font, LPFONTSIGNATURE fs, DWORD flags) DECLSPEC_HIDDEN;