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;
53 TRACE("%04x %d %d %x %p %s %p\n",
54 dc->hSelf, x, y, flags, lprect, debugstr_wn(wstr, count), lpDx);
56 len = WideCharToMultiByte( CP_ACP, 0, wstr, count, NULL, 0, NULL, NULL );
57 str = HeapAlloc( GetProcessHeap(), 0, len );
58 WideCharToMultiByte( CP_ACP, 0, wstr, count, str, len, NULL, NULL );
63 clipRect.right = physDev->DevCaps.horzRes;
64 clipRect.bottom = physDev->DevCaps.vertRes;
66 opaqueRect.left = lprect->left;
67 opaqueRect.top = lprect->top;
68 opaqueRect.right = lprect->right;
69 opaqueRect.bottom = lprect->bottom;
70 lpOpaqueRect = &opaqueRect;
73 TRACE("textalign = %d\n", dc->textAlign);
75 if (dc->textAlign & TA_UPDATECP) {
83 dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0,
84 NULL, str, -len, physDev->FontInfo,
85 win16drv_SegPtr_DrawMode,
86 win16drv_SegPtr_TextXForm,
89 width = LOWORD(dwRet);
91 switch( dc->textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER) ) {
93 if (dc->textAlign & TA_UPDATECP)
94 dc->CursPosX = XDPTOLP( dc, x + width );
98 if (dc->textAlign & TA_UPDATECP)
99 dc->CursPosX = XDPTOLP( dc, x );
106 switch( dc->textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE) ) {
110 y -= physDev->FontInfo->dfPixHeight;
113 y -= physDev->FontInfo->dfAscent;
117 dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE,
118 x, y, &clipRect, str, (WORD)len,
119 physDev->FontInfo, win16drv_SegPtr_DrawMode,
120 win16drv_SegPtr_TextXForm, NULL, lpOpaqueRect,
123 HeapFree( GetProcessHeap(), 0, str );