X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fdll%2Fwin32%2Fgdi32%2Fobjects%2Ffont.c;h=2090b9ad1a82f9b93744989a1a871048eaa1fb29;hp=55c98ee0a41544d011e5db5dc95a1062254c37fb;hb=a8c547f0917445018f3fd0849c04d8baabc01afe;hpb=de36e54946aedae8a42416bb68e5ba007a7cf8bf diff --git a/reactos/dll/win32/gdi32/objects/font.c b/reactos/dll/win32/gdi32/objects/font.c index 55c98ee0a41..2090b9ad1a8 100644 --- a/reactos/dll/win32/gdi32/objects/font.c +++ b/reactos/dll/win32/gdi32/objects/font.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * FILE: lib/gdi32/object/font.c @@ -16,46 +15,45 @@ /* * For TranslateCharsetInfo */ -#define FS(x) {{0,0,0,0},{0x1<<(x),0}} #define MAXTCIINDEX 32 static const CHARSETINFO FONT_tci[MAXTCIINDEX] = { /* ANSI */ - { ANSI_CHARSET, 1252, FS(0)}, - { EASTEUROPE_CHARSET, 1250, FS(1)}, - { RUSSIAN_CHARSET, 1251, FS(2)}, - { GREEK_CHARSET, 1253, FS(3)}, - { TURKISH_CHARSET, 1254, FS(4)}, - { HEBREW_CHARSET, 1255, FS(5)}, - { ARABIC_CHARSET, 1256, FS(6)}, - { BALTIC_CHARSET, 1257, FS(7)}, - { VIETNAMESE_CHARSET, 1258, FS(8)}, + { ANSI_CHARSET, 1252, {{0,0,0,0},{FS_LATIN1,0}} }, + { EASTEUROPE_CHARSET, 1250, {{0,0,0,0},{FS_LATIN2,0}} }, + { RUSSIAN_CHARSET, 1251, {{0,0,0,0},{FS_CYRILLIC,0}} }, + { GREEK_CHARSET, 1253, {{0,0,0,0},{FS_GREEK,0}} }, + { TURKISH_CHARSET, 1254, {{0,0,0,0},{FS_TURKISH,0}} }, + { HEBREW_CHARSET, 1255, {{0,0,0,0},{FS_HEBREW,0}} }, + { ARABIC_CHARSET, 1256, {{0,0,0,0},{FS_ARABIC,0}} }, + { BALTIC_CHARSET, 1257, {{0,0,0,0},{FS_BALTIC,0}} }, + { VIETNAMESE_CHARSET, 1258, {{0,0,0,0},{FS_VIETNAMESE,0}} }, /* reserved by ANSI */ - { DEFAULT_CHARSET, 0, FS(0)}, - { DEFAULT_CHARSET, 0, FS(0)}, - { DEFAULT_CHARSET, 0, FS(0)}, - { DEFAULT_CHARSET, 0, FS(0)}, - { DEFAULT_CHARSET, 0, FS(0)}, - { DEFAULT_CHARSET, 0, FS(0)}, - { DEFAULT_CHARSET, 0, FS(0)}, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, /* ANSI and OEM */ - { THAI_CHARSET, 874, FS(16)}, - { SHIFTJIS_CHARSET, 932, FS(17)}, - { GB2312_CHARSET, 936, FS(18)}, - { HANGEUL_CHARSET, 949, FS(19)}, - { CHINESEBIG5_CHARSET, 950, FS(20)}, - { JOHAB_CHARSET, 1361, FS(21)}, + { THAI_CHARSET, 874, {{0,0,0,0},{FS_THAI,0}} }, + { SHIFTJIS_CHARSET, 932, {{0,0,0,0},{FS_JISJAPAN,0}} }, + { GB2312_CHARSET, 936, {{0,0,0,0},{FS_CHINESESIMP,0}} }, + { HANGEUL_CHARSET, 949, {{0,0,0,0},{FS_WANSUNG,0}} }, + { CHINESEBIG5_CHARSET, 950, {{0,0,0,0},{FS_CHINESETRAD,0}} }, + { JOHAB_CHARSET, 1361, {{0,0,0,0},{FS_JOHAB,0}} }, /* reserved for alternate ANSI and OEM */ - { DEFAULT_CHARSET, 0, FS(0)}, - { DEFAULT_CHARSET, 0, FS(0)}, - { DEFAULT_CHARSET, 0, FS(0)}, - { DEFAULT_CHARSET, 0, FS(0)}, - { DEFAULT_CHARSET, 0, FS(0)}, - { DEFAULT_CHARSET, 0, FS(0)}, - { DEFAULT_CHARSET, 0, FS(0)}, - { DEFAULT_CHARSET, 0, FS(0)}, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, /* reserved for system */ - { DEFAULT_CHARSET, 0, FS(0)}, - { SYMBOL_CHARSET, CP_SYMBOL, FS(31)}, + { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} }, + { SYMBOL_CHARSET, CP_SYMBOL, {{0,0,0,0},{FS_SYMBOL,0}} } }; #define INITIAL_FAMILY_COUNT 64 @@ -63,7 +61,9 @@ static const CHARSETINFO FONT_tci[MAXTCIINDEX] = { /*********************************************************************** * TEXTMETRIC conversion functions. */ -static void FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA ) +VOID +FASTCALL +FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA ) { ptmA->tmHeight = ptmW->tmHeight; ptmA->tmAscent = ptmW->tmAscent; @@ -76,10 +76,19 @@ static void FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA ) ptmA->tmOverhang = ptmW->tmOverhang; ptmA->tmDigitizedAspectX = ptmW->tmDigitizedAspectX; ptmA->tmDigitizedAspectY = ptmW->tmDigitizedAspectY; - ptmA->tmFirstChar = ptmW->tmFirstChar > 255 ? 255 : ptmW->tmFirstChar; - ptmA->tmLastChar = ptmW->tmLastChar > 255 ? 255 : ptmW->tmLastChar; - ptmA->tmDefaultChar = ptmW->tmDefaultChar > 255 ? 255 : ptmW->tmDefaultChar; - ptmA->tmBreakChar = ptmW->tmBreakChar > 255 ? 255 : ptmW->tmBreakChar; + ptmA->tmFirstChar = min(ptmW->tmFirstChar, 255); + if (ptmW->tmCharSet == SYMBOL_CHARSET) + { + ptmA->tmFirstChar = 0x1e; + ptmA->tmLastChar = 0xff; /* win9x behaviour - we need the OS2 table data to calculate correctly */ + } + else + { + ptmA->tmFirstChar = ptmW->tmDefaultChar - 1; + ptmA->tmLastChar = min(ptmW->tmLastChar, 0xff); + } + ptmA->tmDefaultChar = ptmW->tmDefaultChar; + ptmA->tmBreakChar = ptmW->tmBreakChar; ptmA->tmItalic = ptmW->tmItalic; ptmA->tmUnderlined = ptmW->tmUnderlined; ptmA->tmStruckOut = ptmW->tmStruckOut; @@ -101,182 +110,37 @@ static void FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA ) */ static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP) { - UINT cp = CP_ACP; // GdiGetCodePage( hdc ); + UINT cp = GdiGetCodePage( hdc ); INT lenW; LPWSTR strW; if(count == -1) count = strlen(str); lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0); strW = HeapAlloc(GetProcessHeap(), 0, lenW*sizeof(WCHAR)); + if (!strW) + return NULL; MultiByteToWideChar(cp, 0, str, count, strW, lenW); - DPRINT1("mapped %s -> %s \n", str, strW); + DPRINT("mapped %s -> %S\n", str, strW); if(plenW) *plenW = lenW; if(pCP) *pCP = cp; return strW; } - -static BOOL FASTCALL -MetricsCharConvert(WCHAR w, UCHAR *b) - { - UNICODE_STRING WString; - WCHAR WBuf[2]; - ANSI_STRING AString; - CHAR ABuf[2]; - NTSTATUS Status; - - if (L'\0' == w) - { - *b = '\0'; - } - else - { - WBuf[0] = w; - WBuf[1] = L'\0'; - RtlInitUnicodeString(&WString, WBuf); - ABuf[0] = '*'; - ABuf[1] = L'\0'; - RtlInitAnsiString(&AString, ABuf); - - Status = RtlUnicodeStringToAnsiString(&AString, &WString, FALSE); - if (! NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - *b = ABuf[0]; - } - - return TRUE; -} - -BOOL FASTCALL -TextMetricW2A(TEXTMETRICA *tma, TEXTMETRICW *tmw) -{ - UNICODE_STRING WString; - WCHAR WBuf[256]; - ANSI_STRING AString; - CHAR ABuf[256]; - UINT Letter; - NTSTATUS Status; - - tma->tmHeight = tmw->tmHeight; - tma->tmAscent = tmw->tmAscent; - tma->tmDescent = tmw->tmDescent; - tma->tmInternalLeading = tmw->tmInternalLeading; - tma->tmExternalLeading = tmw->tmExternalLeading; - tma->tmAveCharWidth = tmw->tmAveCharWidth; - tma->tmMaxCharWidth = tmw->tmMaxCharWidth; - tma->tmWeight = tmw->tmWeight; - tma->tmOverhang = tmw->tmOverhang; - tma->tmDigitizedAspectX = tmw->tmDigitizedAspectX; - tma->tmDigitizedAspectY = tmw->tmDigitizedAspectY; - - /* The Unicode FirstChar/LastChar need not correspond to the ANSI - FirstChar/LastChar. For example, if the font contains glyphs for - letters A-Z and an accented version of the letter e, the Unicode - FirstChar would be A and the Unicode LastChar would be the accented - e. If you just translate those to ANSI, the range would become - letters A-E instead of A-Z. - We translate all possible ANSI chars to Unicode and find the first - and last translated character which fall into the Unicode FirstChar/ - LastChar range and return the corresponding ANSI char. */ - - /* Setup an Ansi string containing all possible letters (note: skip '\0' at - the beginning since that would be interpreted as end-of-string, handle - '\0' special later */ - for (Letter = 1; Letter < 256; Letter++) - { - ABuf[Letter - 1] = (CHAR) Letter; - WBuf[Letter - 1] = L' '; - } - ABuf[255] = '\0'; - WBuf[255] = L'\0'; - RtlInitAnsiString(&AString, ABuf); - RtlInitUnicodeString(&WString, WBuf); - - /* Find the corresponding Unicode characters */ - Status = RtlAnsiStringToUnicodeString(&WString, &AString, FALSE); - if (! NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - /* Scan for the first ANSI character which maps to an Unicode character - in the range */ - tma->tmFirstChar = '\0'; - if (L'\0' != tmw->tmFirstChar) - { - for (Letter = 1; Letter < 256; Letter++) - { - if (tmw->tmFirstChar <= WBuf[Letter - 1] && - WBuf[Letter - 1] <= tmw->tmLastChar) - { - tma->tmFirstChar = (CHAR) Letter; - break; - } - } - } - - /* Scan for the last ANSI character which maps to an Unicode character - in the range */ - tma->tmLastChar = '\0'; - if (L'\0' != tmw->tmLastChar) - { - for (Letter = 255; 0 < Letter; Letter--) - { - if (tmw->tmFirstChar <= WBuf[Letter - 1] && - WBuf[Letter - 1] <= tmw->tmLastChar) - { - tma->tmLastChar = (CHAR) Letter; - break; - } - } - } - - if (! MetricsCharConvert(tmw->tmDefaultChar, &tma->tmDefaultChar) || - ! MetricsCharConvert(tmw->tmBreakChar, &tma->tmBreakChar)) - { - return FALSE; - } - - tma->tmItalic = tmw->tmItalic; - tma->tmUnderlined = tmw->tmUnderlined; - tma->tmStruckOut = tmw->tmStruckOut; - tma->tmPitchAndFamily = tmw->tmPitchAndFamily; - tma->tmCharSet = tmw->tmCharSet; - - return TRUE; -} - -BOOL FASTCALL +VOID FASTCALL NewTextMetricW2A(NEWTEXTMETRICA *tma, NEWTEXTMETRICW *tmw) { - if (! TextMetricW2A((TEXTMETRICA *) tma, (TEXTMETRICW *) tmw)) - { - return FALSE; - } - + FONT_TextMetricWToA((TEXTMETRICW *) tmw, (TEXTMETRICA *) tma); tma->ntmFlags = tmw->ntmFlags; tma->ntmSizeEM = tmw->ntmSizeEM; tma->ntmCellHeight = tmw->ntmCellHeight; tma->ntmAvgWidth = tmw->ntmAvgWidth; - - return TRUE; } -BOOL FASTCALL +VOID FASTCALL NewTextMetricExW2A(NEWTEXTMETRICEXA *tma, NEWTEXTMETRICEXW *tmw) { - if (! NewTextMetricW2A(&tma->ntmTm, &tmw->ntmTm)) - { - return FALSE; - } - + NewTextMetricW2A(&tma->ntmTm, &tmw->ntmTm); tma->ntmFontSig = tmw->ntmFontSig; - - return TRUE; } static int FASTCALL @@ -290,6 +154,7 @@ IntEnumFontFamilies(HDC Dc, LPLOGFONTW LogFont, PVOID EnumProc, LPARAM lParam, int i; ENUMLOGFONTEXA EnumLogFontExA; NEWTEXTMETRICEXA NewTextMetricExA; + LOGFONTW lfW; Info = RtlAllocateHeap(GetProcessHeap(), 0, INITIAL_FAMILY_COUNT * sizeof(FONTFAMILYINFO)); @@ -297,6 +162,15 @@ IntEnumFontFamilies(HDC Dc, LPLOGFONTW LogFont, PVOID EnumProc, LPARAM lParam, { return 0; } + + if (!LogFont) + { + lfW.lfCharSet = DEFAULT_CHARSET; + lfW.lfPitchAndFamily = 0; + lfW.lfFaceName[0] = 0; + LogFont = &lfW; + } + FontFamilyCount = NtGdiGetFontFamilyInfo(Dc, LogFont, Info, INITIAL_FAMILY_COUNT); if (FontFamilyCount < 0) { @@ -326,8 +200,8 @@ IntEnumFontFamilies(HDC Dc, LPLOGFONTW LogFont, PVOID EnumProc, LPARAM lParam, if (Unicode) { Ret = ((FONTENUMPROCW) EnumProc)( - &Info[i].EnumLogFontEx, - &Info[i].NewTextMetricEx, + (VOID*)&Info[i].EnumLogFontEx, + (VOID*)&Info[i].NewTextMetricEx, Info[i].FontType, lParam); } else @@ -342,8 +216,8 @@ IntEnumFontFamilies(HDC Dc, LPLOGFONTW LogFont, PVOID EnumProc, LPARAM lParam, NewTextMetricExW2A(&NewTextMetricExA, &Info[i].NewTextMetricEx); Ret = ((FONTENUMPROCA) EnumProc)( - &EnumLogFontExA, - &NewTextMetricExA, + (VOID*)&EnumLogFontExA, + (VOID*)&NewTextMetricExA, Info[i].FontType, lParam); } } @@ -356,7 +230,7 @@ IntEnumFontFamilies(HDC Dc, LPLOGFONTW LogFont, PVOID EnumProc, LPARAM lParam, /* * @implemented */ -int STDCALL +int WINAPI EnumFontFamiliesExW(HDC hdc, LPLOGFONTW lpLogfont, FONTENUMPROCW lpEnumFontFamExProc, LPARAM lParam, DWORD dwFlags) { @@ -367,7 +241,7 @@ EnumFontFamiliesExW(HDC hdc, LPLOGFONTW lpLogfont, FONTENUMPROCW lpEnumFontFamEx /* * @implemented */ -int STDCALL +int WINAPI EnumFontFamiliesW(HDC hdc, LPCWSTR lpszFamily, FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam) { @@ -377,6 +251,7 @@ EnumFontFamiliesW(HDC hdc, LPCWSTR lpszFamily, FONTENUMPROCW lpEnumFontFamProc, LogFont.lfCharSet = DEFAULT_CHARSET; if (NULL != lpszFamily) { + if (!*lpszFamily) return 1; lstrcpynW(LogFont.lfFaceName, lpszFamily, LF_FACESIZE); } @@ -387,23 +262,28 @@ EnumFontFamiliesW(HDC hdc, LPCWSTR lpszFamily, FONTENUMPROCW lpEnumFontFamProc, /* * @implemented */ -int STDCALL +int WINAPI EnumFontFamiliesExA (HDC hdc, LPLOGFONTA lpLogfont, FONTENUMPROCA lpEnumFontFamExProc, LPARAM lParam, DWORD dwFlags) { - LOGFONTW LogFontW; + LOGFONTW LogFontW, *pLogFontW; - LogFontA2W(&LogFontW, lpLogfont); + if (lpLogfont) + { + LogFontA2W(&LogFontW,lpLogfont); + pLogFontW = &LogFontW; + } + else pLogFontW = NULL; /* no need to convert LogFontW back to lpLogFont b/c it's an [in] parameter only */ - return IntEnumFontFamilies(hdc, &LogFontW, lpEnumFontFamExProc, lParam, FALSE); + return IntEnumFontFamilies(hdc, pLogFontW, lpEnumFontFamExProc, lParam, FALSE); } /* * @implemented */ -int STDCALL +int WINAPI EnumFontFamiliesA(HDC hdc, LPCSTR lpszFamily, FONTENUMPROCA lpEnumFontFamProc, LPARAM lParam) { @@ -413,17 +293,81 @@ EnumFontFamiliesA(HDC hdc, LPCSTR lpszFamily, FONTENUMPROCA lpEnumFontFamProc, LogFont.lfCharSet = DEFAULT_CHARSET; if (NULL != lpszFamily) { + if (!*lpszFamily) return 1; MultiByteToWideChar(CP_THREAD_ACP, 0, lpszFamily, -1, LogFont.lfFaceName, LF_FACESIZE); } return IntEnumFontFamilies(hdc, &LogFont, lpEnumFontFamProc, lParam, FALSE); } + +/* + * @implemented + */ +DWORD +WINAPI +GetCharacterPlacementA( + HDC hdc, + LPCSTR lpString, + INT uCount, + INT nMaxExtent, + GCP_RESULTSA *lpResults, + DWORD dwFlags) +{ + WCHAR *lpStringW; + INT uCountW; + GCP_RESULTSW resultsW; + DWORD ret; + UINT font_cp; + + if ( !lpString || uCount <= 0 || (nMaxExtent < 0 && nMaxExtent != -1 ) ) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } +/* TRACE("%s, %d, %d, 0x%08x\n", + debugstr_an(lpString, uCount), uCount, nMaxExtent, dwFlags); +*/ + /* both structs are equal in size */ + memcpy(&resultsW, lpResults, sizeof(resultsW)); + + lpStringW = FONT_mbtowc(hdc, lpString, uCount, &uCountW, &font_cp); + if (lpStringW == NULL) + { + return 0; + } + if(lpResults->lpOutString) + { + resultsW.lpOutString = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*uCountW); + if (resultsW.lpOutString == NULL) + { + HeapFree(GetProcessHeap(), 0, lpStringW); + return 0; + } + } + + ret = GetCharacterPlacementW(hdc, lpStringW, uCountW, nMaxExtent, &resultsW, dwFlags); + + lpResults->nGlyphs = resultsW.nGlyphs; + lpResults->nMaxFit = resultsW.nMaxFit; + + if(lpResults->lpOutString) { + WideCharToMultiByte(font_cp, 0, resultsW.lpOutString, uCountW, + lpResults->lpOutString, uCount, NULL, NULL ); + } + + HeapFree(GetProcessHeap(), 0, lpStringW); + HeapFree(GetProcessHeap(), 0, resultsW.lpOutString); + + return ret; +} + + /* * @implemented */ DWORD -STDCALL +WINAPI GetCharacterPlacementW( HDC hdc, LPCWSTR lpString, @@ -501,18 +445,59 @@ GetCharacterPlacementW( return ret; } +DWORD +WINAPI +NewGetCharacterPlacementW( + HDC hdc, + LPCWSTR lpString, + INT uCount, + INT nMaxExtent, + GCP_RESULTSW *lpResults, + DWORD dwFlags + ) +{ + INT nSet; + SIZE Size = {0,0}; + + if ( !lpString || uCount <= 0 || (nMaxExtent < 0 && nMaxExtent != -1 ) ) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + if ( !lpResults ) + { + if ( GetTextExtentPointW(hdc, lpString, uCount, &Size) ) + { + return MAKELONG(Size.cx, Size.cy); + } + return 0; + } + + nSet = uCount; + if ( nSet > lpResults->nGlyphs ) + nSet = lpResults->nGlyphs; + + return NtGdiGetCharacterPlacementW( hdc, + (LPWSTR)lpString, + nSet, + nMaxExtent, + lpResults, + dwFlags); +} + /* * @implemented * */ BOOL -STDCALL +WINAPI GetCharABCWidthsFloatW(HDC hdc, UINT FirstChar, UINT LastChar, LPABCFLOAT abcF) { -DPRINT("GetCharABCWidthsFloatW\n"); + DPRINT("GetCharABCWidthsFloatW\n"); if ((!abcF) || (FirstChar > LastChar)) { SetLastError(ERROR_INVALID_PARAMETER); @@ -531,13 +516,13 @@ DPRINT("GetCharABCWidthsFloatW\n"); * */ BOOL -STDCALL +WINAPI GetCharWidthFloatW(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBuffer) { -DPRINT("GetCharWidthsFloatW\n"); + DPRINT("GetCharWidthsFloatW\n"); if ((!pxBuffer) || (iFirstChar > iLastChar)) { SetLastError(ERROR_INVALID_PARAMETER); @@ -547,7 +532,7 @@ DPRINT("GetCharWidthsFloatW\n"); iFirstChar, (ULONG)(iLastChar - iFirstChar + 1), (PWCHAR) NULL, - 0, + 0, (PVOID) pxBuffer); } @@ -556,13 +541,13 @@ DPRINT("GetCharWidthsFloatW\n"); * */ BOOL -STDCALL +WINAPI GetCharWidthW(HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer) { -DPRINT("GetCharWidthsW\n"); + DPRINT("GetCharWidthsW\n"); if ((!lpBuffer) || (iFirstChar > iLastChar)) { SetLastError(ERROR_INVALID_PARAMETER); @@ -581,13 +566,13 @@ DPRINT("GetCharWidthsW\n"); * */ BOOL -STDCALL +WINAPI GetCharWidth32W(HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer) { -DPRINT("GetCharWidths32W\n"); + DPRINT("GetCharWidths32W\n"); if ((!lpBuffer) || (iFirstChar > iLastChar)) { SetLastError(ERROR_INVALID_PARAMETER); @@ -607,13 +592,13 @@ DPRINT("GetCharWidths32W\n"); * */ BOOL -STDCALL +WINAPI GetCharABCWidthsW(HDC hdc, UINT FirstChar, UINT LastChar, LPABC lpabc) { -DPRINT("GetCharABCWidthsW\n"); + DPRINT("GetCharABCWidthsW\n"); if ((!lpabc) || (FirstChar > LastChar)) { SetLastError(ERROR_INVALID_PARAMETER); @@ -631,7 +616,7 @@ DPRINT("GetCharABCWidthsW\n"); * @implemented */ BOOL -STDCALL +WINAPI GetCharWidthA( HDC hdc, UINT iFirstChar, @@ -639,26 +624,35 @@ GetCharWidthA( LPINT lpBuffer ) { -DPRINT("GetCharWidthsA\n"); INT i, wlen, count = (INT)(iLastChar - iFirstChar + 1); LPSTR str; LPWSTR wstr; BOOL ret = TRUE; + DPRINT("GetCharWidthsA\n"); if(count <= 0) return FALSE; - str = HeapAlloc(GetProcessHeap(), 0, count); + str = HeapAlloc(GetProcessHeap(), 0, count+1); + if (!str) + return FALSE; + for(i = 0; i < count; i++) - str[i] = (BYTE)(iFirstChar + i); + str[i] = (BYTE)(iFirstChar + i); + str[i] = '\0'; - wstr = FONT_mbtowc(NULL, str, count, &wlen, NULL); + wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL); + if (!wstr) + { + HeapFree(GetProcessHeap(), 0, str); + return FALSE; + } ret = NtGdiGetCharWidthW( hdc, wstr[0], - (ULONG) count, - (PWCHAR) wstr, - GCW_NOFLOAT, - (PVOID) lpBuffer); + (ULONG) count, + (PWCHAR) wstr, + GCW_NOFLOAT, + (PVOID) lpBuffer); HeapFree(GetProcessHeap(), 0, str); HeapFree(GetProcessHeap(), 0, wstr); @@ -670,7 +664,7 @@ DPRINT("GetCharWidthsA\n"); * @implemented */ BOOL -STDCALL +WINAPI GetCharWidth32A( HDC hdc, UINT iFirstChar, @@ -678,26 +672,34 @@ GetCharWidth32A( LPINT lpBuffer ) { -DPRINT("GetCharWidths32A\n"); INT i, wlen, count = (INT)(iLastChar - iFirstChar + 1); LPSTR str; LPWSTR wstr; BOOL ret = TRUE; + DPRINT("GetCharWidths32A\n"); if(count <= 0) return FALSE; - str = HeapAlloc(GetProcessHeap(), 0, count); + str = HeapAlloc(GetProcessHeap(), 0, count+1); + if (!str) + return FALSE; for(i = 0; i < count; i++) - str[i] = (BYTE)(iFirstChar + i); + str[i] = (BYTE)(iFirstChar + i); + str[i] = '\0'; - wstr = FONT_mbtowc(NULL, str, count, &wlen, NULL); + wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL); + if (!wstr) + { + HeapFree(GetProcessHeap(), 0, str); + return FALSE; + } ret = NtGdiGetCharWidthW( hdc, wstr[0], - (ULONG) count, - (PWCHAR) wstr, - GCW_NOFLOAT|GCW_WIN32, - (PVOID) lpBuffer); + (ULONG) count, + (PWCHAR) wstr, + GCW_NOFLOAT|GCW_WIN32, + (PVOID) lpBuffer); HeapFree(GetProcessHeap(), 0, str); HeapFree(GetProcessHeap(), 0, wstr); @@ -717,20 +719,27 @@ GetCharWidthFloatA( PFLOAT pxBuffer ) { -DPRINT("GetCharWidthsFloatA\n"); INT i, wlen, count = (INT)(iLastChar - iFirstChar + 1); LPSTR str; LPWSTR wstr; BOOL ret = TRUE; + DPRINT("GetCharWidthsFloatA\n"); if(count <= 0) return FALSE; - str = HeapAlloc(GetProcessHeap(), 0, count); + str = HeapAlloc(GetProcessHeap(), 0, count+1); + if (!str) + return FALSE; for(i = 0; i < count; i++) - str[i] = (BYTE)(iFirstChar + i); - - wstr = FONT_mbtowc(NULL, str, count, &wlen, NULL); + str[i] = (BYTE)(iFirstChar + i); + str[i] = '\0'; + wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL); + if (!wstr) + { + HeapFree(GetProcessHeap(), 0, str); + return FALSE; + } ret = NtGdiGetCharWidthW( hdc, wstr[0], (ULONG) count, (PWCHAR) wstr, 0, (PVOID) pxBuffer); HeapFree(GetProcessHeap(), 0, str); @@ -751,26 +760,34 @@ GetCharABCWidthsA( LPABC lpabc ) { -DPRINT("GetCharABCWidthsA\n"); INT i, wlen, count = (INT)(uLastChar - uFirstChar + 1); LPSTR str; LPWSTR wstr; BOOL ret = TRUE; + DPRINT("GetCharABCWidthsA\n"); if(count <= 0) return FALSE; - str = HeapAlloc(GetProcessHeap(), 0, count); + str = HeapAlloc(GetProcessHeap(), 0, count+1); + if (!str) + return FALSE; for(i = 0; i < count; i++) - str[i] = (BYTE)(uFirstChar + i); + str[i] = (BYTE)(uFirstChar + i); + str[i] = '\0'; - wstr = FONT_mbtowc(hdc, str, count, &wlen, NULL); + wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL); + if (!wstr) + { + HeapFree(GetProcessHeap(), 0, str); + return FALSE; + } - ret = NtGdiGetCharABCWidthsW( hdc, + ret = NtGdiGetCharABCWidthsW( hdc, wstr[0], - (ULONG)count, - (PWCHAR)wstr, - GCABCW_NOFLOAT, - (PVOID)lpabc); + (ULONG)count, + (PWCHAR)wstr, + GCABCW_NOFLOAT, + (PVOID)lpabc); HeapFree(GetProcessHeap(), 0, str); HeapFree(GetProcessHeap(), 0, wstr); @@ -790,21 +807,28 @@ GetCharABCWidthsFloatA( LPABCFLOAT lpABCF ) { -DPRINT("GetCharABCWidthsFloatA\n"); INT i, wlen, count = (INT)(iLastChar - iFirstChar + 1); LPSTR str; LPWSTR wstr; BOOL ret = TRUE; + DPRINT("GetCharABCWidthsFloatA\n"); if (count <= 0) return FALSE; - str = HeapAlloc(GetProcessHeap(), 0, count); + str = HeapAlloc(GetProcessHeap(), 0, count+1); + if (!str) + return FALSE; for(i = 0; i < count; i++) str[i] = (BYTE)(iFirstChar + i); + str[i] = '\0'; - wstr = FONT_mbtowc( hdc, str, count, &wlen, NULL ); - + wstr = FONT_mbtowc( hdc, str, count+1, &wlen, NULL ); + if (!wstr) + { + HeapFree( GetProcessHeap(), 0, str ); + return FALSE; + } ret = NtGdiGetCharABCWidthsW( hdc,wstr[0],(ULONG)count, (PWCHAR)wstr, 0, (PVOID)lpABCF); HeapFree( GetProcessHeap(), 0, str ); @@ -817,14 +841,14 @@ DPRINT("GetCharABCWidthsFloatA\n"); * @implemented */ BOOL -STDCALL +WINAPI GetCharABCWidthsI(HDC hdc, UINT giFirst, UINT cgi, LPWORD pgi, LPABC lpabc) { -DPRINT("GetCharABCWidthsI\n"); + DPRINT("GetCharABCWidthsI\n"); return NtGdiGetCharABCWidthsW( hdc, giFirst, (ULONG) cgi, @@ -837,7 +861,7 @@ DPRINT("GetCharABCWidthsI\n"); * @implemented */ BOOL -STDCALL +WINAPI GetCharWidthI(HDC hdc, UINT giFirst, UINT cgi, @@ -845,7 +869,7 @@ GetCharWidthI(HDC hdc, LPINT lpBuffer ) { -DPRINT("GetCharWidthsI\n"); + DPRINT("GetCharWidthsI\n"); if (!lpBuffer || (!pgi && (giFirst == MAXUSHORT))) // Cannot be at max. { SetLastError(ERROR_INVALID_PARAMETER); @@ -864,7 +888,31 @@ DPRINT("GetCharWidthsI\n"); * @implemented */ DWORD -STDCALL +WINAPI +GetFontLanguageInfo( + HDC hDc + ) +{ + DWORD Gcp = 0, Ret = 0; + if (gbLpk) + { + Ret = NtGdiGetTextCharsetInfo(hDc, NULL, 0); + if ((Ret == ARABIC_CHARSET) || (Ret == HEBREW_CHARSET)) + Ret = (GCP_KASHIDA|GCP_DIACRITIC|GCP_LIGATE|GCP_GLYPHSHAPE|GCP_REORDER); + } + Gcp = GetDCDWord(hDc, GdiGetFontLanguageInfo, GCP_ERROR); + if ( Gcp == GCP_ERROR) + return Gcp; + else + Ret = Gcp | Ret; + return Ret; +} + +/* + * @implemented + */ +DWORD +WINAPI GetGlyphIndicesA( HDC hdc, LPCSTR lpstr, @@ -878,6 +926,10 @@ GetGlyphIndicesA( INT countW; lpstrW = FONT_mbtowc(hdc, lpstr, count, &countW, NULL); + + if (lpstrW == NULL) + return GDI_ERROR; + Ret = NtGdiGetGlyphIndicesW(hdc, lpstrW, countW, pgi, flags); HeapFree(GetProcessHeap(), 0, lpstrW); return Ret; @@ -887,7 +939,7 @@ GetGlyphIndicesA( * @implemented */ DWORD -STDCALL +WINAPI GetGlyphOutlineA( HDC hdc, UINT uChar, @@ -902,7 +954,8 @@ GetGlyphOutlineA( LPWSTR p = NULL; DWORD ret; UINT c; - DPRINT1("GetGlyphOutlineA uChar %x\n", uChar); + DPRINT("GetGlyphOutlineA uChar %x\n", uChar); + if (!lpgm || !lpmat2) return GDI_ERROR; if(!(uFormat & GGO_GLYPH_INDEX)) { int len; char mbchs[2]; @@ -914,8 +967,8 @@ GetGlyphOutlineA( len = 1; mbchs[0] = (uChar & 0xff); } - p = FONT_mbtowc(NULL, mbchs, len, NULL, NULL); - c = p[0]; + p = FONT_mbtowc(hdc, mbchs, len, NULL, NULL); + c = p[0]; } else c = uChar; ret = NtGdiGetGlyphOutline(hdc, c, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE); @@ -928,7 +981,7 @@ GetGlyphOutlineA( * @implemented */ DWORD -STDCALL +WINAPI GetGlyphOutlineW( HDC hdc, UINT uChar, @@ -939,8 +992,8 @@ GetGlyphOutlineW( CONST MAT2 *lpmat2 ) { - DPRINT("GetGlyphOutlineW uChar %x\n", uChar); - if (!lpgm & !lpmat2) return GDI_ERROR; + DPRINT("GetGlyphOutlineW uChar %x\n", uChar); + if (!lpgm || !lpmat2) return GDI_ERROR; if (!lpvBuffer) cbBuffer = 0; return NtGdiGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE); } @@ -966,7 +1019,13 @@ GetOutlineTextMetricsA( if((ret = GetOutlineTextMetricsW(hdc, 0, NULL)) == 0) return 0; if(ret > sizeof(buf)) - lpOTMW = HeapAlloc(GetProcessHeap(), 0, ret); + { + lpOTMW = HeapAlloc(GetProcessHeap(), 0, ret); + if (lpOTMW == NULL) + { + return 0; + } + } GetOutlineTextMetricsW(hdc, ret, lpOTMW); needed = sizeof(OUTLINETEXTMETRICA); @@ -994,10 +1053,16 @@ GetOutlineTextMetricsA( DPRINT("needed = %d\n", needed); if(needed > cbData) + { /* Since the supplied buffer isn't big enough, we'll alloc one that is and memcpy the first cbData bytes into the lpOTM at the end. */ output = HeapAlloc(GetProcessHeap(), 0, needed); + if (output == NULL) + { + goto end; + } + } ret = output->otmSize = min(needed, cbData); FONT_TextMetricWToA( &lpOTMW->otmTextMetrics, &output->otmTextMetrics ); @@ -1120,7 +1185,7 @@ GetOutlineTextMetricsW( * @implemented */ DWORD -STDCALL +WINAPI GetKerningPairsW(HDC hdc, ULONG cPairs, LPKERNINGPAIR pkpDst) @@ -1140,7 +1205,7 @@ GetKerningPairsW(HDC hdc, * @implemented */ DWORD -STDCALL +WINAPI GetKerningPairsA( HDC hDC, DWORD cPairs, LPKERNINGPAIR kern_pairA ) @@ -1180,6 +1245,10 @@ GetKerningPairsA( HDC hDC, if (!cPairs && !kern_pairA) return total_kern_pairs; kern_pairW = HeapAlloc(GetProcessHeap(), 0, total_kern_pairs * sizeof(*kern_pairW)); + if (kern_pairW == NULL) + { + return 0; + } GetKerningPairsW(hDC, total_kern_pairs, kern_pairW); for (i = 0; i < total_kern_pairs; i++) @@ -1218,7 +1287,7 @@ GetKerningPairsA( HDC hDC, * @implemented */ HFONT -STDCALL +WINAPI CreateFontIndirectExA(const ENUMLOGFONTEXDVA *elfexd) { if (elfexd) @@ -1242,7 +1311,7 @@ CreateFontIndirectExA(const ENUMLOGFONTEXDVA *elfexd) * @implemented */ HFONT -STDCALL +WINAPI CreateFontIndirectExW(const ENUMLOGFONTEXDVW *elfexd) { /* Msdn: Note, this function ignores the elfDesignVector member in @@ -1260,7 +1329,7 @@ CreateFontIndirectExW(const ENUMLOGFONTEXDVW *elfexd) * @implemented */ HFONT -STDCALL +WINAPI CreateFontIndirectA( CONST LOGFONTA *lplf ) @@ -1280,7 +1349,7 @@ CreateFontIndirectA( * @implemented */ HFONT -STDCALL +WINAPI CreateFontIndirectW( CONST LOGFONTW *lplf ) @@ -1299,6 +1368,8 @@ CreateFontIndirectW( RtlZeroMemory( &Logfont.elfEnumLogfontEx.elfScript, sizeof(Logfont.elfEnumLogfontEx.elfScript)); + Logfont.elfDesignVector.dvNumAxes = 0; // No more than MM_MAX_NUMAXES + RtlZeroMemory( &Logfont.elfDesignVector, sizeof(DESIGNVECTOR)); return CreateFontIndirectExW(&Logfont); @@ -1311,7 +1382,7 @@ CreateFontIndirectW( * @implemented */ HFONT -STDCALL +WINAPI CreateFontA( int nHeight, int nWidth, @@ -1361,7 +1432,7 @@ CreateFontA( * @implemented */ HFONT -STDCALL +WINAPI CreateFontW( int nHeight, int nWidth, @@ -1412,29 +1483,10 @@ CreateFontW( /* - * @implemented - */ -BOOL -STDCALL -CreateScalableFontResourceW( - DWORD fdwHidden, - LPCWSTR lpszFontRes, - LPCWSTR lpszFontFile, - LPCWSTR lpszCurrentPath - ) -{ - return NtGdiCreateScalableFontResource ( fdwHidden, - lpszFontRes, - lpszFontFile, - lpszCurrentPath ); -} - - -/* - * @implemented + * @unimplemented */ BOOL -STDCALL +WINAPI CreateScalableFontResourceA( DWORD fdwHidden, LPCSTR lpszFontRes, @@ -1442,39 +1494,7 @@ CreateScalableFontResourceA( LPCSTR lpszCurrentPath ) { - NTSTATUS Status; - LPWSTR lpszFontResW, lpszFontFileW, lpszCurrentPathW; - BOOL rc = FALSE; - - Status = HEAP_strdupA2W ( &lpszFontResW, lpszFontRes ); - if (!NT_SUCCESS (Status)) - SetLastError (RtlNtStatusToDosError(Status)); - else - { - Status = HEAP_strdupA2W ( &lpszFontFileW, lpszFontFile ); - if (!NT_SUCCESS (Status)) - SetLastError (RtlNtStatusToDosError(Status)); - else - { - Status = HEAP_strdupA2W ( &lpszCurrentPathW, lpszCurrentPath ); - if (!NT_SUCCESS (Status)) - SetLastError (RtlNtStatusToDosError(Status)); - else - { - rc = NtGdiCreateScalableFontResource ( fdwHidden, - lpszFontResW, - lpszFontFileW, - lpszCurrentPathW ); - - HEAP_free ( lpszCurrentPathW ); - } - - HEAP_free ( lpszFontFileW ); - } - - HEAP_free ( lpszFontResW ); - } - return rc; + return FALSE; } @@ -1482,7 +1502,7 @@ CreateScalableFontResourceA( * @implemented */ int -STDCALL +WINAPI AddFontResourceExW ( LPCWSTR lpszFilename, DWORD fl, PVOID pvReserved ) { if (fl & ~(FR_PRIVATE | FR_NOT_ENUM)) @@ -1499,7 +1519,7 @@ AddFontResourceExW ( LPCWSTR lpszFilename, DWORD fl, PVOID pvReserved ) * @implemented */ int -STDCALL +WINAPI AddFontResourceExA ( LPCSTR lpszFilename, DWORD fl, PVOID pvReserved ) { NTSTATUS Status; @@ -1529,7 +1549,7 @@ AddFontResourceExA ( LPCSTR lpszFilename, DWORD fl, PVOID pvReserved ) * @implemented */ int -STDCALL +WINAPI AddFontResourceA ( LPCSTR lpszFilename ) { NTSTATUS Status; @@ -1555,7 +1575,7 @@ AddFontResourceA ( LPCSTR lpszFilename ) * @implemented */ int -STDCALL +WINAPI AddFontResourceW ( LPCWSTR lpszFilename ) { return GdiAddFontResourceW ( lpszFilename, 0, 0 ); @@ -1566,7 +1586,7 @@ AddFontResourceW ( LPCWSTR lpszFilename ) * @implemented */ BOOL -STDCALL +WINAPI RemoveFontResourceW(LPCWSTR lpFileName) { return RemoveFontResourceExW(lpFileName,0,0); @@ -1577,17 +1597,17 @@ RemoveFontResourceW(LPCWSTR lpFileName) * @implemented */ BOOL -STDCALL +WINAPI RemoveFontResourceA(LPCSTR lpFileName) { return RemoveFontResourceExA(lpFileName,0,0); } /* - * @implemented + * @unimplemented */ BOOL -STDCALL +WINAPI RemoveFontResourceExA(LPCSTR lpFileName, DWORD fl, PVOID pdv @@ -1595,7 +1615,6 @@ RemoveFontResourceExA(LPCSTR lpFileName, { NTSTATUS Status; LPWSTR lpFileNameW; - BOOL rc = 0; /* FIXME the flags */ /* FIXME the pdv */ @@ -1606,19 +1625,18 @@ RemoveFontResourceExA(LPCSTR lpFileName, SetLastError (RtlNtStatusToDosError(Status)); else { - rc = NtGdiRemoveFontResource ( lpFileNameW ); HEAP_free ( lpFileNameW ); } - return rc; + return 0; } /* * @unimplemented */ BOOL -STDCALL +WINAPI RemoveFontResourceExW(LPCWSTR lpFileName, DWORD fl, PVOID pdv) @@ -1626,7 +1644,7 @@ RemoveFontResourceExW(LPCWSTR lpFileName, /* FIXME the flags */ /* FIXME the pdv */ /* FIXME NtGdiRemoveFontResource handle flags and pdv */ - return NtGdiRemoveFontResource ( lpFileName); + return 0; } @@ -1663,21 +1681,24 @@ RemoveFontResourceExW(LPCWSTR lpFileName, /* * @implemented */ -DWORD -STDCALL +LONG +WINAPI GdiGetCharDimensions(HDC hdc, LPTEXTMETRICW lptm, LONG *height) { SIZE sz; + TEXTMETRICW tm; static const WCHAR alphabet[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q', 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H', 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0}; - if(lptm && !GetTextMetricsW(hdc, lptm)) return 0; + if(!GetTextMetricsW(hdc, &tm)) return 0; if(!GetTextExtentPointW(hdc, alphabet, 52, &sz)) return 0; - if (height) *height = sz.cy; + if (lptm) *lptm = tm; + if (height) *height = tm.tmHeight; + return (sz.cx / 26 + 1) / 2; } @@ -1697,10 +1718,10 @@ GdiGetCharDimensions(HDC hdc, LPTEXTMETRICW lptm, LONG *height) * */ /* - * @unimplemented + * @implemented */ BOOL -STDCALL +WINAPI TranslateCharsetInfo( LPDWORD lpSrc, /* [in] if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE @@ -1713,13 +1734,13 @@ TranslateCharsetInfo( int index = 0; switch (flags) { case TCI_SRCFONTSIG: - while (!(*lpSrc>>index & 0x0001) && index>index & 0x0001)) index++; break; case TCI_SRCCODEPAGE: - while (PtrToUlong(lpSrc) != FONT_tci[index].ciACP && index < MAXTCIINDEX) index++; + while (index < MAXTCIINDEX && PtrToUlong(lpSrc) != FONT_tci[index].ciACP) index++; break; case TCI_SRCCHARSET: - while (PtrToUlong(lpSrc) != FONT_tci[index].ciCharset && index < MAXTCIINDEX) index++; + while (index < MAXTCIINDEX && PtrToUlong(lpSrc) != FONT_tci[index].ciCharset) index++; break; default: return FALSE; @@ -1730,11 +1751,65 @@ TranslateCharsetInfo( } +/* + * @implemented + */ +DWORD +WINAPI +SetMapperFlags( + HDC hDC, + DWORD flags + ) +{ + DWORD Ret = GDI_ERROR; + PDC_ATTR Dc_Attr; +#if 0 + if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC) + { + if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC) + return MFDRV_SetMapperFlags( hDC, flags); + else + { + PLDC pLDC = Dc_Attr->pvLDC; + if ( !pLDC ) + { + SetLastError(ERROR_INVALID_HANDLE); + return GDI_ERROR; + } + if (pLDC->iType == LDC_EMFLDC) + { + return EMFDRV_SetMapperFlags( hDC, flags); + } + } + } +#endif + if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return GDI_ERROR; + + if (NtCurrentTeb()->GdiTebBatch.HDC == hDC) + { + if (Dc_Attr->ulDirty_ & DC_FONTTEXT_DIRTY) + { + NtGdiFlush(); + Dc_Attr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY); + } + } + + if ( flags & ~1 ) + SetLastError(ERROR_INVALID_PARAMETER); + else + { + Ret = Dc_Attr->flFontMapper; + Dc_Attr->flFontMapper = flags; + } + return Ret; +} + + /* * @unimplemented */ int -STDCALL +WINAPI EnumFontsW( HDC hDC, LPCWSTR lpFaceName, @@ -1753,7 +1828,7 @@ EnumFontsW( * @unimplemented */ int -STDCALL +WINAPI EnumFontsA ( HDC hDC, LPCSTR lpFaceName, @@ -1784,7 +1859,7 @@ EnumFontsA ( #define EfdFontFamilies 3 INT -STDCALL +WINAPI NewEnumFontFamiliesExW( HDC hDC, LPLOGFONTW lpLogfont, @@ -1842,8 +1917,8 @@ NewEnumFontFamiliesExW( { PNTMW_INTERNAL pNtmwi = (PNTMW_INTERNAL)((ULONG_PTR)pEfdw + pEfdw->ulNtmwiOffset); - ret = lpEnumFontFamExProcW(&pEfdw->elfexdv.elfEnumLogfontEx, - &pNtmwi->ntmw, + ret = lpEnumFontFamExProcW((VOID*)&pEfdw->elfexdv.elfEnumLogfontEx, + (VOID*)&pNtmwi->ntmw, pEfdw->dwFontType, lParam);