28 #include "wine/unicode.h" 105 #ifdef WORDS_BIGENDIAN 106 #define GET_BE_WORD(x) (x) 107 #define GET_BE_DWORD(x) (x) 109 #define GET_BE_WORD(x) MAKEWORD(HIBYTE(x), LOBYTE(x)) 110 #define GET_BE_DWORD(x) MAKELONG(GET_BE_WORD(HIWORD(x)), GET_BE_WORD(LOWORD(x))); 113 #define MS_MAKE_TAG(ch0, ch1, ch2, ch3) \ 114 ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \ 115 ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24)) 116 #define MS_OS2_TAG MS_MAKE_TAG('O','S','/','2') 117 #define MS_HHEA_TAG MS_MAKE_TAG('h','h','e','a') 154 if (!fontFamily || !
font || emSize < 0.0)
157 TRACE(
"%p (%s), %f, %d, %d, %p\n", fontFamily,
160 memset(&lfw, 0,
sizeof(lfw));
184 (*font)->unit =
unit;
185 (*font)->emSize = emSize;
323 if (!(
font && family))
370 if (
font->otm.otmTextMetrics.tmItalic)
372 if (
font->otm.otmTextMetrics.tmUnderlined)
374 if (
font->otm.otmTextMetrics.tmStruckOut)
438 TRACE(
"(%p, %p, %p)\n",
font, graphics, lfa);
461 TRACE(
"(%p, %p, %p)\n",
font, graphics, lf);
463 if (!
font || !graphics || !lf)
502 lf->
lfItalic =
font->otm.otmTextMetrics.tmItalic ? 1 : 0;
526 if(!
font || !cloneFont)
529 *cloneFont = heap_alloc_zero(
sizeof(
GpFont));
569 TRACE(
"%s,%d => %f\n",
579 TRACE(
"%s,%d(unit %d) => %f\n",
603 UINT16 line_spacing, em_height;
620 TRACE(
"%s,%d => %f\n",
668 memset(&tt_hori, 0,
sizeof(tt_hori));
683 if (
size >
sizeof(tt_os2))
size =
sizeof(tt_os2);
685 memset(&tt_os2, 0,
sizeof(tt_os2));
759 FIXME(
"No support for FontCollections yet!\n");
776 TRACE(
"<-- %p\n", ffamily);
815 TRACE(
"<-- %p\n", *clonedFontFamily);
840 static int lang_fixme;
845 TRACE(
"%p, %p, %d\n", family,
name, language);
848 FIXME(
"No support for handling of multiple languages!\n");
885 *CellAscent = family->ascent;
894 TRACE(
"(%p, %d, %p)\n", family,
style, CellDescent);
898 *CellDescent = family->descent;
924 *EmHeight = family->em_height;
948 TRACE(
"%p, %d, %p\n", family,
style, LineSpacing);
950 if (!(family && LineSpacing))
955 *LineSpacing = family->line_spacing;
981 TRACE(
"%p %d %p\n", family,
style, IsStyleAvailable);
983 if (!(family && IsStyleAvailable))
986 *IsStyleAvailable =
FALSE;
991 *IsStyleAvailable =
TRUE;
1012 static const WCHAR CourierNew[] = {
'C',
'o',
'u',
'r',
'i',
'e',
'r',
' ',
'N',
'e',
'w',
'\0'};
1013 static const WCHAR LiberationMono[] = {
'L',
'i',
'b',
'e',
'r',
'a',
't',
'i',
'o',
'n',
' ',
'M',
'o',
'n',
'o',
'\0'};
1024 ERR(
"Missing 'Courier New' font\n");
1043 static const WCHAR TimesNewRoman[] = {
'T',
'i',
'm',
'e',
's',
' ',
'N',
'e',
'w',
' ',
'R',
'o',
'm',
'a',
'n',
'\0'};
1044 static const WCHAR LiberationSerif[] = {
'L',
'i',
'b',
'e',
'r',
'a',
't',
'i',
'o',
'n',
' ',
'S',
'e',
'r',
'i',
'f',
'\0'};
1047 TRACE(
"(%p)\n", nativeFamily);
1057 ERR(
"Missing 'Times New Roman' font\n");
1077 static const WCHAR MicrosoftSansSerif[] = {
'M',
'i',
'c',
'r',
'o',
's',
'o',
'f',
't',
' ',
'S',
'a',
'n',
's',
' ',
'S',
'e',
'r',
'i',
'f',
'\0'};
1078 static const WCHAR Tahoma[] = {
'T',
'a',
'h',
'o',
'm',
'a',
'\0'};
1080 TRACE(
"(%p)\n", nativeFamily);
1098 TRACE(
"%p\n", fontCollection);
1100 if (!fontCollection)
1106 (*fontCollection)->FontFamilies =
NULL;
1107 (*fontCollection)->count = 0;
1108 (*fontCollection)->allocated = 0;
1110 TRACE(
"<-- %p\n", *fontCollection);
1122 TRACE(
"%p\n", fontCollection);
1124 if (!fontCollection)
1127 for (
i = 0;
i < (*fontCollection)->count;
i++)
heap_free((*fontCollection)->FontFamilies[
i]);
1128 heap_free((*fontCollection)->FontFamilies);
1172 #define TT_PLATFORM_APPLE_UNICODE 0 1173 #define TT_PLATFORM_MACINTOSH 1 1174 #define TT_PLATFORM_MICROSOFT 3 1176 #define TT_APPLE_ID_DEFAULT 0 1177 #define TT_APPLE_ID_ISO_10646 2 1178 #define TT_APPLE_ID_UNICODE_2_0 3 1180 #define TT_MS_ID_SYMBOL_CS 0 1181 #define TT_MS_ID_UNICODE_CS 1 1183 #define TT_MAC_ID_SIMPLIFIED_CHINESE 25 1185 #define NAME_ID_FULL_FONT_NAME 4 1317 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1318 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1348 return 10000 + encoding_id;
1391 if (name_lang ==
lang)
return 3;
1409 for (
len = 0;
len < name_len / 2;
len++)
1433 int i,
res, best_lang = 0, best_index = -1;
1443 pos =
sizeof(*header);
1447 pos +=
sizeof(*table_directory);
1448 if (
memcmp(table_directory->
tag,
"name", 4) == 0)
1459 pos = ofs +
sizeof(*name_table);
1469 pos +=
sizeof(*name_record);
1478 if (
res > best_lang)
1488 name_record = (
const tt_name_record*)(name_table + 1) + best_index;
1545 param.collection = fontCollection;
1562 TRACE(
"%p, %p\n", fontCollection, numFound);
1564 if (!(fontCollection && numFound))
1567 *numFound = fontCollection->
count;
1581 TRACE(
"%p, %d, %p, %p\n", fontCollection, numSought, gpfamilies, numFound);
1583 if (!(fontCollection && gpfamilies && numFound))
1586 memset(gpfamilies, 0,
sizeof(*gpfamilies) * numSought);
1588 for (
i = 0;
i < numSought &&
i < fontCollection->
count &&
stat ==
Ok;
i++)
1598 for (
i=0;
i<numToFree;
i++)
1601 gpfamilies[
i] =
NULL;
1643 if (!new_family_list)
1658 if (
param->is_system)
1682 TRACE(
"(%p)\n",fontCollection);
1684 if (!fontCollection)
#define TT_APPLE_ID_DEFAULT
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
HFONT WINAPI CreateFontIndirectW(CONST LOGFONTW *lplf)
GpStatus WINGDIPAPI GdipGetDpiY(GpGraphics *graphics, REAL *dpi)
GpStatus WINGDIPAPI GdipGetGenericFontFamilyMonospace(GpFontFamily **nativeFamily)
GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
GpFontFamily ** FontFamilies
GpStatus WINGDIPAPI GdipDeleteFont(GpFont *font)
static const WCHAR TimesNewRoman[]
int WINAPI EnumFontFamiliesExW(HDC hdc, LPLOGFONTW lpLogfont, FONTENUMPROCW lpEnumFontFamExProc, LPARAM lParam, DWORD dwFlags)
GpStatus WINGDIPAPI GdipCreateFontFromDC(HDC hdc, GpFont **font)
GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc, GDIPCONST LOGFONTW *logfont, GpFont **font)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define WideCharToMultiByte
WCHAR FamilyName[LF_FACESIZE]
#define LANG_CHINESE_SIMPLIFIED
#define SUBLANG_AZERI_CYRILLIC
#define SUBLANG_DUTCH_BELGIAN
#define TT_APPLE_ID_ISO_10646
GLuint GLuint GLsizei count
GpStatus WINGDIPAPI GdipGetFontUnit(GpFont *font, Unit *unit)
static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
static WCHAR * copy_name_table_string(const tt_name_record *name, const BYTE *data)
#define TT_APPLE_ID_UNICODE_2_0
HANDLE WINAPI AddFontMemResourceEx(PVOID pbFont, DWORD cbFont, PVOID pdv, DWORD *pcFonts)
GpStatus WINGDIPAPI GdipGetLogFontA(GpFont *font, GpGraphics *graphics, LOGFONTA *lfa)
void free_installed_fonts(void)
UINT APIENTRY GetOutlineTextMetricsW(HDC hdc, UINT cbData, LPOUTLINETEXTMETRICW lpOTM)
#define LANG_SCOTTISH_GAELIC
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
#define INVALID_HANDLE_VALUE
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
static GpFontCollection installedFontCollection
#define TT_MS_ID_UNICODE_CS
static BOOL get_font_metrics(HDC hdc, struct font_metrics *fm)
static char memory[1024 *256]
static void * heap_alloc(size_t len)
WINE_DEFAULT_DEBUG_CHANNEL(d3dx)
#define TT_PLATFORM_MICROSOFT
GpStatus WINGDIPAPI GdipGetGenericFontFamilySansSerif(GpFontFamily **nativeFamily)
int WINAPI EnumFontFamiliesW(HDC hdc, LPCWSTR lpszFamily, FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam)
DWORD WINAPI GetFontData(HDC hdc, DWORD dwTable, DWORD dwOffset, LPVOID lpvBuffer, DWORD cbData)
GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily, REAL emSize, INT style, Unit unit, GpFont **font)
#define CLIP_DEFAULT_PRECIS
GLenum GLuint GLenum GLsizei length
SHORT minRightSideBearing
#define TT_PLATFORM_APPLE_UNICODE
static REAL get_font_size(const GpFont *font)
GpStatus WINGDIPAPI GdipGetCellAscent(GDIPCONST GpFontFamily *family, INT style, UINT16 *CellAscent)
png_const_structrp png_const_inforp int * unit
SHORT ySuperscriptYOffset
GpStatus WINGDIPAPI GdipGetFontSize(GpFont *font, REAL *size)
REAL pixels_to_units(REAL pixels, GpUnit unit, REAL dpi)
static LPTEXTMETRICW LONG * height
GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, GpFontCollection *fontCollection, GpFontFamily **FontFamily)
static INT gdip_round(REAL x)
static int match_name_table_language(const tt_name_record *name, LANGID lang)
static const WCHAR lang[]
int WINAPI GetTextFaceW(_In_ HDC hdc, _In_ int c, _Out_writes_to_opt_(c, return) LPWSTR lpName)
GpStatus WINGDIPAPI GdipCreateFontFromLogfontA(HDC hdc, GDIPCONST LOGFONTA *lfa, GpFont **font)
#define TT_PLATFORM_MACINTOSH
static INT CALLBACK is_font_installed_proc(const LOGFONTW *elf, const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
#define CreateFileMappingW(a, b, c, d, e, f)
#define NAME_ID_FULL_FONT_NAME
GpStatus WINGDIPAPI GdipGetLineSpacing(GDIPCONST GpFontFamily *family, INT style, UINT16 *LineSpacing)
GpStatus WINGDIPAPI GdipPrivateAddFontFile(GpFontCollection *collection, GDIPCONST WCHAR *name)
LANGID WINAPI GetSystemDefaultLangID(void)
#define OUT_DEFAULT_PRECIS
GLenum GLenum GLenum GLenum mapping
GpStatus WINGDIPAPI GdipGetFontHeight(GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, REAL *height)
GpStatus WINGDIPAPI GdipCloneFont(GpFont *font, GpFont **cloneFont)
GpStatus WINGDIPAPI GdipGetCellDescent(GDIPCONST GpFontFamily *family, INT style, UINT16 *CellDescent)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GpStatus WINGDIPAPI GdipGetFontCollectionFamilyList(GpFontCollection *fontCollection, INT numSought, GpFontFamily *gpfamilies[], INT *numFound)
GpStatus WINGDIPAPI GdipDeleteFontFamily(GpFontFamily *FontFamily)
GpStatus WINGDIPAPI GdipGetFontStyle(GpFont *font, INT *style)
SHORT ySuperscriptXOffset
static GpStatus find_installed_font(const WCHAR *name, struct font_metrics *fm)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
#define memcpy(s1, s2, n)
static int font_height(HFONT hFont)
REAL gdiplus_atan2(REAL dy, REAL dx)
#define LANG_CHINESE_TRADITIONAL
static FT_F26Dot6 font_size
static WORD get_mac_code_page(const tt_name_record *name)
WCHAR elfFullName[LF_FULLFACESIZE]
GpStatus WINGDIPAPI GdipGetGenericFontFamilySerif(GpFontFamily **nativeFamily)
#define SUBLANG_AZERI_LATIN
GpStatus WINGDIPAPI GdipGetFontCollectionFamilyCount(GpFontCollection *fontCollection, INT *numFound)
GLint GLint GLsizei GLsizei height
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count)
static const LANGID mac_langid_table[]
GpStatus WINGDIPAPI GdipGetFamilyName(GDIPCONST GpFontFamily *family, WCHAR *name, LANGID language)
#define TT_MS_ID_SYMBOL_CS
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
static INT CALLBACK font_has_style_proc(const LOGFONTW *elf, const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
BOOL WINAPI IsValidCodePage(UINT CodePage)
static const WORD INT INT LPINT LPINT LPSIZE size
WCHAR facename[LF_FACESIZE]
GpStatus WINGDIPAPI GdipIsStyleAvailable(GDIPCONST GpFontFamily *family, INT style, BOOL *IsStyleAvailable)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
BOOL WINAPI DeleteDC(_In_ HDC)
static ICollection collection
#define FIELD_OFFSET(t, f)
GpStatus WINGDIPAPI GdipCloneFontFamily(GpFontFamily *FontFamily, GpFontFamily **clonedFontFamily)
GpStatus WINGDIPAPI GdipNewPrivateFontCollection(GpFontCollection **fontCollection)
#define SUBLANG_IRISH_IRELAND
GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi, REAL *height)
TEXTMETRICW otmTextMetrics
GpFontCollection * collection
GpStatus WINGDIPAPI GdipGetFamily(GpFont *font, GpFontFamily **family)
#define MultiByteToWideChar
GpStatus WINGDIPAPI GdipPrivateAddMemoryFont(GpFontCollection *fontCollection, GDIPCONST void *memory, INT length)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static const WCHAR Tahoma[]
WCHAR lfFaceName[LF_FACESIZE]
CHAR lfFaceName[LF_FACESIZE]
#define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA
static GpStatus clone_font_family(const GpFontFamily *, GpFontFamily **)
REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi)
static WCHAR * load_ttf_name_id(const BYTE *mem, DWORD_PTR size, DWORD id)
GLuint GLuint GLsizei GLenum type
GpStatus WINGDIPAPI GdipNewInstalledFontCollection(GpFontCollection **fontCollection)
GpStatus WINGDIPAPI GdipDeletePrivateFontCollection(GpFontCollection **fontCollection)
#define TT_MAC_ID_SIMPLIFIED_CHINESE
static INT get_font_style(const GpFont *font)
static SERVICE_STATUS status
GpStatus WINGDIPAPI GdipGetEmHeight(GDIPCONST GpFontFamily *family, INT style, UINT16 *EmHeight)
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
static BOOL heap_free(void *mem)
GLuint const GLchar * name