#include <9pm/windows.h> #include <9pm/u.h> #include <9pm/libc.h> int WINAPI DrawText(HDC hDC, LPWSTR lpString, int nCount, LPRECT lpRect, UINT uFormat) { char *s, *p; int i, n, r; if(win_useunicode) return DrawTextW(hDC, lpString, nCount, lpRect, uFormat); if(nCount<0) n = runestrlen(lpString); s = win_malloc(n*UTFmax); for(i=0,p=s; i<n; i++) p += runetochar(p, lpString+i); r = DrawTextA(hDC, s, p-s, lpRect, uFormat); win_free(s); return r; }