Commit 2d15ea50 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Move the GetFontFileData() implementation out of freetype.c.

parent a3b08dd3
......@@ -1044,7 +1044,7 @@ static DWORD CDECL font_GetFontData( PHYSDEV dev, DWORD table, DWORD offset, voi
dev = GET_NEXT_PHYSDEV( dev, pGetFontData );
return dev->funcs->pGetFontData( dev, table, offset, buf, size );
}
return font_funcs->pGetFontData( physdev->font, table, offset, buf, size );
return font_funcs->get_font_data( physdev->font, table, offset, buf, size );
}
......@@ -5412,12 +5412,20 @@ BOOL WINAPI GetRasterizerCaps( LPRASTERIZER_STATUS lprs, UINT cbNumBytes)
BOOL WINAPI GetFontFileData( DWORD instance_id, DWORD unknown, UINT64 offset, void *buff, DWORD buff_size )
{
struct gdi_font *font;
DWORD tag = 0, size;
BOOL ret = FALSE;
if (!font_funcs) return FALSE;
EnterCriticalSection( &font_cs );
if ((font = get_font_from_handle( instance_id )))
ret = font_funcs->pGetFontFileData( font, unknown, offset, buff, buff_size );
{
if (font->ttc_item_offset) tag = MS_TTCF_TAG;
size = font_funcs->get_font_data( font, tag, 0, NULL, 0 );
if (size != GDI_ERROR && size >= buff_size && offset <= size - buff_size)
ret = font_funcs->get_font_data( font, tag, offset, buff, buff_size ) != GDI_ERROR;
else
SetLastError( ERROR_INVALID_PARAMETER );
}
LeaveCriticalSection( &font_cs );
return ret;
}
......
......@@ -332,6 +332,7 @@ struct gdi_font
UINT ntmCellHeight;
UINT ntmAvgWidth;
UINT aa_flags;
ULONG ttc_item_offset; /* 0 if font is not a part of TrueType collection */
BOOL can_use_bitmap : 1;
BOOL fake_italic : 1;
BOOL fake_bold : 1;
......@@ -340,12 +341,20 @@ struct gdi_font
struct font_fileinfo *fileinfo;
};
#define MS_MAKE_TAG(ch1,ch2,ch3,ch4) \
(((DWORD)ch4 << 24) | ((DWORD)ch3 << 16) | ((DWORD)ch2 << 8) | (DWORD)ch1)
#define MS_GASP_TAG MS_MAKE_TAG('g', 'a', 's', 'p')
#define MS_GSUB_TAG MS_MAKE_TAG('G', 'S', 'U', 'B')
#define MS_KERN_TAG MS_MAKE_TAG('k', 'e', 'r', 'n')
#define MS_TTCF_TAG MS_MAKE_TAG('t', 't', 'c', 'f')
#define MS_VDMX_TAG MS_MAKE_TAG('V', 'D', 'M', 'X')
struct font_backend_funcs
{
BOOL (CDECL *pEnumFonts)( LOGFONTW *lf, FONTENUMPROCW proc, LPARAM lparam );
BOOL (CDECL *pFontIsLinked)( struct gdi_font *font );
BOOL (CDECL *pGetCharWidthInfo)( struct gdi_font *font, struct char_width_info *info );
DWORD (CDECL *pGetFontData)( struct gdi_font *font, DWORD table, DWORD offset, void *buf, DWORD size );
DWORD (CDECL *pGetFontUnicodeRanges)( struct gdi_font *font, GLYPHSET *glyphset );
DWORD (CDECL *pGetGlyphIndices)( struct gdi_font *font, const WCHAR *str, INT count, WORD *gi, DWORD flags );
DWORD (CDECL *pGetKerningPairs)( struct gdi_font *font, DWORD count, KERNINGPAIR *pairs );
......@@ -358,10 +367,10 @@ struct font_backend_funcs
HANDLE (CDECL *pAddFontMemResourceEx)( void *font, DWORD size, PVOID pdv, DWORD *count );
BOOL (CDECL *pCreateScalableFontResource)( DWORD hidden, LPCWSTR resource,
LPCWSTR font_file, LPCWSTR font_path );
BOOL (CDECL *pGetFontFileData)( struct gdi_font *font, DWORD unknown, UINT64 offset,
void *buff, DWORD buff_size );
BOOL (CDECL *alloc_font)( struct gdi_font *font );
DWORD (CDECL *get_font_data)( struct gdi_font *gdi_font, DWORD table, DWORD offset,
void *buf, DWORD count );
DWORD (CDECL *get_glyph_outline)( struct gdi_font *font, UINT glyph, UINT format,
GLYPHMETRICS *gm, ABC *abc, DWORD buflen, void *buf, const MAT2 *mat );
void (CDECL *destroy_font)( struct gdi_font *font );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment