- Fix Text tests. Update wine sync.

svn path=/trunk/; revision=60807
This commit is contained in:
James Tabor 2013-10-31 16:54:01 +00:00
parent 0a16450437
commit 6f2696d0d5

View file

@ -33,6 +33,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(text); WINE_DEFAULT_DEBUG_CHANNEL(text);
DWORD WINAPI GdiGetCodePage(HDC hdc);
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
#ifndef NDEBUG #ifndef NDEBUG
@ -71,14 +74,13 @@ TabbedTextOutA(
LONG ret; LONG ret;
DWORD len; DWORD len;
LPWSTR strW; LPWSTR strW;
UINT cp = GdiGetCodePage( hDC ); // CP_ACP
len = MultiByteToWideChar(CP_ACP, 0, lpString, nCount, NULL, 0); len = MultiByteToWideChar(cp, 0, lpString, nCount, NULL, 0);
if (!len) return 0;
strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!strW) if (!strW) return 0;
{ MultiByteToWideChar(cp, 0, lpString, nCount, strW, len);
return 0;
}
MultiByteToWideChar(CP_ACP, 0, lpString, nCount, strW, len);
ret = TabbedTextOutW(hDC, X, Y, strW, len, nTabPositions, lpnTabStopPositions, nTabOrigin); ret = TabbedTextOutW(hDC, X, Y, strW, len, nTabPositions, lpnTabStopPositions, nTabOrigin);
HeapFree(GetProcessHeap(), 0, strW); HeapFree(GetProcessHeap(), 0, strW);
return ret; return ret;
@ -215,21 +217,17 @@ GetTabbedTextExtentA(
CONST INT *lpnTabStopPositions) CONST INT *lpnTabStopPositions)
{ {
LONG ret; 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)); LPWSTR strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!strW) return 0;
if (!strW) MultiByteToWideChar(cp, 0, lpString, nCount, strW, len);
return 0; ret = GetTabbedTextExtentW(hDC, strW, len, nTabPositions, lpnTabStopPositions);
MultiByteToWideChar(CP_ACP, 0, lpString, nCount, strW, len);
ret = GetTabbedTextExtentW(hDC, strW, len, nTabPositions,
lpnTabStopPositions);
HeapFree(GetProcessHeap(), 0, strW); HeapFree(GetProcessHeap(), 0, strW);
return ret; return ret;
} }
/* /*
* @implemented * @implemented
*/ */
@ -293,6 +291,8 @@ GetTabbedTextExtentW(
#define CR 13 #define CR 13
#define SPACE 32 #define SPACE 32
#define PREFIX 38 #define PREFIX 38
#define ALPHA_PREFIX 30 /* Win16: Alphabet prefix */
#define KANA_PREFIX 31 /* Win16: Katakana prefix */
#define FORWARD_SLASH '/' #define FORWARD_SLASH '/'
#define BACK_SLASH '\\' #define BACK_SLASH '\\'
@ -711,8 +711,9 @@ static void TEXT_SkipChars (int *new_count, const WCHAR **new_str,
max -= n; max -= n;
while (n--) while (n--)
{ {
if (*start_str++ == PREFIX && max--) if ((*start_str == PREFIX || *start_str == ALPHA_PREFIX) && max--)
start_str++; start_str++;
start_str++;
} }
start_count -= (start_str - str_on_entry); start_count -= (start_str - str_on_entry);
} }
@ -746,10 +747,10 @@ static int TEXT_Reprefix (const WCHAR *str, unsigned int ns,
const ellipsis_data *pe) const ellipsis_data *pe)
{ {
int result = -1; int result = -1;
unsigned int i = 0; unsigned int i;
unsigned int n = pe->before + pe->under + pe->after; unsigned int n = pe->before + pe->under + pe->after;
assert (n <= ns); assert (n <= ns);
while (i < n) for (i = 0; i < n; i++, str++)
{ {
if (i == (unsigned int) pe->before) if (i == (unsigned int) pe->before)
{ {
@ -762,16 +763,15 @@ static int TEXT_Reprefix (const WCHAR *str, unsigned int ns,
} }
if (!ns) break; if (!ns) break;
ns--; ns--;
if (*str++ == PREFIX) if (*str++ == PREFIX || *str == ALPHA_PREFIX)
{ {
str++;
if (!ns) break; if (!ns) break;
if (*str != PREFIX) if (*str != PREFIX)
result = (i < (unsigned int) pe->before || pe->under == 0) ? i : i - pe->under + pe->len; 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 */ /* pe->len may be non-zero while pe_under is zero */
str++;
ns--; ns--;
} }
i++;
} }
return result; return result;
} }
@ -870,8 +870,13 @@ static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count,
(str[i] != TAB || !(format & DT_EXPANDTABS)) && (str[i] != TAB || !(format & DT_EXPANDTABS)) &&
((str[i] != CR && str[i] != LF) || (format & DT_SINGLELINE))) ((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 */ (*count)--, i++; /* Throw away the prefix itself */
if (str[i] == PREFIX) if (str[i] == PREFIX)
{ {
@ -887,6 +892,12 @@ static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count,
* one. * one.
*/ */
} }
else if (str[i] == KANA_PREFIX)
{
/* Throw away katakana access keys */
(*count)--, i++; /* skip the prefix */
(*count)--, i++; /* skip the letter */
}
else else
{ {
(*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++;
@ -1284,10 +1295,6 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
return y - rect->top; return y - rect->top;
} }
DWORD
WINAPI
GdiGetCodePage(HDC hdc);
/*********************************************************************** /***********************************************************************
* DrawTextExA (USER32.@) * DrawTextExA (USER32.@)
* *