2 * win16 driver text functions
4 * Copyright 1996 John Harvey
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "win16drv/win16drv.h"
25 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
31 /***********************************************************************
34 BOOL WIN16DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
35 const RECT *lprect, LPCWSTR wstr, UINT count,
38 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
43 RECT16 *lpOpaqueRect = NULL;
54 TRACE("%p %d %d %x %p %s %p\n",
55 dc->hSelf, x, y, flags, lprect, debugstr_wn(wstr, count), lpDx);
57 len = WideCharToMultiByte( CP_ACP, 0, wstr, count, NULL, 0, NULL, NULL );
58 str = HeapAlloc( GetProcessHeap(), 0, len );
59 WideCharToMultiByte( CP_ACP, 0, wstr, count, str, len, NULL, NULL );
64 clipRect.right = physDev->DevCaps.horzRes;
65 clipRect.bottom = physDev->DevCaps.vertRes;
67 opaqueRect.left = lprect->left;
68 opaqueRect.top = lprect->top;
69 opaqueRect.right = lprect->right;
70 opaqueRect.bottom = lprect->bottom;
71 lpOpaqueRect = &opaqueRect;
74 TRACE("textalign = %d\n", dc->textAlign);
76 if (dc->textAlign & TA_UPDATECP) {
83 LPtoDP( physDev->hdc, &pt, 1 );
87 dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0,
88 NULL, str, -len, physDev->FontInfo,
89 win16drv_SegPtr_DrawMode,
90 win16drv_SegPtr_TextXForm,
93 width = LOWORD(dwRet);
95 switch( dc->textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER) ) {
97 if (dc->textAlign & TA_UPDATECP)
101 DPtoLP( physDev->hdc, &pt, 1 );
107 if (dc->textAlign & TA_UPDATECP)
111 DPtoLP( physDev->hdc, &pt, 1 );
120 switch( dc->textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE) ) {
124 y -= physDev->FontInfo->dfPixHeight;
127 y -= physDev->FontInfo->dfAscent;
131 dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE,
132 x, y, &clipRect, str, (WORD)len,
133 physDev->FontInfo, win16drv_SegPtr_DrawMode,
134 win16drv_SegPtr_TextXForm, NULL, lpOpaqueRect,
137 HeapFree( GetProcessHeap(), 0, str );