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);
1033 bResult = *(
LPBOOL)ResultPointer;
1037 ERR(
"Failed to copy result from user mode!\n");
1065#define MAX_BUFFER 1024
1079 const WCHAR *strPtr;
1080 WCHAR *retstr, *p_retstr;
1085 int lmargin = 0, rmargin = 0;
1103 if (dtp)
TRACE(
"Params: iTabLength=%d, iLeftMargin=%d, iRightMargin=%d\n",
1111 flags &= ~DT_WORDBREAK;
1118 lh =
tm.tmHeight +
tm.tmExternalLeading;
1130 SIZE window_ext, viewport_ext;
1133 if ((window_ext.
cy > 0) != (viewport_ext.
cy > 0))
1139 SIZE window_ext, viewport_ext;
1142 if ((window_ext.
cy > 0) != (viewport_ext.
cy > 0))
1159 rect->bottom =
rect->top + (invert_y ? -lh : lh);
1179 tabwidth =
tm.tmAveCharWidth * tabstop;
1225 if (!retstr)
return 0;
1242 strPtr =
TEXT_NextLineW(
hdc, strPtr, &
count,
line, &
len,
width,
flags, &
size, last_line, &p_retstr, tabwidth, &prefix_offset, &ellip);
1289 if (len_seg !=
len &&
1325 if (prefix_offset != -1 && prefix_offset < len_seg)
1335 xseg += ((
size.cx/tabwidth)+1)*tabwidth;
1336 if (prefix_offset != -1)
1338 if (prefix_offset < len_seg)
1349 prefix_offset -= len_seg;
1354 else if (
size.cx > max_width)
1355 max_width =
size.cx;
1357 y += invert_y ? -lh : lh;
1361 while (strPtr && !last_line);
1386 rect->right =
rect->left + max_width;
1389 rect->right += lmargin + rmargin;
1400 return y -
rect->top;
NTSTATUS NTAPI KeUserModeCallback(IN ULONG RoutineIndex, IN PVOID Argument, IN ULONG ArgumentLength, OUT PVOID *Result, OUT PULONG ResultLength)
static const char * wine_dbgstr_rect(const RECT *prc)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define DBG_DEFAULT_CHANNEL(ch)
COLORREF FASTCALL GreGetTextColor(HDC)
int FASTCALL GreGetGraphicsMode(HDC)
#define NT_SUCCESS(StatCode)
#define HeapFree(x, y, z)
VOID WINAPI ExitProcess(IN UINT uExitCode)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
#define ExAllocatePoolWithTag(hernya, size, tag)
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
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)
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLuint GLuint GLsizei count
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
GLint GLint GLsizei width
GLdouble GLdouble GLdouble GLdouble top
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
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
#define EXCEPTION_EXECUTE_HANDLER
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
BOOL FASTCALL GreMoveTo(HDC hdc, INT x, INT y, LPPOINT pptOut)
#define memcpy(s1, s2, n)
#define memmove(s1, s2, n)
#define ExFreePoolWithTag(_P, _T)
BOOL WINAPI GreGetViewportExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
BOOL WINAPI GreGetWindowExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
__kernel_entry W32KAPI INT APIENTRY NtGdiExtSelectClipRgn(_In_ HDC hdc, _In_opt_ HRGN hrgn, _In_ INT iMode)
__kernel_entry W32KAPI INT APIENTRY NtGdiIntersectClipRect(_In_ HDC hdc, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
__kernel_entry W32KAPI INT APIENTRY NtGdiGetRandomRgn(_In_ HDC hdc, _In_ HRGN hrgn, _In_ INT iRgn)
__kernel_entry W32KAPI HPEN APIENTRY NtGdiCreatePen(_In_ INT iPenStyle, _In_ INT iPenWidth, _In_ COLORREF cr, _In_opt_ HBRUSH hbr)
__kernel_entry W32KAPI HPEN APIENTRY NtGdiSelectPen(_In_ HDC hdc, _In_ HPEN hpen)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiLineTo(_In_ HDC hdc, _In_ INT x, _In_ INT y)
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)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
__inline int before(__u32 seq1, __u32 seq2)
BOOL UserExtTextOutW(HDC hdc, INT x, INT y, UINT flags, PRECTL lprc, LPCWSTR lpString, UINT count)
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
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)
BOOL WINAPI GetTextMetricsW(_In_ HDC hdc, _Out_ LPTEXTMETRICW lptm)
BOOL APIENTRY GetTextExtentPointW(_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpString, _In_ INT cchString, _Out_ LPSIZE lpsz)
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)
COLORREF WINAPI GetTextColor(_In_ HDC hdc)
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
BOOL FASTCALL GreGetTextExtentW(HDC hDC, LPCWSTR lpwsz, INT cwc, LPSIZE psize, UINT flOpts)
BOOL FASTCALL GreGetTextExtentExW(HDC hDC, LPCWSTR String, ULONG Count, ULONG MaxExtent, PULONG Fit, PULONG Dx, LPSIZE pSize, FLONG fl)
BOOL WINAPI GreGetTextMetricsW(_In_ HDC hdc, _Out_ LPTEXTMETRICW lptm)
struct _LPK_CALLBACK_ARGUMENTS LPK_CALLBACK_ARGUMENTS
PVOID FASTCALL IntCbAllocateMemory(ULONG Size)
VOID FASTCALL IntCbFreeMemory(PVOID Data)
void _font_assert(const char *msg, const char *file, int line)
static void TEXT_DrawUnderscore(HDC hdc, int x, int y, const WCHAR *str, int offset, const RECT *rect)
static int remainder_is_none_or_newline(int num_chars, const WCHAR *str)
struct tag_ellipsis_data ellipsis_data
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)
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)
FORCEINLINE BOOL IsCJKT(WCHAR wch)
static const WCHAR KinsokuClassA[]
INT WINAPI DrawTextExWorker(HDC hdc, LPWSTR str, INT i_count, LPRECT rect, UINT flags, LPDRAWTEXTPARAMS dtp)
static int TEXT_Reprefix(const WCHAR *str, unsigned int ns, const ellipsis_data *pe)
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)
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)
static const WCHAR ELLIPSISW[]
static void TEXT_SkipChars(int *new_count, const WCHAR **new_str, int start_count, const WCHAR *start_str, int max, int n, int prefix)
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI GetGraphicsMode(_In_ HDC)
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
BOOL WINAPI GdiFlush(void)
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
BOOL WINAPI GetWindowExtEx(_In_ HDC, _Out_ LPSIZE)
BOOL WINAPI GetViewportExtEx(_In_ HDC, _Out_ LPSIZE)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define DT_EXTERNALLEADING
_In_ int _Inout_ LPRECT lprc