4 * Copyright 1993, 1994 Alexandre Julliard
12 #include "wine/winuser16.h"
16 #include "debugtools.h"
19 DEFAULT_DEBUG_CHANNEL(text
);
22 /***********************************************************************
23 * ExtTextOut (GDI.351)
25 BOOL16 WINAPI
ExtTextOut16( HDC16 hdc
, INT16 x
, INT16 y
, UINT16 flags
,
26 const RECT16
*lprect
, LPCSTR str
, UINT16 count
,
35 lpdx32
= (LPINT
)HeapAlloc( GetProcessHeap(),0, sizeof(INT
)*count
);
36 if(lpdx32
== NULL
) return FALSE
;
37 for (i
=count
;i
--;) lpdx32
[i
]=lpDx
[i
];
39 if (lprect
) CONV_RECT16TO32(lprect
,&rect32
);
40 ret
= ExtTextOutA(hdc
,x
,y
,flags
,lprect
?&rect32
:NULL
,str
,count
,lpdx32
);
41 if (lpdx32
) HeapFree( GetProcessHeap(), 0, lpdx32
);
46 /***********************************************************************
47 * ExtTextOutA (GDI32.@)
49 BOOL WINAPI
ExtTextOutA( HDC hdc
, INT x
, INT y
, UINT flags
,
50 const RECT
*lprect
, LPCSTR str
, UINT count
,
53 DC
* dc
= DC_GetDCUpdate( hdc
);
55 UINT codepage
= CP_ACP
; /* FIXME: get codepage of font charset */
59 if (!dc
) return FALSE
;
61 if (dc
->funcs
->pExtTextOut
)
63 UINT wlen
= MultiByteToWideChar(codepage
,0,str
,count
,NULL
,0);
66 unsigned int i
= 0, j
= 0;
68 lpDxW
= (LPINT
)HeapAlloc( GetProcessHeap(), 0, wlen
*sizeof(INT
));
71 if(IsDBCSLeadByteEx(codepage
, str
[i
]))
73 lpDxW
[j
++] = lpDx
[i
] + lpDx
[i
+1];
83 if ((p
= HeapAlloc( GetProcessHeap(), 0, wlen
* sizeof(WCHAR
) )))
85 wlen
= MultiByteToWideChar(codepage
,0,str
,count
,p
,wlen
);
86 ret
= dc
->funcs
->pExtTextOut( dc
, x
, y
, flags
, lprect
, p
, wlen
, lpDxW
);
87 HeapFree( GetProcessHeap(), 0, p
);
89 if (lpDxW
) HeapFree( GetProcessHeap(), 0, lpDxW
);
91 GDI_ReleaseObj( hdc
);
96 /***********************************************************************
97 * ExtTextOutW (GDI32.@)
99 BOOL WINAPI
ExtTextOutW( HDC hdc
, INT x
, INT y
, UINT flags
,
100 const RECT
*lprect
, LPCWSTR str
, UINT count
,
104 DC
* dc
= DC_GetDCUpdate( hdc
);
107 if(dc
->funcs
->pExtTextOut
)
108 ret
= dc
->funcs
->pExtTextOut(dc
,x
,y
,flags
,lprect
,str
,count
,lpDx
);
109 GDI_ReleaseObj( hdc
);
115 /***********************************************************************
118 BOOL16 WINAPI
TextOut16( HDC16 hdc
, INT16 x
, INT16 y
, LPCSTR str
, INT16 count
)
120 return ExtTextOut16( hdc
, x
, y
, 0, NULL
, str
, count
, NULL
);
124 /***********************************************************************
127 BOOL WINAPI
TextOutA( HDC hdc
, INT x
, INT y
, LPCSTR str
, INT count
)
129 return ExtTextOutA( hdc
, x
, y
, 0, NULL
, str
, count
, NULL
);
133 /***********************************************************************
136 BOOL WINAPI
TextOutW(HDC hdc
, INT x
, INT y
, LPCWSTR str
, INT count
)
138 return ExtTextOutW( hdc
, x
, y
, 0, NULL
, str
, count
, NULL
);
142 /***********************************************************************
143 * GetTextCharset [GDI32.@] Gets character set for font in DC
146 * Should it return a UINT32 instead of an INT32?
147 * => YES, as GetTextCharsetInfo returns UINT32
150 * Success: Character set identifier
151 * Failure: DEFAULT_CHARSET
153 UINT WINAPI
GetTextCharset(
154 HDC hdc
) /* [in] Handle to device context */
156 /* MSDN docs say this is equivalent */
157 return GetTextCharsetInfo(hdc
, NULL
, 0);
160 /***********************************************************************
161 * GetTextCharset [GDI.612]
163 UINT16 WINAPI
GetTextCharset16(HDC16 hdc
)
165 return (UINT16
)GetTextCharset(hdc
);
168 /***********************************************************************
169 * GetTextCharsetInfo [GDI32.@] Gets character set for font
172 * Should csi be an LPFONTSIGNATURE instead of an LPCHARSETINFO?
173 * Should it return a UINT32 instead of an INT32?
174 * => YES and YES, from win32.hlp from Borland
177 * Success: Character set identifier
178 * Failure: DEFAULT_CHARSET
180 UINT WINAPI
GetTextCharsetInfo(
181 HDC hdc
, /* [in] Handle to device context */
182 LPFONTSIGNATURE fs
, /* [out] Pointer to struct to receive data */
183 DWORD flags
) /* [in] Reserved - must be 0 */
186 UINT charSet
= DEFAULT_CHARSET
;
190 hFont
= GetCurrentObject(hdc
, OBJ_FONT
);
192 return(DEFAULT_CHARSET
);
193 if ( GetObjectW(hFont
, sizeof(LOGFONTW
), &lf
) != 0 )
194 charSet
= lf
.lfCharSet
;
197 if (!TranslateCharsetInfo((LPDWORD
)charSet
, &csinfo
, TCI_SRCCHARSET
))
198 return (DEFAULT_CHARSET
);
199 memcpy(fs
, &csinfo
.fs
, sizeof(FONTSIGNATURE
));
204 /***********************************************************************
205 * PolyTextOutA (GDI32.@)
207 * Draw several Strings
209 BOOL WINAPI
PolyTextOutA (
210 HDC hdc
, /* [in] Handle to device context */
211 PPOLYTEXTA pptxt
, /* [in] Array of strings */
212 INT cStrings
/* [in] Number of strings in array */
216 SetLastError ( ERROR_CALL_NOT_IMPLEMENTED
);
222 /***********************************************************************
223 * PolyTextOutW (GDI32.@)
225 * Draw several Strings
227 BOOL WINAPI
PolyTextOutW (
228 HDC hdc
, /* [in] Handle to device context */
229 PPOLYTEXTW pptxt
, /* [in] Array of strings */
230 INT cStrings
/* [in] Number of strings in array */
234 SetLastError ( ERROR_CALL_NOT_IMPLEMENTED
);