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);
1459 pos = ofs +
sizeof(*name_table);
1469 pos +=
sizeof(*name_record);
1478 if (
res > best_lang)
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)
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define INVALID_HANDLE_VALUE
#define CreateFileMappingW(a, b, c, d, e, f)
#define WideCharToMultiByte
#define MultiByteToWideChar
#define TT_APPLE_ID_ISO_10646
GpStatus WINGDIPAPI GdipGetFontSize(GpFont *font, REAL *size)
GpStatus WINGDIPAPI GdipGetFontHeight(GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, REAL *height)
static WORD get_mac_code_page(const tt_name_record *name)
#define NAME_ID_FULL_FONT_NAME
GpStatus WINGDIPAPI GdipDeleteFontFamily(GpFontFamily *FontFamily)
GpStatus WINGDIPAPI GdipGetFamily(GpFont *font, GpFontFamily **family)
static INT get_font_style(const GpFont *font)
static GpStatus clone_font_family(const GpFontFamily *, GpFontFamily **)
GpStatus WINGDIPAPI GdipDeleteFont(GpFont *font)
static WCHAR * load_ttf_name_id(const BYTE *mem, DWORD_PTR size, DWORD id)
GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc, GDIPCONST LOGFONTW *logfont, GpFont **font)
static BOOL get_font_metrics(HDC hdc, struct font_metrics *fm)
GpStatus WINGDIPAPI GdipCreateFontFromLogfontA(HDC hdc, GDIPCONST LOGFONTA *lfa, GpFont **font)
GpStatus WINGDIPAPI GdipGetLogFontA(GpFont *font, GpGraphics *graphics, LOGFONTA *lfa)
#define TT_MAC_ID_SIMPLIFIED_CHINESE
GpStatus WINGDIPAPI GdipCreateFontFromDC(HDC hdc, GpFont **font)
GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, GpFontCollection *fontCollection, GpFontFamily **FontFamily)
GpStatus WINGDIPAPI GdipGetGenericFontFamilySerif(GpFontFamily **nativeFamily)
GpStatus WINGDIPAPI GdipGetCellDescent(GDIPCONST GpFontFamily *family, INT style, UINT16 *CellDescent)
GpStatus WINGDIPAPI GdipNewInstalledFontCollection(GpFontCollection **fontCollection)
GpStatus WINGDIPAPI GdipGetFontStyle(GpFont *font, INT *style)
GpStatus WINGDIPAPI GdipGetFontCollectionFamilyCount(GpFontCollection *fontCollection, INT *numFound)
#define TT_MS_ID_UNICODE_CS
#define TT_PLATFORM_MICROSOFT
GpStatus WINGDIPAPI GdipPrivateAddMemoryFont(GpFontCollection *fontCollection, GDIPCONST void *memory, INT length)
static WCHAR * copy_name_table_string(const tt_name_record *name, const BYTE *data)
void free_installed_fonts(void)
static GpFontCollection installedFontCollection
GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
GpStatus WINGDIPAPI GdipGetGenericFontFamilySansSerif(GpFontFamily **nativeFamily)
GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily, REAL emSize, INT style, Unit unit, GpFont **font)
#define TT_APPLE_ID_DEFAULT
GpStatus WINGDIPAPI GdipGetCellAscent(GDIPCONST GpFontFamily *family, INT style, UINT16 *CellAscent)
#define TT_APPLE_ID_UNICODE_2_0
#define TT_PLATFORM_MACINTOSH
GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi, REAL *height)
#define TT_MS_ID_SYMBOL_CS
GpStatus WINGDIPAPI GdipGetFontCollectionFamilyList(GpFontCollection *fontCollection, INT numSought, GpFontFamily *gpfamilies[], INT *numFound)
GpStatus WINGDIPAPI GdipGetFontUnit(GpFont *font, Unit *unit)
GpStatus WINGDIPAPI GdipGetLineSpacing(GDIPCONST GpFontFamily *family, INT style, UINT16 *LineSpacing)
GpStatus WINGDIPAPI GdipDeletePrivateFontCollection(GpFontCollection **fontCollection)
static INT CALLBACK is_font_installed_proc(const LOGFONTW *elf, const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
static int match_name_table_language(const tt_name_record *name, LANGID lang)
GpStatus WINGDIPAPI GdipGetGenericFontFamilyMonospace(GpFontFamily **nativeFamily)
GpStatus WINGDIPAPI GdipIsStyleAvailable(GDIPCONST GpFontFamily *family, INT style, BOOL *IsStyleAvailable)
GpStatus WINGDIPAPI GdipGetFamilyName(GDIPCONST GpFontFamily *family, WCHAR *name, LANGID language)
#define TT_PLATFORM_APPLE_UNICODE
GpStatus WINGDIPAPI GdipGetEmHeight(GDIPCONST GpFontFamily *family, INT style, UINT16 *EmHeight)
static REAL get_font_size(const GpFont *font)
GpStatus WINGDIPAPI GdipCloneFont(GpFont *font, GpFont **cloneFont)
GpStatus WINGDIPAPI GdipPrivateAddFontFile(GpFontCollection *collection, GDIPCONST WCHAR *name)
static INT CALLBACK font_has_style_proc(const LOGFONTW *elf, const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
GpStatus WINGDIPAPI GdipNewPrivateFontCollection(GpFontCollection **fontCollection)
static GpStatus find_installed_font(const WCHAR *name, struct font_metrics *fm)
static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
GpStatus WINGDIPAPI GdipCloneFontFamily(GpFontFamily *FontFamily, GpFontFamily **clonedFontFamily)
static const LANGID mac_langid_table[]
GpStatus WINGDIPAPI GdipGetDpiY(GpGraphics *graphics, REAL *dpi)
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count)
LANGID WINAPI GetSystemDefaultLangID(void)
BOOL WINAPI IsValidCodePage(UINT codepage)
static FT_F26Dot6 font_size
REAL gdiplus_atan2(REAL dy, REAL dx)
REAL pixels_to_units(REAL pixels, GpUnit unit, REAL dpi)
REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi)
static INT gdip_round(REAL x)
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLsizei height
GLuint GLsizei GLsizei * length
GLenum GLenum GLenum GLenum mapping
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
#define memcpy(s1, s2, n)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static const WCHAR Tahoma[]
static const WCHAR TimesNewRoman[]
static char memory[1024 *256]
static ICollection collection
static int font_height(HFONT hFont)
#define LANG_SCOTTISH_GAELIC
png_const_structrp png_const_inforp int * unit
#define SUBLANG_DUTCH_BELGIAN
#define LANG_CHINESE_SIMPLIFIED
#define LANG_CHINESE_TRADITIONAL
#define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA
#define SUBLANG_AZERI_CYRILLIC
#define SUBLANG_IRISH_IRELAND
#define SUBLANG_AZERI_LATIN
GpFontFamily ** FontFamilies
WCHAR FamilyName[LF_FACESIZE]
CHAR lfFaceName[LF_FACESIZE]
WCHAR lfFaceName[LF_FACESIZE]
SHORT minRightSideBearing
SHORT ySuperscriptYOffset
SHORT ySuperscriptXOffset
TEXTMETRICW otmTextMetrics
GpFontCollection * collection
WCHAR facename[LF_FACESIZE]
WCHAR elfFullName[LF_FULLFACESIZE]
#define FIELD_OFFSET(t, f)
static const WCHAR lang[]
DWORD WINAPI GetFontData(HDC hdc, DWORD dwTable, DWORD dwOffset, LPVOID lpvBuffer, DWORD cbData)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
int WINAPI EnumFontFamiliesExW(_In_ HDC, _In_ PLOGFONTW, _In_ FONTENUMPROCW, _In_ LPARAM, _In_ DWORD)
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
int WINAPI EnumFontFamiliesW(_In_ HDC, _In_opt_ LPCWSTR, _In_ FONTENUMPROCW, _In_ LPARAM)
int WINAPI GetTextFaceW(_In_ HDC hdc, _In_ int c, _Out_writes_to_opt_(c, return) LPWSTR lpName)
#define OUT_DEFAULT_PRECIS
#define CLIP_DEFAULT_PRECIS
UINT WINAPI GetOutlineTextMetricsW(_In_ HDC hdc, _In_ UINT cjCopy, _Out_writes_bytes_opt_(cjCopy) LPOUTLINETEXTMETRICW potm)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
BOOL WINAPI DeleteDC(_In_ HDC)
HANDLE WINAPI AddFontMemResourceEx(_In_reads_bytes_(cjSize) PVOID pvFileView, _In_ DWORD cjSize, _Reserved_ PVOID pvResrved, _In_ DWORD *pNumFonts)