4 * Copyright 1993, 1994 Alexandre Julliard
12 #include "wine/winuser16.h"
17 #include "debugtools.h"
20 DEFAULT_DEBUG_CHANNEL(text
);
23 /***********************************************************************
24 * ExtTextOut16 (GDI.351)
26 BOOL16 WINAPI
ExtTextOut16( HDC16 hdc
, INT16 x
, INT16 y
, UINT16 flags
,
27 const RECT16
*lprect
, LPCSTR str
, UINT16 count
,
36 lpdx32
= (LPINT
)HeapAlloc( GetProcessHeap(),0, sizeof(INT
)*count
);
37 if(lpdx32
== NULL
) return FALSE
;
38 for (i
=count
;i
--;) lpdx32
[i
]=lpDx
[i
];
40 if (lprect
) CONV_RECT16TO32(lprect
,&rect32
);
41 ret
= ExtTextOutA(hdc
,x
,y
,flags
,lprect
?&rect32
:NULL
,str
,count
,lpdx32
);
42 if (lpdx32
) HeapFree( GetProcessHeap(), 0, lpdx32
);
47 /***********************************************************************
48 * ExtTextOutA (GDI32.98)
50 BOOL WINAPI
ExtTextOutA( HDC hdc
, INT x
, INT y
, UINT flags
,
51 const RECT
*lprect
, LPCSTR str
, UINT count
,
54 DC
* dc
= DC_GetDCUpdate( hdc
);
56 UINT codepage
= CP_ACP
; /* FIXME: get codepage of font charset */
60 if (!dc
) return FALSE
;
62 if (dc
->funcs
->pExtTextOut
)
64 UINT wlen
= MultiByteToWideChar(codepage
,0,str
,count
,NULL
,0);
69 lpDxW
= (LPINT
)HeapAlloc( GetProcessHeap(), 0, wlen
*sizeof(INT
));
72 if(IsDBCSLeadByteEx(codepage
, str
[i
]))
74 lpDxW
[j
++] = lpDx
[i
] + lpDx
[i
+1];
84 if ((p
= HeapAlloc( GetProcessHeap(), 0, wlen
* sizeof(WCHAR
) )))
86 wlen
= MultiByteToWideChar(codepage
,0,str
,count
,p
,wlen
);
87 ret
= dc
->funcs
->pExtTextOut( dc
, x
, y
, flags
, lprect
, p
, wlen
, lpDxW
);
88 HeapFree( GetProcessHeap(), 0, p
);
90 if (lpDxW
) HeapFree( GetProcessHeap(), 0, lpDxW
);
92 GDI_ReleaseObj( hdc
);
97 /***********************************************************************
98 * ExtTextOutW (GDI32.99)
100 BOOL WINAPI
ExtTextOutW( HDC hdc
, INT x
, INT y
, UINT flags
,
101 const RECT
*lprect
, LPCWSTR str
, UINT count
,
105 DC
* dc
= DC_GetDCUpdate( hdc
);
108 if(dc
->funcs
->pExtTextOut
)
109 ret
= dc
->funcs
->pExtTextOut(dc
,x
,y
,flags
,lprect
,str
,count
,lpDx
);
110 GDI_ReleaseObj( hdc
);
116 /***********************************************************************
119 BOOL16 WINAPI
TextOut16( HDC16 hdc
, INT16 x
, INT16 y
, LPCSTR str
, INT16 count
)
121 return ExtTextOut16( hdc
, x
, y
, 0, NULL
, str
, count
, NULL
);
125 /***********************************************************************
126 * TextOutA (GDI32.355)
128 BOOL WINAPI
TextOutA( HDC hdc
, INT x
, INT y
, LPCSTR str
, INT count
)
130 return ExtTextOutA( hdc
, x
, y
, 0, NULL
, str
, count
, NULL
);
134 /***********************************************************************
135 * TextOutW (GDI32.356)
137 BOOL WINAPI
TextOutW(HDC hdc
, INT x
, INT y
, LPCWSTR str
, INT count
)
139 return ExtTextOutW( hdc
, x
, y
, 0, NULL
, str
, count
, NULL
);
143 /***********************************************************************
144 * GetTextCharset [GDI32.226] Gets character set for font in DC
147 * Should it return a UINT32 instead of an INT32?
148 * => YES, as GetTextCharsetInfo returns UINT32
151 * Success: Character set identifier
152 * Failure: DEFAULT_CHARSET
154 UINT WINAPI
GetTextCharset(
155 HDC hdc
) /* [in] Handle to device context */
157 /* MSDN docs say this is equivalent */
158 return GetTextCharsetInfo(hdc
, NULL
, 0);
161 /***********************************************************************
162 * GetTextCharset16 [GDI.612]
164 UINT16 WINAPI
GetTextCharset16(HDC16 hdc
)
166 return (UINT16
)GetTextCharset(hdc
);
169 /***********************************************************************
170 * GetTextCharsetInfo [GDI32.381] Gets character set for font
173 * Should csi be an LPFONTSIGNATURE instead of an LPCHARSETINFO?
174 * Should it return a UINT32 instead of an INT32?
175 * => YES and YES, from win32.hlp from Borland
178 * Success: Character set identifier
179 * Failure: DEFAULT_CHARSET
181 UINT WINAPI
GetTextCharsetInfo(
182 HDC hdc
, /* [in] Handle to device context */
183 LPFONTSIGNATURE fs
, /* [out] Pointer to struct to receive data */
184 DWORD flags
) /* [in] Reserved - must be 0 */
187 UINT charSet
= DEFAULT_CHARSET
;
191 hFont
= GetCurrentObject(hdc
, OBJ_FONT
);
193 return(DEFAULT_CHARSET
);
194 if ( GetObjectW(hFont
, sizeof(LOGFONTW
), &lf
) != 0 )
195 charSet
= lf
.lfCharSet
;
198 if (!TranslateCharsetInfo((LPDWORD
)charSet
, &csinfo
, TCI_SRCCHARSET
))
199 return (DEFAULT_CHARSET
);
200 memcpy(fs
, &csinfo
.fs
, sizeof(FONTSIGNATURE
));
205 /***********************************************************************
206 * PolyTextOutA [GDI.402] Draw several Strings
208 BOOL WINAPI
PolyTextOutA (
209 HDC hdc
, /* Handle to device context */
210 PPOLYTEXTA pptxt
, /* array of strings */
211 INT cStrings
/* Number of strings in array */
215 SetLastError ( ERROR_CALL_NOT_IMPLEMENTED
);
221 /***********************************************************************
222 * PolyTextOutW [GDI.403] Draw several Strings
224 BOOL WINAPI
PolyTextOutW (
225 HDC hdc
, /* Handle to device context */
226 PPOLYTEXTW pptxt
, /* array of strings */
227 INT cStrings
/* Number of strings in array */
231 SetLastError ( ERROR_CALL_NOT_IMPLEMENTED
);