47 #define assert(e) ((e) ? (void)0 : _font_assert(#e, __FILE__, __LINE__)) 114 #define ALPHA_PREFIX 30 115 #define KANA_PREFIX 31 117 #define FORWARD_SLASH '/' 118 #define BACK_SLASH '\\' 162 int *len_before,
int *len_ellip)
164 unsigned int len_ellipsis;
165 unsigned int lo, mid, hi;
167 if (len_ellipsis > max_len) len_ellipsis = max_len;
168 if (*len_str > max_len - len_ellipsis)
169 *len_str = max_len - len_ellipsis;
180 for (lo = 0, hi = *len_str; lo < hi; )
207 if (!*len_str ||
size->cx <=
width)
break;
211 *len_ellip = len_ellipsis;
212 *len_before = *len_str;
213 *len_str += len_ellipsis;
218 modstr[*len_str] =
'\0';
272 WCHAR *lastBkSlash, *lastFwdSlash, *lastSlash;
274 if (!max_len)
return;
275 if (len_ellipsis >= max_len) len_ellipsis = max_len - 1;
276 if (*len_str + len_ellipsis >= max_len)
277 *len_str = max_len - len_ellipsis-1;
281 str[*len_str] =
'\0';
289 lastSlash = lastBkSlash > lastFwdSlash ? lastBkSlash : lastFwdSlash;
290 if (!lastSlash) lastSlash =
str;
291 len_trailing = *len_str - (lastSlash -
str);
294 memmove (lastSlash+len_ellipsis, lastSlash, len_trailing *
sizeof(
WCHAR));
296 len_trailing += len_ellipsis;
314 memmove (lastSlash-1, lastSlash, len_trailing *
sizeof(
WCHAR));
322 pellip->
len = len_ellipsis;
323 pellip->
under = len_under;
324 pellip->
after = len_trailing - len_ellipsis;
325 *len_str += len_ellipsis;
330 modstr[*len_str] =
'\0';
337 if (0x0E00 <= wch && wch <= 0x0E7F)
340 if (0x3000 <= wch && wch <= 0x9FFF)
343 if (0xAC00 <= wch && wch <= 0xD7FF)
346 if (0xFF00 <= wch && wch <= 0xFFEF)
355 0x2010, 0x2013, 0x2019, 0x201D, 0x203C, 0x2047, 0x2048, 0x2049, 0x3001,
356 0x3002, 0x3005, 0x3009, 0x300B, 0x300D, 0x300F, 0x3011, 0x3015, 0x3017,
357 0x3019, 0x301C, 0x301F, 0x303B, 0x3041, 0x3043, 0x3045, 0x3047, 0x3049,
358 0x3063, 0x3083, 0x3085, 0x3087, 0x308E, 0x3095, 0x3096, 0x30A0, 0x30A1,
359 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30C3, 0x30E3, 0x30E5, 0x30E7, 0x30EE,
360 0x30F5, 0x30F6, 0x30FB, 0x30FC, 0x30FD, 0x30FE, 0x31F0, 0x31F1, 0x31F2,
361 0x31F3, 0x31F4, 0x31F5, 0x31F6, 0x31F7, 0x31F8, 0x31F9, 0x31FA, 0x31FB,
362 0x31FC, 0x31FD, 0x31FE, 0x31FF, 0xFF01, 0xFF09, 0xFF0C, 0xFF0E, 0xFF1A,
363 0xFF1B, 0xFF1F, 0xFF3D, 0xFF5D, 0xFF60, 0
427 unsigned int *len_str,
429 unsigned int *chars_used,
SIZE *
size)
434 assert (chars_fit < *len_str);
459 next_is_space = (
unsigned int) (
p -
str) < *len_str && *
p ==
SPACE;
462 *chars_used = *len_str;
476 *len_str = chars_fit;
477 *chars_used = chars_fit;
492 *chars_used =
p -
str;
541 int start_count,
const WCHAR *start_str,
542 int max,
int n,
int prefix)
551 const WCHAR *str_on_entry = start_str;
560 start_count -= (start_str - str_on_entry);
567 *new_str = start_str;
568 *new_count = start_count;
597 if (
i == (
unsigned int) pe->
before)
600 if (
ns < (
unsigned int) pe->
under)
break;
604 if (!pe->
after)
break;
628 if (!num_chars)
return TRUE;
630 if (!--num_chars)
return TRUE;
634 if (--num_chars)
return FALSE;
668 SIZE *retsize,
int last_line,
WCHAR **p_retstr,
669 int tabwidth,
int *pprefix_offset,
676 int seg_i, seg_count, seg_j;
681 unsigned int j_in_seg;
683 *pprefix_offset = -1;
695 plen = ((plen/tabwidth)+1)*tabwidth;
696 (*count)--;
if (
j < maxl)
dest[
j++] =
str[
i++];
else i++;
700 (*count)--;
if (
j < maxl)
dest[
j++] =
str[
i++];
else i++;
717 (*count)--;
if (
j < maxl)
dest[
j++] =
str[
i++];
else i++;
726 (*count)--;
if (
j < maxl)
dest[
j++] =
str[
i++];
else i++;
728 else if (*pprefix_offset == -1 || *pprefix_offset >= seg_j)
745 (*count)--;
if (
j < maxl)
dest[
j++] =
str[
i++];
else i++;
754 j_in_seg =
j - seg_j;
755 max_seg_width =
width - plen;
768 line_fits = (num_fit >= j_in_seg);
772 unsigned int chars_used;
774 max_seg_width,
format, num_fit, &chars_used, &
size);
775 line_fits = (
size.cx <= max_seg_width);
782 pellip->
before = j_in_seg;
790 max_seg_width, &
size, *p_retstr, pellip);
791 line_fits = (
size.cx <= max_seg_width);
798 ((last_line && *
count) ||
803 max_seg_width, &
size, *p_retstr, &
before, &len_ellipsis);
817 pellip->
len = len_ellipsis;
822 line_fits = (
size.cx <= max_seg_width);
842 j = seg_j + j_in_seg;
843 if (*pprefix_offset >= seg_j + pellip->
before)
846 if (*pprefix_offset != -1)
847 *pprefix_offset += seg_j;
851 if (
size.cy > retsize->
cy)
906 prefix_x =
x +
size.cx;
912 prefix_end =
x +
size.cx - 1;
918 if (prefix_x >
rect->right || prefix_end < rect->
left ||
922 if (prefix_x < rect->
left ) prefix_x =
rect->left;
923 if (prefix_end >
rect->right) prefix_end =
rect->right;
968 ULONG ArgumentLength;
976 pStringBuffer = ArgumentLength;
977 ArgumentLength +=
sizeof(
WCHAR) * (
count + 2);
1034 bResult = *(
LPBOOL)ResultPointer;
1038 ERR(
"Failed to copy result from user mode!\n");
1066 #define MAX_BUFFER 1024 1080 const WCHAR *strPtr;
1081 WCHAR *retstr, *p_retstr;
1086 int lmargin = 0, rmargin = 0;
1104 if (dtp)
TRACE(
"Params: iTabLength=%d, iLeftMargin=%d, iRightMargin=%d\n",
1119 lh =
tm.tmHeight +
tm.tmExternalLeading;
1131 SIZE window_ext, viewport_ext;
1134 if ((window_ext.
cy > 0) != (viewport_ext.
cy > 0))
1140 SIZE window_ext, viewport_ext;
1143 if ((window_ext.
cy > 0) != (viewport_ext.
cy > 0))
1160 rect->bottom =
rect->top + (invert_y ? -lh : lh);
1180 tabwidth =
tm.tmAveCharWidth * tabstop;
1185 if (!(flags & DT_NOCLIP) ) 1218 if (flags & DT_MODIFYSTRING) 1226 if (!retstr)
return 0;
1243 strPtr =
TEXT_NextLineW(
hdc, strPtr, &
count,
line, &
len,
width,
flags, &
size, last_line, &p_retstr, tabwidth, &prefix_offset, &ellip);
1269 y =
rect->bottom + (invert_y ? 0 : -
size.cy);
1290 if (len_seg !=
len &&
1326 if (prefix_offset != -1 && prefix_offset < len_seg)
1336 xseg += ((
size.cx/tabwidth)+1)*tabwidth;
1337 if (prefix_offset != -1)
1339 if (prefix_offset < len_seg)
1350 prefix_offset -= len_seg;
1355 else if (
size.cx > max_width)
1356 max_width =
size.cx;
1358 y += invert_y ? -lh : lh;
1362 while (strPtr && !last_line);
1387 rect->right =
rect->left + max_width;
1390 rect->right += lmargin + rmargin;
1401 return y -
rect->top;
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
NTSTATUS NTAPI KeUserModeCallback(IN ULONG RoutineIndex, IN PVOID Argument, IN ULONG ArgumentLength, OUT PVOID *Result, OUT PULONG ResultLength)
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
INT WINAPI DrawTextExWorker(HDC hdc, LPWSTR str, INT i_count, LPRECT rect, UINT flags, LPDRAWTEXTPARAMS dtp)
GLint GLint GLsizei width
#define memmove(s1, s2, n)
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
static void TEXT_WordBreak(HDC hdc, WCHAR *str, unsigned int max_str, unsigned int *len_str, int width, int format, unsigned int chars_fit, unsigned int *chars_used, SIZE *size)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
static void TEXT_DrawUnderscore(HDC hdc, int x, int y, const WCHAR *str, int offset, const RECT *rect)
_In_ int _Inout_ LPRECT lprc
__kernel_entry W32KAPI INT APIENTRY NtGdiIntersectClipRect(_In_ HDC hdc, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
VOID FASTCALL IntCbFreeMemory(PVOID Data)
__kernel_entry W32KAPI INT APIENTRY NtGdiExtSelectClipRgn(_In_ HDC hdc, _In_opt_ HRGN hrgn, _In_ INT iMode)
GLuint GLuint GLsizei count
BOOL FASTCALL GreGetTextExtentW(HDC hDC, LPCWSTR lpwsz, INT cwc, LPSIZE psize, UINT flOpts)
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
VOID WINAPI ExitProcess(IN UINT uExitCode)
BOOL WINAPI GreGetViewportExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
GLint GLint GLint GLint GLint x
__inline int before(__u32 seq1, __u32 seq2)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiLineTo(_In_ HDC hdc, _In_ INT x, _In_ INT y)
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
__kernel_entry W32KAPI HPEN APIENTRY NtGdiSelectPen(_In_ HDC hdc, _In_ HPEN hpen)
static void TEXT_PathEllipsify(HDC hdc, WCHAR *str, unsigned int max_len, unsigned int *len_str, int width, SIZE *size, WCHAR *modstr, ellipsis_data *pellip)
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ INT x, _In_ INT y, _In_ UINT fuOptions, _In_opt_ const RECT *lprc, _In_reads_opt_(cwc) LPCWSTR lpString, _In_ UINT cwc, _In_reads_opt_(cwc) const INT *lpDx)
#define EXCEPTION_EXECUTE_HANDLER
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
PVOID FASTCALL IntCbAllocateMemory(ULONG Size)
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 GLint GLint j
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
static const WCHAR KinsokuClassA[]
WINE_DEFAULT_DEBUG_CHANNEL(metafile)
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
BOOL WINAPI GetViewportExtEx(_In_ HDC, _Out_ LPSIZE)
BOOL WINAPI GreGetTextMetricsW(_In_ HDC hdc, _Out_ LPTEXTMETRICW lptm)
#define NT_SUCCESS(StatCode)
NTSTRSAFEAPI RtlStringCchCopyNW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_reads_or_z_(cchToCopy) STRSAFE_LPCWSTR pszSrc, _In_ size_t cchToCopy)
int WINAPI GetGraphicsMode(_In_ HDC)
BOOL WINAPI GetWindowExtEx(_In_ HDC, _Out_ LPSIZE)
const char * wine_dbgstr_rect(const RECT *rect)
BOOL APIENTRY GreExtTextOutW(IN HDC hDC, IN INT XStart, IN INT YStart, IN UINT fuOptions, IN OPTIONAL PRECTL lprc, IN LPCWSTR String, IN INT Count, IN OPTIONAL LPINT Dx, IN DWORD dwCodePage)
#define USER32_CALLBACK_LPK
struct tag_ellipsis_data ellipsis_data
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
BOOL UserExtTextOutW(HDC hdc, INT x, INT y, UINT flags, PRECTL lprc, LPCWSTR lpString, UINT count)
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
BOOL WINAPI GetTextMetricsW(_In_ HDC hdc, _Out_ LPTEXTMETRICW lptm)
static int remainder_is_none_or_newline(int num_chars, const WCHAR *str)
BOOL APIENTRY GetTextExtentPointW(_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpString, _In_ INT cchString, _Out_ LPSIZE lpsz)
#define memcpy(s1, s2, n)
static void TEXT_Ellipsify(HDC hdc, WCHAR *str, unsigned int max_len, unsigned int *len_str, int width, SIZE *size, WCHAR *modstr, int *len_before, int *len_ellip)
BOOL FASTCALL GreMoveTo(HDC hdc, INT x, INT y, LPPOINT pptOut)
#define DBG_DEFAULT_CHANNEL(ch)
static int TEXT_Reprefix(const WCHAR *str, unsigned int ns, const ellipsis_data *pe)
static const WCHAR * TEXT_NextLineW(HDC hdc, const WCHAR *str, int *count, WCHAR *dest, int *len, int width, DWORD format, SIZE *retsize, int last_line, WCHAR **p_retstr, int tabwidth, int *pprefix_offset, ellipsis_data *pellip)
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
COLORREF WINAPI GetTextColor(_In_ HDC hdc)
BOOL WINAPI GdiFlush(void)
static const WCHAR ELLIPSISW[]
__kernel_entry W32KAPI HPEN APIENTRY NtGdiCreatePen(_In_ INT iPenStyle, _In_ INT iPenWidth, _In_ COLORREF cr, _In_opt_ HBRUSH hbr)
#define DT_EXTERNALLEADING
struct _LPK_CALLBACK_ARGUMENTS LPK_CALLBACK_ARGUMENTS
BOOL WINAPI GreGetWindowExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
__kernel_entry W32KAPI INT APIENTRY NtGdiGetRandomRgn(_In_ HDC hdc, _In_ HRGN hrgn, _In_ INT iRgn)
GLint GLint GLint GLint GLint GLint y
COLORREF FASTCALL GreGetTextColor(HDC)
void _font_assert(const char *msg, const char *file, int line)
BOOL WINAPI GetTextExtentExPointW(_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpszString, _In_ INT cchString, _In_ INT nMaxExtent, _Out_opt_ LPINT lpnFit, _Out_writes_to_opt_(cchString, *lpnFit) LPINT lpnDx, _Out_ LPSIZE lpSize)
#define RtlZeroMemory(Destination, Length)
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
#define _SEH2_EXCEPT(...)
GLdouble GLdouble GLdouble GLdouble top
#define ExFreePoolWithTag(_P, _T)
#define _SEH2_GetExceptionCode()
BOOL FASTCALL GreGetTextExtentExW(HDC hDC, LPCWSTR String, ULONG Count, ULONG MaxExtent, PULONG Fit, PULONG Dx, LPSIZE pSize, FLONG fl)
static void TEXT_SkipChars(int *new_count, const WCHAR **new_str, int start_count, const WCHAR *start_str, int max, int n, int prefix)
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
int FASTCALL GreGetGraphicsMode(HDC)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *