Commit 4e2024e8 authored by Huw D M Davies's avatar Huw D M Davies Committed by Alexandre Julliard

Implement GetFontData.

parent 2843934a
......@@ -414,7 +414,8 @@ else
freetype/ftnames.h \
freetype/ftsnames.h \
freetype/ttnameid.h \
freetype/ftoutln.h)
freetype/ftoutln.h \
freetype/internal/sfnt.h)
CPPFLAGS="$ac_save_CPPFLAGS"
wine_cv_msg_freetype=no
fi
......
......@@ -21,6 +21,7 @@
#include <string.h>
#include <dirent.h>
#include <stdio.h>
#include <assert.h>
DEFAULT_DEBUG_CHANNEL(font);
......@@ -47,6 +48,9 @@ DEFAULT_DEBUG_CHANNEL(font);
#ifdef HAVE_FREETYPE_FTOUTLN_H
#include <freetype/ftoutln.h>
#endif
#ifdef HAVE_FREETYPE_INTERNAL_SFNT_H
#include <freetype/internal/sfnt.h>
#endif
static FT_Library library = 0;
......@@ -770,6 +774,43 @@ BOOL WineEngGetTextExtentPoint(GdiFont font, LPCWSTR wstr, INT count,
return TRUE;
}
/*************************************************************
* WineEngGetFontData
*
*/
DWORD WineEngGetFontData(GdiFont font, DWORD table, DWORD offset, LPVOID buf,
DWORD cbData)
{
FT_Face ft_face = font->ft_face;
TT_Face tt_face;
SFNT_Interface *sfnt;
DWORD len;
FT_Error err;
if(!FT_IS_SFNT(ft_face))
return GDI_ERROR;
tt_face = (TT_Face) ft_face;
sfnt = (SFNT_Interface*)tt_face->sfnt;
if(!buf || !cbData)
len = 0;
else
len = cbData;
if(table) { /* MS tags differ in endidness from FT ones */
table = table >> 24 | table << 24 |
(table >> 8 & 0xff00) | (table << 8 & 0xff0000);
}
err = sfnt->load_any(tt_face, table, offset, buf, &len);
if(err) {
ERR("Can't find table %08lx\n", table);
return GDI_ERROR;
}
return len;
}
#else /* HAVE_FREETYPE */
BOOL WineEngInit(void)
......@@ -831,5 +872,11 @@ BOOL WineEngGetTextExtentPoint(GdiFont font, LPCWSTR wstr, INT count,
return FALSE;
}
DWORD WineEngGetFontData(GdiFont font, DWORD table, DWORD offset, LPVOID buf,
DWORD cbData)
{
ERR("called but we don't have FreeType\n");
return GDI_ERROR;
}
#endif /* HAVE_FREETYPE */
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
/* include/config.h.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define if using alloca.c. */
#undef C_ALLOCA
......@@ -238,6 +238,9 @@
/* Define if you have the <freetype/ftsnames.h> header file. */
#undef HAVE_FREETYPE_FTSNAMES_H
/* Define if you have the <freetype/internal/sfnt.h> header file. */
#undef HAVE_FREETYPE_INTERNAL_SFNT_H
/* Define if you have the <freetype/ttnameid.h> header file. */
#undef HAVE_FREETYPE_TTNAMEID_H
......
......@@ -78,6 +78,7 @@ extern GdiFont WineEngCreateFontInstance(HFONT);
extern DWORD WineEngDecRefFont(GdiFont);
extern DWORD WineEngEnumFonts(LPLOGFONTW, DEVICEFONTENUMPROC, LPARAM);
extern BOOL WineEngGetCharWidth(GdiFont, UINT, UINT, LPINT);
extern DWORD WineEngGetFontData(GdiFont, DWORD, DWORD, LPVOID, DWORD);
extern DWORD WineEngGetGlyphOutline(GdiFont, UINT glyph, UINT format,
LPGLYPHMETRICS, DWORD buflen, LPVOID buf,
const MAT2*);
......
......@@ -1895,16 +1895,20 @@ DWORD WINAPI GetFontLanguageInfo16(HDC16 hdc) {
*
* Calls SetLastError()
*
* BUGS
*
* Unimplemented
*/
DWORD WINAPI GetFontData(HDC hdc, DWORD table, DWORD offset,
LPVOID buffer, DWORD length)
{
FIXME("(%x,%ld,%ld,%p,%ld): stub\n", hdc, table, offset, buffer, length);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return GDI_ERROR;
DC *dc = DC_GetDCPtr(hdc);
DWORD ret = GDI_ERROR;
if(!dc) return GDI_ERROR;
if(dc->gdiFont)
ret = WineEngGetFontData(dc->gdiFont, table, offset, buffer, length);
GDI_ReleaseObj(hdc);
return ret;
}
/*************************************************************************
......
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