Clean out the hack on BASS/TREBLE and suppress them in the mask as was
[wine/testsucceed.git] / objects / text.c
blobb5b7cdf1eacbd36d5717cc2f427d2649a86490b1
1 /*
2 * text functions
4 * Copyright 1993, 1994 Alexandre Julliard
6 */
8 #include <string.h>
10 #include "windef.h"
11 #include "wingdi.h"
12 #include "wine/winuser16.h"
13 #include "winbase.h"
14 #include "winerror.h"
15 #include "dc.h"
16 #include "gdi.h"
17 #include "heap.h"
18 #include "debugtools.h"
19 #include "winnls.h"
21 DEFAULT_DEBUG_CHANNEL(text);
24 /***********************************************************************
25 * ExtTextOut16 (GDI.351)
27 BOOL16 WINAPI ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
28 const RECT16 *lprect, LPCSTR str, UINT16 count,
29 const INT16 *lpDx )
31 BOOL ret;
32 int i;
33 RECT rect32;
34 LPINT lpdx32 = NULL;
36 if (lpDx) {
37 lpdx32 = (LPINT)HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count );
38 if(lpdx32 == NULL) return FALSE;
39 for (i=count;i--;) lpdx32[i]=lpDx[i];
41 if (lprect) CONV_RECT16TO32(lprect,&rect32);
42 ret = ExtTextOutA(hdc,x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
43 if (lpdx32) HeapFree( GetProcessHeap(), 0, lpdx32 );
44 return ret;
48 /***********************************************************************
49 * ExtTextOutA (GDI32.98)
51 BOOL WINAPI ExtTextOutA( HDC hdc, INT x, INT y, UINT flags,
52 const RECT *lprect, LPCSTR str, UINT count,
53 const INT *lpDx )
55 LPWSTR p;
56 INT ret;
57 UINT codepage = CP_ACP; /* FIXME: get codepage of font charset */
58 UINT wlen;
59 LPINT lpDxW = NULL;
61 wlen = MultiByteToWideChar(codepage,0,str,count,NULL,0);
62 if(lpDx){
63 int i, j;
64 i = 0; j = 0;
66 lpDxW = (LPINT)HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(INT));
67 while(i < count){
68 if(IsDBCSLeadByteEx(codepage, str[i])){
69 lpDxW[j++] = lpDx[i] + lpDx[i+1];
70 i = i + 2;
72 else{
73 lpDxW[j++] = lpDx[i];
74 i = i + 1;
77 lpDx = lpDxW;
79 p = HeapAlloc( GetProcessHeap(), 0, wlen * sizeof(WCHAR) );
80 wlen = MultiByteToWideChar(codepage,0,str,count,p,wlen);
81 ret = ExtTextOutW( hdc, x, y, flags, lprect, p, wlen, lpDxW );
82 if (lpDxW) HeapFree( GetProcessHeap(), 0, lpDxW );
83 HeapFree( GetProcessHeap(), 0, p );
84 return ret;
88 /***********************************************************************
89 * ExtTextOutW (GDI32.99)
91 BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
92 const RECT *lprect, LPCWSTR str, UINT count,
93 const INT *lpDx )
95 DC * dc = DC_GetDCPtr( hdc );
96 return dc && dc->funcs->pExtTextOut &&
97 dc->funcs->pExtTextOut(dc,x,y,flags,lprect,str,count,lpDx);
101 /***********************************************************************
102 * TextOut16 (GDI.33)
104 BOOL16 WINAPI TextOut16( HDC16 hdc, INT16 x, INT16 y, LPCSTR str, INT16 count )
106 return ExtTextOut16( hdc, x, y, 0, NULL, str, count, NULL );
110 /***********************************************************************
111 * TextOutA (GDI32.355)
113 BOOL WINAPI TextOutA( HDC hdc, INT x, INT y, LPCSTR str, INT count )
115 return ExtTextOutA( hdc, x, y, 0, NULL, str, count, NULL );
119 /***********************************************************************
120 * TextOutW (GDI32.356)
122 BOOL WINAPI TextOutW(HDC hdc, INT x, INT y, LPCWSTR str, INT count)
124 return ExtTextOutW( hdc, x, y, 0, NULL, str, count, NULL );
128 /***********************************************************************
129 * GetTextCharset [GDI32.226] Gets character set for font in DC
131 * NOTES
132 * Should it return a UINT32 instead of an INT32?
133 * => YES, as GetTextCharsetInfo returns UINT32
135 * RETURNS
136 * Success: Character set identifier
137 * Failure: DEFAULT_CHARSET
139 UINT WINAPI GetTextCharset(
140 HDC hdc) /* [in] Handle to device context */
142 /* MSDN docs say this is equivalent */
143 return GetTextCharsetInfo(hdc, NULL, 0);
146 /***********************************************************************
147 * GetTextCharset16 [GDI.612]
149 UINT16 WINAPI GetTextCharset16(HDC16 hdc)
151 return (UINT16)GetTextCharset(hdc);
154 /***********************************************************************
155 * GetTextCharsetInfo [GDI32.381] Gets character set for font
157 * NOTES
158 * Should csi be an LPFONTSIGNATURE instead of an LPCHARSETINFO?
159 * Should it return a UINT32 instead of an INT32?
160 * => YES and YES, from win32.hlp from Borland
162 * RETURNS
163 * Success: Character set identifier
164 * Failure: DEFAULT_CHARSET
166 UINT WINAPI GetTextCharsetInfo(
167 HDC hdc, /* [in] Handle to device context */
168 LPFONTSIGNATURE fs, /* [out] Pointer to struct to receive data */
169 DWORD flags) /* [in] Reserved - must be 0 */
171 HGDIOBJ hFont;
172 UINT charSet = DEFAULT_CHARSET;
173 LOGFONTW lf;
174 CHARSETINFO csinfo;
176 hFont = GetCurrentObject(hdc, OBJ_FONT);
177 if (hFont == 0)
178 return(DEFAULT_CHARSET);
179 if ( GetObjectW(hFont, sizeof(LOGFONTW), &lf) != 0 )
180 charSet = lf.lfCharSet;
182 if (fs != NULL) {
183 if (!TranslateCharsetInfo((LPDWORD)charSet, &csinfo, TCI_SRCCHARSET))
184 return (DEFAULT_CHARSET);
185 memcpy(fs, &csinfo.fs, sizeof(FONTSIGNATURE));
187 return charSet;
190 /***********************************************************************
191 * PolyTextOutA [GDI.402] Draw several Strings
193 BOOL WINAPI PolyTextOutA (
194 HDC hdc, /* Handle to device context */
195 PPOLYTEXTA pptxt, /* array of strings */
196 INT cStrings /* Number of strings in array */
199 FIXME("stub!\n");
200 SetLastError ( ERROR_CALL_NOT_IMPLEMENTED );
201 return 0;
206 /***********************************************************************
207 * PolyTextOutW [GDI.403] Draw several Strings
209 BOOL WINAPI PolyTextOutW (
210 HDC hdc, /* Handle to device context */
211 PPOLYTEXTW pptxt, /* array of strings */
212 INT cStrings /* Number of strings in array */
215 FIXME("stub!\n");
216 SetLastError ( ERROR_CALL_NOT_IMPLEMENTED );
217 return 0;