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
,
57 UINT codepage
= CP_ACP
; /* FIXME: get codepage of font charset */
61 wlen
= MultiByteToWideChar(codepage
,0,str
,count
,NULL
,0);
66 lpDxW
= (LPINT
)HeapAlloc( GetProcessHeap(), 0, wlen
*sizeof(INT
));
68 if(IsDBCSLeadByteEx(codepage
, str
[i
])){
69 lpDxW
[j
++] = lpDx
[i
] + lpDx
[i
+1];
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
);
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
,
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 /***********************************************************************
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
132 * Should it return a UINT32 instead of an INT32?
133 * => YES, as GetTextCharsetInfo returns UINT32
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
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
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 */
172 UINT charSet
= DEFAULT_CHARSET
;
176 hFont
= GetCurrentObject(hdc
, OBJ_FONT
);
178 return(DEFAULT_CHARSET
);
179 if ( GetObjectW(hFont
, sizeof(LOGFONTW
), &lf
) != 0 )
180 charSet
= lf
.lfCharSet
;
183 if (!TranslateCharsetInfo((LPDWORD
)charSet
, &csinfo
, TCI_SRCCHARSET
))
184 return (DEFAULT_CHARSET
);
185 memcpy(fs
, &csinfo
.fs
, sizeof(FONTSIGNATURE
));
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 */
200 SetLastError ( ERROR_CALL_NOT_IMPLEMENTED
);
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 */
216 SetLastError ( ERROR_CALL_NOT_IMPLEMENTED
);