Author: jimtabor
Date: Thu Oct 31 16:54:01 2013
New Revision: 60807
URL:
http://svn.reactos.org/svn/reactos?rev=60807&view=rev
Log:
- Fix Text tests. Update wine sync.
Modified:
trunk/reactos/win32ss/user/user32/windows/font.c
Modified: trunk/reactos/win32ss/user/user32/windows/font.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/font.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/font.c [iso-8859-1] Thu Oct 31 16:54:01
2013
@@ -32,6 +32,9 @@
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(text);
+
+DWORD WINAPI GdiGetCodePage(HDC hdc);
+
/* FUNCTIONS *****************************************************************/
@@ -71,14 +74,13 @@
LONG ret;
DWORD len;
LPWSTR strW;
-
- len = MultiByteToWideChar(CP_ACP, 0, lpString, nCount, NULL, 0);
+ UINT cp = GdiGetCodePage( hDC ); // CP_ACP
+
+ len = MultiByteToWideChar(cp, 0, lpString, nCount, NULL, 0);
+ if (!len) return 0;
strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
- if (!strW)
- {
- return 0;
- }
- MultiByteToWideChar(CP_ACP, 0, lpString, nCount, strW, len);
+ if (!strW) return 0;
+ MultiByteToWideChar(cp, 0, lpString, nCount, strW, len);
ret = TabbedTextOutW(hDC, X, Y, strW, len, nTabPositions, lpnTabStopPositions,
nTabOrigin);
HeapFree(GetProcessHeap(), 0, strW);
return ret;
@@ -215,20 +217,16 @@
CONST INT *lpnTabStopPositions)
{
LONG ret;
- DWORD len = MultiByteToWideChar(CP_ACP, 0, lpString, nCount, NULL, 0);
+ UINT cp = GdiGetCodePage( hDC ); // CP_ACP
+ DWORD len = MultiByteToWideChar(cp, 0, lpString, nCount, NULL, 0);
+ if (!len) return 0;
LPWSTR strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
-
- if (!strW)
- return 0;
- MultiByteToWideChar(CP_ACP, 0, lpString, nCount, strW, len);
-
- ret = GetTabbedTextExtentW(hDC, strW, len, nTabPositions,
- lpnTabStopPositions);
-
+ if (!strW) return 0;
+ MultiByteToWideChar(cp, 0, lpString, nCount, strW, len);
+ ret = GetTabbedTextExtentW(hDC, strW, len, nTabPositions, lpnTabStopPositions);
HeapFree(GetProcessHeap(), 0, strW);
return ret;
}
-
/*
* @implemented
@@ -293,6 +291,8 @@
#define CR 13
#define SPACE 32
#define PREFIX 38
+#define ALPHA_PREFIX 30 /* Win16: Alphabet prefix */
+#define KANA_PREFIX 31 /* Win16: Katakana prefix */
#define FORWARD_SLASH '/'
#define BACK_SLASH '\\'
@@ -711,8 +711,9 @@
max -= n;
while (n--)
{
- if (*start_str++ == PREFIX && max--)
+ if ((*start_str == PREFIX || *start_str == ALPHA_PREFIX) && max--)
start_str++;
+ start_str++;
}
start_count -= (start_str - str_on_entry);
}
@@ -746,10 +747,10 @@
const ellipsis_data *pe)
{
int result = -1;
- unsigned int i = 0;
+ unsigned int i;
unsigned int n = pe->before + pe->under + pe->after;
assert (n <= ns);
- while (i < n)
+ for (i = 0; i < n; i++, str++)
{
if (i == (unsigned int) pe->before)
{
@@ -762,16 +763,15 @@
}
if (!ns) break;
ns--;
- if (*str++ == PREFIX)
- {
+ if (*str++ == PREFIX || *str == ALPHA_PREFIX)
+ {
+ str++;
if (!ns) break;
if (*str != PREFIX)
result = (i < (unsigned int) pe->before || pe->under == 0) ? i :
i - pe->under + pe->len;
/* pe->len may be non-zero while pe_under is zero */
- str++;
ns--;
}
- i++;
}
return result;
}
@@ -870,8 +870,13 @@
(str[i] != TAB || !(format & DT_EXPANDTABS)) &&
((str[i] != CR && str[i] != LF) || (format & DT_SINGLELINE)))
{
- if (str[i] == PREFIX && !(format & DT_NOPREFIX) && *count >
1)
+ if ((format & DT_NOPREFIX) || *count <= 1)
{
+ (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++;
+ continue;
+ }
+
+ if (str[i] == PREFIX || str[i] == ALPHA_PREFIX) {
(*count)--, i++; /* Throw away the prefix itself */
if (str[i] == PREFIX)
{
@@ -887,6 +892,12 @@
* one.
*/
}
+ else if (str[i] == KANA_PREFIX)
+ {
+ /* Throw away katakana access keys */
+ (*count)--, i++; /* skip the prefix */
+ (*count)--, i++; /* skip the letter */
+ }
else
{
(*count)--; if (j < maxl) dest[j++] = str[i++]; else i++;
@@ -1283,10 +1294,6 @@
}
return y - rect->top;
}
-
-DWORD
-WINAPI
-GdiGetCodePage(HDC hdc);
/***********************************************************************
* DrawTextExA (USER32.@)