4 * Copyright 1993, 1994 Alexandre Julliard
12 #include "wine/winuser16.h"
18 #include "debugtools.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
,
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
);
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
,
55 DC
* dc
= DC_GetDCUpdate( hdc
);
57 UINT codepage
= CP_ACP
; /* FIXME: get codepage of font charset */
61 if (!dc
) return FALSE
;
63 if (dc
->funcs
->pExtTextOut
)
65 UINT wlen
= MultiByteToWideChar(codepage
,0,str
,count
,NULL
,0);
70 lpDxW
= (LPINT
)HeapAlloc( GetProcessHeap(), 0, wlen
*sizeof(INT
));
73 if(IsDBCSLeadByteEx(codepage
, str
[i
]))
75 lpDxW
[j
++] = lpDx
[i
] + lpDx
[i
+1];
85 if ((p
= HeapAlloc( GetProcessHeap(), 0, wlen
* sizeof(WCHAR
) )))
87 wlen
= MultiByteToWideChar(codepage
,0,str
,count
,p
,wlen
);
88 ret
= dc
->funcs
->pExtTextOut( dc
, x
, y
, flags
, lprect
, p
, wlen
, lpDxW
);
89 HeapFree( GetProcessHeap(), 0, p
);
91 if (lpDxW
) HeapFree( GetProcessHeap(), 0, lpDxW
);
93 GDI_ReleaseObj( hdc
);
98 /***********************************************************************
99 * ExtTextOutW (GDI32.99)
101 BOOL WINAPI
ExtTextOutW( HDC hdc
, INT x
, INT y
, UINT flags
,
102 const RECT
*lprect
, LPCWSTR str
, UINT count
,
106 DC
* dc
= DC_GetDCUpdate( hdc
);
109 if(dc
->funcs
->pExtTextOut
)
110 ret
= dc
->funcs
->pExtTextOut(dc
,x
,y
,flags
,lprect
,str
,count
,lpDx
);
111 GDI_ReleaseObj( hdc
);
117 /***********************************************************************
120 BOOL16 WINAPI
TextOut16( HDC16 hdc
, INT16 x
, INT16 y
, LPCSTR str
, INT16 count
)
122 return ExtTextOut16( hdc
, x
, y
, 0, NULL
, str
, count
, NULL
);
126 /***********************************************************************
127 * TextOutA (GDI32.355)
129 BOOL WINAPI
TextOutA( HDC hdc
, INT x
, INT y
, LPCSTR str
, INT count
)
131 return ExtTextOutA( hdc
, x
, y
, 0, NULL
, str
, count
, NULL
);
135 /***********************************************************************
136 * TextOutW (GDI32.356)
138 BOOL WINAPI
TextOutW(HDC hdc
, INT x
, INT y
, LPCWSTR str
, INT count
)
140 return ExtTextOutW( hdc
, x
, y
, 0, NULL
, str
, count
, NULL
);
144 /***********************************************************************
145 * GetTextCharset [GDI32.226] Gets character set for font in DC
148 * Should it return a UINT32 instead of an INT32?
149 * => YES, as GetTextCharsetInfo returns UINT32
152 * Success: Character set identifier
153 * Failure: DEFAULT_CHARSET
155 UINT WINAPI
GetTextCharset(
156 HDC hdc
) /* [in] Handle to device context */
158 /* MSDN docs say this is equivalent */
159 return GetTextCharsetInfo(hdc
, NULL
, 0);
162 /***********************************************************************
163 * GetTextCharset16 [GDI.612]
165 UINT16 WINAPI
GetTextCharset16(HDC16 hdc
)
167 return (UINT16
)GetTextCharset(hdc
);
170 /***********************************************************************
171 * GetTextCharsetInfo [GDI32.381] Gets character set for font
174 * Should csi be an LPFONTSIGNATURE instead of an LPCHARSETINFO?
175 * Should it return a UINT32 instead of an INT32?
176 * => YES and YES, from win32.hlp from Borland
179 * Success: Character set identifier
180 * Failure: DEFAULT_CHARSET
182 UINT WINAPI
GetTextCharsetInfo(
183 HDC hdc
, /* [in] Handle to device context */
184 LPFONTSIGNATURE fs
, /* [out] Pointer to struct to receive data */
185 DWORD flags
) /* [in] Reserved - must be 0 */
188 UINT charSet
= DEFAULT_CHARSET
;
192 hFont
= GetCurrentObject(hdc
, OBJ_FONT
);
194 return(DEFAULT_CHARSET
);
195 if ( GetObjectW(hFont
, sizeof(LOGFONTW
), &lf
) != 0 )
196 charSet
= lf
.lfCharSet
;
199 if (!TranslateCharsetInfo((LPDWORD
)charSet
, &csinfo
, TCI_SRCCHARSET
))
200 return (DEFAULT_CHARSET
);
201 memcpy(fs
, &csinfo
.fs
, sizeof(FONTSIGNATURE
));
206 /***********************************************************************
207 * PolyTextOutA [GDI.402] Draw several Strings
209 BOOL WINAPI
PolyTextOutA (
210 HDC hdc
, /* Handle to device context */
211 PPOLYTEXTA pptxt
, /* array of strings */
212 INT cStrings
/* Number of strings in array */
216 SetLastError ( ERROR_CALL_NOT_IMPLEMENTED
);
222 /***********************************************************************
223 * PolyTextOutW [GDI.403] Draw several Strings
225 BOOL WINAPI
PolyTextOutW (
226 HDC hdc
, /* Handle to device context */
227 PPOLYTEXTW pptxt
, /* array of strings */
228 INT cStrings
/* Number of strings in array */
232 SetLastError ( ERROR_CALL_NOT_IMPLEMENTED
);