Improved the TTY driver.
[wine/multimedia.git] / objects / text.c
blobc542a947185f41506cd89f165a8df40f7893ad0c
1 /*
2 * text functions
4 * Copyright 1993, 1994 Alexandre Julliard
6 */
8 #include <string.h>
10 #include "wine/winuser16.h"
11 #include "winbase.h"
12 #include "winuser.h"
13 #include "winerror.h"
14 #include "dc.h"
15 #include "gdi.h"
16 #include "heap.h"
17 #include "debugtools.h"
18 #include "cache.h"
19 #include "debugstr.h"
21 DEFAULT_DEBUG_CHANNEL(text)
23 #define TAB 9
24 #define LF 10
25 #define CR 13
26 #define SPACE 32
27 #define PREFIX 38
29 #define SWAP_INT(a,b) { int t = a; a = b; b = t; }
31 static int tabstop = 8;
32 static int tabwidth;
33 static int spacewidth;
34 static int prefix_offset;
36 static const char *TEXT_NextLine( HDC16 hdc, const char *str, int *count,
37 char *dest, int *len, int width, WORD format)
39 /* Return next line of text from a string.
41 * hdc - handle to DC.
42 * str - string to parse into lines.
43 * count - length of str.
44 * dest - destination in which to return line.
45 * len - length of resultant line in dest in chars.
46 * width - maximum width of line in pixels.
47 * format - format type passed to DrawText.
49 * Returns pointer to next char in str after end of the line
50 * or NULL if end of str reached.
53 int i = 0, j = 0, k;
54 int plen = 0;
55 int numspaces;
56 SIZE16 size;
57 int lasttab = 0;
58 int wb_i = 0, wb_j = 0, wb_count = 0;
60 while (*count)
62 switch (str[i])
64 case CR:
65 case LF:
66 if (!(format & DT_SINGLELINE))
68 if ((*count > 1) && (str[i] == CR) && (str[i+1] == LF))
70 (*count)--;
71 i++;
73 i++;
74 *len = j;
75 (*count)--;
76 return (&str[i]);
78 dest[j++] = str[i++];
79 if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
80 (format & DT_WORDBREAK))
82 if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size))
83 return NULL;
84 plen += size.cx;
86 break;
88 case PREFIX:
89 if (!(format & DT_NOPREFIX) && *count > 1)
91 if (str[++i] == PREFIX)
92 (*count)--;
93 else {
94 prefix_offset = j;
95 break;
98 dest[j++] = str[i++];
99 if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
100 (format & DT_WORDBREAK))
102 if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size))
103 return NULL;
104 plen += size.cx;
106 break;
108 case TAB:
109 if (format & DT_EXPANDTABS)
111 wb_i = ++i;
112 wb_j = j;
113 wb_count = *count;
115 if (!GetTextExtentPoint16(hdc, &dest[lasttab], j - lasttab,
116 &size))
117 return NULL;
119 numspaces = (tabwidth - size.cx) / spacewidth;
120 for (k = 0; k < numspaces; k++)
121 dest[j++] = SPACE;
122 plen += tabwidth - size.cx;
123 lasttab = wb_j + numspaces;
125 else
127 dest[j++] = str[i++];
128 if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
129 (format & DT_WORDBREAK))
131 if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size))
132 return NULL;
133 plen += size.cx;
136 break;
138 case SPACE:
139 dest[j++] = str[i++];
140 if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
141 (format & DT_WORDBREAK))
143 wb_i = i;
144 wb_j = j - 1;
145 wb_count = *count;
146 if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size))
147 return NULL;
148 plen += size.cx;
150 break;
152 default:
153 dest[j++] = str[i++];
154 if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
155 (format & DT_WORDBREAK))
157 if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size))
158 return NULL;
159 plen += size.cx;
163 (*count)--;
164 if (!(format & DT_NOCLIP) || (format & DT_WORDBREAK))
166 if (plen > width)
168 if (format & DT_WORDBREAK)
170 if (wb_j)
172 *len = wb_j;
173 *count = wb_count - 1;
174 return (&str[wb_i]);
177 else
179 *len = j;
180 return (&str[i]);
186 *len = j;
187 return NULL;
191 /***********************************************************************
192 * DrawText16 (USER.85)
194 INT16 WINAPI DrawText16( HDC16 hdc, LPCSTR str, INT16 i_count,
195 LPRECT16 rect, UINT16 flags )
197 SIZE16 size;
198 const char *strPtr;
199 static char line[1024];
200 int len, lh, count=i_count;
201 int prefix_x = 0;
202 int prefix_end = 0;
203 TEXTMETRIC16 tm;
204 int x = rect->left, y = rect->top;
205 int width = rect->right - rect->left;
206 int max_width = 0;
208 TRACE("%s, %d , [(%d,%d),(%d,%d)]\n",
209 debugstr_an (str, count), count,
210 rect->left, rect->top, rect->right, rect->bottom);
212 if (count == -1) count = strlen(str);
213 strPtr = str;
215 GetTextMetrics16(hdc, &tm);
216 if (flags & DT_EXTERNALLEADING)
217 lh = tm.tmHeight + tm.tmExternalLeading;
218 else
219 lh = tm.tmHeight;
221 if (flags & DT_TABSTOP)
222 tabstop = flags >> 8;
224 if (flags & DT_EXPANDTABS)
226 GetTextExtentPoint16(hdc, " ", 1, &size);
227 spacewidth = size.cx;
228 GetTextExtentPoint16(hdc, "o", 1, &size);
229 tabwidth = size.cx * tabstop;
232 if (flags & DT_CALCRECT) flags |= DT_NOCLIP;
236 prefix_offset = -1;
237 strPtr = TEXT_NextLine(hdc, strPtr, &count, line, &len, width, flags);
239 if (prefix_offset != -1)
241 GetTextExtentPoint16(hdc, line, prefix_offset, &size);
242 prefix_x = size.cx;
243 GetTextExtentPoint16(hdc, line, prefix_offset + 1, &size);
244 prefix_end = size.cx - 1;
247 if (!GetTextExtentPoint16(hdc, line, len, &size)) return 0;
248 if (flags & DT_CENTER) x = (rect->left + rect->right -
249 size.cx) / 2;
250 else if (flags & DT_RIGHT) x = rect->right - size.cx;
252 if (flags & DT_SINGLELINE)
254 if (flags & DT_VCENTER) y = rect->top +
255 (rect->bottom - rect->top) / 2 - size.cy / 2;
256 else if (flags & DT_BOTTOM) y = rect->bottom - size.cy;
258 if (!(flags & DT_CALCRECT))
260 if (!ExtTextOut16(hdc, x, y, (flags & DT_NOCLIP) ? 0 : ETO_CLIPPED,
261 rect, line, len, NULL )) return 0;
262 if (prefix_offset != -1)
264 HPEN hpen = CreatePen( PS_SOLID, 1, GetTextColor(hdc) );
265 HPEN oldPen = SelectObject( hdc, hpen );
266 MoveTo16(hdc, x + prefix_x, y + tm.tmAscent + 1 );
267 LineTo(hdc, x + prefix_end + 1, y + tm.tmAscent + 1 );
268 SelectObject( hdc, oldPen );
269 DeleteObject( hpen );
272 else if (size.cx > max_width)
273 max_width = size.cx;
275 y += lh;
276 if (strPtr)
278 if (!(flags & DT_NOCLIP))
280 if (y > rect->bottom - lh)
281 break;
285 while (strPtr);
286 if (flags & DT_CALCRECT)
288 rect->right = rect->left + max_width;
289 rect->bottom = y;
291 return y - rect->top;
295 /***********************************************************************
296 * DrawText32A (USER32.164)
298 INT WINAPI DrawTextA( HDC hdc, LPCSTR str, INT count,
299 LPRECT rect, UINT flags )
301 RECT16 rect16;
302 INT16 ret;
304 if (!rect)
305 return DrawText16( (HDC16)hdc, str, (INT16)count, NULL, (UINT16)flags);
306 CONV_RECT32TO16( rect, &rect16 );
307 ret = DrawText16( (HDC16)hdc, str, (INT16)count, &rect16, (UINT16)flags );
308 CONV_RECT16TO32( &rect16, rect );
309 return ret;
313 /***********************************************************************
314 * DrawText32W (USER32.167)
316 INT WINAPI DrawTextW( HDC hdc, LPCWSTR str, INT count,
317 LPRECT rect, UINT flags )
319 LPSTR p = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
320 INT ret = DrawTextA( hdc, p, count, rect, flags );
321 HeapFree( GetProcessHeap(), 0, p );
322 return ret;
325 /***********************************************************************
326 * DrawTextEx32A (USER32.165)
328 INT WINAPI DrawTextExA( HDC hdc, LPCSTR str, INT count,
329 LPRECT rect, UINT flags, LPDRAWTEXTPARAMS dtp )
331 TRACE("(%d,'%s',%d,%p,0x%08x,%p)\n",hdc,str,count,rect,flags,dtp);
332 if(dtp) {
333 FIXME("Ignores params:%d,%d,%d,%d,%d\n",dtp->cbSize,
334 dtp->iTabLength,dtp->iLeftMargin,dtp->iRightMargin,
335 dtp->uiLengthDrawn);
337 return DrawTextA(hdc,str,count,rect,flags);
340 /***********************************************************************
341 * DrawTextEx32W (USER32.166)
343 INT WINAPI DrawTextExW( HDC hdc, LPCWSTR str, INT count,
344 LPRECT rect, UINT flags, LPDRAWTEXTPARAMS dtp )
346 TRACE("(%d,%p,%d,%p,0x%08x,%p)\n",hdc,str,count,rect,flags,dtp);
347 FIXME("ignores extended functionality\n");
348 return DrawTextW(hdc,str,count,rect,flags);
351 /***********************************************************************
352 * ExtTextOut16 (GDI.351)
354 BOOL16 WINAPI ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
355 const RECT16 *lprect, LPCSTR str, UINT16 count,
356 const INT16 *lpDx )
358 BOOL ret;
359 int i;
360 RECT rect32;
361 LPINT lpdx32 = NULL;
363 if (lpDx) lpdx32 = (LPINT)HEAP_xalloc( GetProcessHeap(), 0,
364 sizeof(INT)*count );
365 if (lprect) CONV_RECT16TO32(lprect,&rect32);
366 if (lpdx32) for (i=count;i--;) lpdx32[i]=lpDx[i];
367 ret = ExtTextOutA(hdc,x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
368 if (lpdx32) HeapFree( GetProcessHeap(), 0, lpdx32 );
369 return ret;
375 /***********************************************************************
376 * ExtTextOut32A (GDI32.98)
378 BOOL WINAPI ExtTextOutA( HDC hdc, INT x, INT y, UINT flags,
379 const RECT *lprect, LPCSTR str, UINT count,
380 const INT *lpDx )
382 DC * dc = DC_GetDCPtr( hdc );
383 return dc && dc->funcs->pExtTextOut &&
384 dc->funcs->pExtTextOut(dc,x,y,flags,lprect,str,count,lpDx);
388 /***********************************************************************
389 * ExtTextOut32W (GDI32.99)
391 BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
392 const RECT *lprect, LPCWSTR str, UINT count,
393 const INT *lpDx )
395 LPSTR p = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
396 INT ret = ExtTextOutA( hdc, x, y, flags, lprect, p, count, lpDx );
397 HeapFree( GetProcessHeap(), 0, p );
398 return ret;
402 /***********************************************************************
403 * TextOut16 (GDI.33)
405 BOOL16 WINAPI TextOut16( HDC16 hdc, INT16 x, INT16 y, LPCSTR str, INT16 count )
407 return ExtTextOut16( hdc, x, y, 0, NULL, str, count, NULL );
411 /***********************************************************************
412 * TextOut32A (GDI32.355)
414 BOOL WINAPI TextOutA( HDC hdc, INT x, INT y, LPCSTR str, INT count )
416 return ExtTextOutA( hdc, x, y, 0, NULL, str, count, NULL );
420 /***********************************************************************
421 * TextOut32W (GDI32.356)
423 BOOL WINAPI TextOutW(HDC hdc, INT x, INT y, LPCWSTR str, INT count)
425 return ExtTextOutW( hdc, x, y, 0, NULL, str, count, NULL );
429 /***********************************************************************
430 * TEXT_GrayString
432 * FIXME: The call to 16-bit code only works because the wine GDI is a 16-bit
433 * heap and we can guarantee that the handles fit in an INT16. We have to
434 * rethink the strategy once the migration to NT handles is complete.
435 * We are going to get a lot of code-duplication once this migration is
436 * completed...
439 static BOOL TEXT_GrayString(HDC hdc, HBRUSH hb,
440 GRAYSTRINGPROC fn, LPARAM lp, INT len,
441 INT x, INT y, INT cx, INT cy,
442 BOOL unicode, BOOL _32bit)
444 HBITMAP hbm, hbmsave;
445 HBRUSH hbsave;
446 HFONT hfsave;
447 HDC memdc = CreateCompatibleDC(hdc);
448 int slen = len;
449 BOOL retval = TRUE;
450 RECT r;
451 COLORREF fg, bg;
453 if(!hdc) return FALSE;
455 if(len == 0)
457 if(unicode)
458 slen = lstrlenW((LPCWSTR)lp);
459 else if(_32bit)
460 slen = lstrlenA((LPCSTR)lp);
461 else
462 slen = lstrlenA((LPCSTR)PTR_SEG_TO_LIN(lp));
465 if((cx == 0 || cy == 0) && slen != -1)
467 SIZE s;
468 if(unicode)
469 GetTextExtentPoint32W(hdc, (LPCWSTR)lp, slen, &s);
470 else if(_32bit)
471 GetTextExtentPoint32A(hdc, (LPCSTR)lp, slen, &s);
472 else
473 GetTextExtentPoint32A(hdc, (LPCSTR)PTR_SEG_TO_LIN(lp), slen, &s);
474 if(cx == 0) cx = s.cx;
475 if(cy == 0) cy = s.cy;
478 r.left = r.top = 0;
479 r.right = cx;
480 r.bottom = cy;
482 hbm = CreateBitmap(cx, cy, 1, 1, NULL);
483 hbmsave = (HBITMAP)SelectObject(memdc, hbm);
484 FillRect(memdc, &r, (HBRUSH)GetStockObject(BLACK_BRUSH));
485 SetTextColor(memdc, RGB(255, 255, 255));
486 SetBkColor(memdc, RGB(0, 0, 0));
487 hfsave = (HFONT)SelectObject(memdc, GetCurrentObject(hdc, OBJ_FONT));
489 if(fn)
490 if(_32bit)
491 retval = fn(memdc, lp, slen);
492 else
493 retval = (BOOL)((BOOL16)((GRAYSTRINGPROC16)fn)((HDC16)memdc, lp, (INT16)slen));
494 else
495 if(unicode)
496 TextOutW(memdc, 0, 0, (LPCWSTR)lp, slen);
497 else if(_32bit)
498 TextOutA(memdc, 0, 0, (LPCSTR)lp, slen);
499 else
500 TextOutA(memdc, 0, 0, (LPCSTR)PTR_SEG_TO_LIN(lp), slen);
502 SelectObject(memdc, hfsave);
505 * Windows doc says that the bitmap isn't grayed when len == -1 and
506 * the callback function returns FALSE. However, testing this on
507 * win95 showed otherwise...
509 #ifdef GRAYSTRING_USING_DOCUMENTED_BEHAVIOUR
510 if(retval || len != -1)
511 #endif
513 hbsave = (HBRUSH)SelectObject(memdc, CACHE_GetPattern55AABrush());
514 PatBlt(memdc, 0, 0, cx, cy, 0x000A0329);
515 SelectObject(memdc, hbsave);
518 if(hb) hbsave = (HBRUSH)SelectObject(hdc, hb);
519 fg = SetTextColor(hdc, RGB(0, 0, 0));
520 bg = SetBkColor(hdc, RGB(255, 255, 255));
521 BitBlt(hdc, x, y, cx, cy, memdc, 0, 0, 0x00E20746);
522 SetTextColor(hdc, fg);
523 SetBkColor(hdc, bg);
524 if(hb) SelectObject(hdc, hbsave);
526 SelectObject(memdc, hbmsave);
527 DeleteObject(hbm);
528 DeleteDC(memdc);
529 return retval;
533 /***********************************************************************
534 * GrayString16 (USER.185)
536 BOOL16 WINAPI GrayString16( HDC16 hdc, HBRUSH16 hbr, GRAYSTRINGPROC16 gsprc,
537 LPARAM lParam, INT16 cch, INT16 x, INT16 y,
538 INT16 cx, INT16 cy )
540 return TEXT_GrayString(hdc, hbr, (GRAYSTRINGPROC)gsprc, lParam, cch, x, y, cx, cy, FALSE, FALSE);
544 /***********************************************************************
545 * GrayString32A (USER32.315)
547 BOOL WINAPI GrayStringA( HDC hdc, HBRUSH hbr, GRAYSTRINGPROC gsprc,
548 LPARAM lParam, INT cch, INT x, INT y,
549 INT cx, INT cy )
551 return TEXT_GrayString(hdc, hbr, gsprc, lParam, cch, x, y, cx, cy, FALSE, TRUE);
555 /***********************************************************************
556 * GrayString32W (USER32.316)
558 BOOL WINAPI GrayStringW( HDC hdc, HBRUSH hbr, GRAYSTRINGPROC gsprc,
559 LPARAM lParam, INT cch, INT x, INT y,
560 INT cx, INT cy )
562 return TEXT_GrayString(hdc, hbr, gsprc, lParam, cch, x, y, cx, cy, TRUE, TRUE);
566 /***********************************************************************
567 * TEXT_TabbedTextOut
569 * Helper function for TabbedTextOut() and GetTabbedTextExtent().
570 * Note: this doesn't work too well for text-alignment modes other
571 * than TA_LEFT|TA_TOP. But we want bug-for-bug compatibility :-)
573 LONG TEXT_TabbedTextOut( HDC hdc, INT x, INT y, LPCSTR lpstr,
574 INT count, INT cTabStops, const INT16 *lpTabPos16,
575 const INT *lpTabPos32, INT nTabOrg,
576 BOOL fDisplayText )
578 INT defWidth;
579 DWORD extent = 0;
580 int i, tabPos = x;
581 int start = x;
583 if (cTabStops == 1)
585 defWidth = lpTabPos32 ? *lpTabPos32 : *lpTabPos16;
586 cTabStops = 0;
588 else
590 TEXTMETRIC16 tm;
591 GetTextMetrics16( hdc, &tm );
592 defWidth = 8 * tm.tmAveCharWidth;
595 while (count > 0)
597 for (i = 0; i < count; i++)
598 if (lpstr[i] == '\t') break;
599 extent = GetTextExtent16( hdc, lpstr, i );
600 if (lpTabPos32)
602 while ((cTabStops > 0) &&
603 (nTabOrg + *lpTabPos32 <= x + LOWORD(extent)))
605 lpTabPos32++;
606 cTabStops--;
609 else
611 while ((cTabStops > 0) &&
612 (nTabOrg + *lpTabPos16 <= x + LOWORD(extent)))
614 lpTabPos16++;
615 cTabStops--;
618 if (i == count)
619 tabPos = x + LOWORD(extent);
620 else if (cTabStops > 0)
621 tabPos = nTabOrg + (lpTabPos32 ? *lpTabPos32 : *lpTabPos16);
622 else
623 tabPos = nTabOrg + ((x + LOWORD(extent) - nTabOrg) / defWidth + 1) * defWidth;
624 if (fDisplayText)
626 RECT r;
627 SetRect( &r, x, y, tabPos, y+HIWORD(extent) );
628 ExtTextOutA( hdc, x, y,
629 GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0,
630 &r, lpstr, i, NULL );
632 x = tabPos;
633 count -= i+1;
634 lpstr += i+1;
636 return MAKELONG(tabPos - start, HIWORD(extent));
640 /***********************************************************************
641 * TabbedTextOut16 (USER.196)
643 LONG WINAPI TabbedTextOut16( HDC16 hdc, INT16 x, INT16 y, LPCSTR lpstr,
644 INT16 count, INT16 cTabStops,
645 const INT16 *lpTabPos, INT16 nTabOrg )
647 TRACE("%04x %d,%d '%.*s' %d\n",
648 hdc, x, y, count, lpstr, count );
649 return TEXT_TabbedTextOut( hdc, x, y, lpstr, count, cTabStops,
650 lpTabPos, NULL, nTabOrg, TRUE );
654 /***********************************************************************
655 * TabbedTextOut32A (USER32.542)
657 LONG WINAPI TabbedTextOutA( HDC hdc, INT x, INT y, LPCSTR lpstr,
658 INT count, INT cTabStops,
659 const INT *lpTabPos, INT nTabOrg )
661 TRACE("%04x %d,%d '%.*s' %d\n",
662 hdc, x, y, count, lpstr, count );
663 return TEXT_TabbedTextOut( hdc, x, y, lpstr, count, cTabStops,
664 NULL, lpTabPos, nTabOrg, TRUE );
668 /***********************************************************************
669 * TabbedTextOut32W (USER32.543)
671 LONG WINAPI TabbedTextOutW( HDC hdc, INT x, INT y, LPCWSTR str,
672 INT count, INT cTabStops,
673 const INT *lpTabPos, INT nTabOrg )
675 LONG ret;
676 LPSTR p = HEAP_xalloc( GetProcessHeap(), 0, count + 1 );
677 lstrcpynWtoA( p, str, count + 1 );
678 ret = TabbedTextOutA( hdc, x, y, p, count, cTabStops,
679 lpTabPos, nTabOrg );
680 HeapFree( GetProcessHeap(), 0, p );
681 return ret;
685 /***********************************************************************
686 * GetTabbedTextExtent16 (USER.197)
688 DWORD WINAPI GetTabbedTextExtent16( HDC16 hdc, LPCSTR lpstr, INT16 count,
689 INT16 cTabStops, const INT16 *lpTabPos )
691 TRACE("%04x '%.*s' %d\n",
692 hdc, count, lpstr, count );
693 return TEXT_TabbedTextOut( hdc, 0, 0, lpstr, count, cTabStops,
694 lpTabPos, NULL, 0, FALSE );
698 /***********************************************************************
699 * GetTabbedTextExtent32A (USER32.293)
701 DWORD WINAPI GetTabbedTextExtentA( HDC hdc, LPCSTR lpstr, INT count,
702 INT cTabStops, const INT *lpTabPos )
704 TRACE("%04x '%.*s' %d\n",
705 hdc, count, lpstr, count );
706 return TEXT_TabbedTextOut( hdc, 0, 0, lpstr, count, cTabStops,
707 NULL, lpTabPos, 0, FALSE );
711 /***********************************************************************
712 * GetTabbedTextExtent32W (USER32.294)
714 DWORD WINAPI GetTabbedTextExtentW( HDC hdc, LPCWSTR lpstr, INT count,
715 INT cTabStops, const INT *lpTabPos )
717 LONG ret;
718 LPSTR p = HEAP_xalloc( GetProcessHeap(), 0, count + 1 );
719 lstrcpynWtoA( p, lpstr, count + 1 );
720 ret = GetTabbedTextExtentA( hdc, p, count, cTabStops, lpTabPos );
721 HeapFree( GetProcessHeap(), 0, p );
722 return ret;
725 /***********************************************************************
726 * GetTextCharset32 [GDI32.226] Gets character set for font in DC
728 * NOTES
729 * Should it return a UINT32 instead of an INT32?
730 * => YES, as GetTextCharsetInfo returns UINT32
732 * RETURNS
733 * Success: Character set identifier
734 * Failure: DEFAULT_CHARSET
736 UINT WINAPI GetTextCharset(
737 HDC hdc) /* [in] Handle to device context */
739 /* MSDN docs say this is equivalent */
740 return GetTextCharsetInfo(hdc, NULL, 0);
743 /***********************************************************************
744 * GetTextCharset16 [GDI.612]
746 UINT16 WINAPI GetTextCharset16(HDC16 hdc)
748 return (UINT16)GetTextCharset(hdc);
751 /***********************************************************************
752 * GetTextCharsetInfo [GDI32.381] Gets character set for font
754 * NOTES
755 * Should csi be an LPFONTSIGNATURE instead of an LPCHARSETINFO?
756 * Should it return a UINT32 instead of an INT32?
757 * => YES and YES, from win32.hlp from Borland
759 * RETURNS
760 * Success: Character set identifier
761 * Failure: DEFAULT_CHARSET
763 UINT WINAPI GetTextCharsetInfo(
764 HDC hdc, /* [in] Handle to device context */
765 LPFONTSIGNATURE fs, /* [out] Pointer to struct to receive data */
766 DWORD flags) /* [in] Reserved - must be 0 */
768 HGDIOBJ hFont;
769 UINT charSet = DEFAULT_CHARSET;
770 LOGFONTW lf;
771 CHARSETINFO csinfo;
773 hFont = GetCurrentObject(hdc, OBJ_FONT);
774 if (hFont == 0)
775 return(DEFAULT_CHARSET);
776 if ( GetObjectW(hFont, sizeof(LOGFONTW), &lf) != 0 )
777 charSet = lf.lfCharSet;
779 if (fs != NULL) {
780 if (!TranslateCharsetInfo((LPDWORD)charSet, &csinfo, TCI_SRCCHARSET))
781 return (DEFAULT_CHARSET);
782 memcpy(fs, &csinfo.fs, sizeof(FONTSIGNATURE));
784 return charSet;
787 /***********************************************************************
788 * PolyTextOutA [GDI.402] Draw several Strings
790 BOOL WINAPI PolyTextOutA (
791 HDC hdc, /* Handle to device context */
792 PPOLYTEXTA pptxt, /* array of strings */
793 INT cStrings /* Number of strings in array */
796 FIXME("stub!\n");
797 SetLastError ( ERROR_CALL_NOT_IMPLEMENTED );
798 return 0;
803 /***********************************************************************
804 * PolyTextOutW [GDI.403] Draw several Strings
806 BOOL WINAPI PolyTextOutW (
807 HDC hdc, /* Handle to device context */
808 PPOLYTEXTW pptxt, /* array of strings */
809 INT cStrings /* Number of strings in array */
812 FIXME("stub!\n");
813 SetLastError ( ERROR_CALL_NOT_IMPLEMENTED );
814 return 0;