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
25 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
31 /***********************************************************************
34 BOOL WIN16DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
35 const RECT *lprect, LPCWSTR wstr, UINT count,
38 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
42 RECT16 *lpOpaqueRect = NULL;
52 TRACE("%04x %d %d %x %p %s %p\n",
53 dc->hSelf, x, y, flags, lprect, debugstr_wn(wstr, count), lpDx);
55 len = WideCharToMultiByte( CP_ACP, 0, wstr, count, NULL, 0, NULL, NULL );
56 str = HeapAlloc( GetProcessHeap(), 0, len );
57 WideCharToMultiByte( CP_ACP, 0, wstr, count, str, len, NULL, NULL );
62 clipRect.right = physDev->DevCaps.horzRes;
63 clipRect.bottom = physDev->DevCaps.vertRes;
65 opaqueRect.left = lprect->left;
66 opaqueRect.top = lprect->top;
67 opaqueRect.right = lprect->right;
68 opaqueRect.bottom = lprect->bottom;
69 lpOpaqueRect = &opaqueRect;
72 TRACE("textalign = %d\n", dc->textAlign);
74 if (dc->textAlign & TA_UPDATECP) {
82 dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0,
83 NULL, str, -len, physDev->FontInfo,
84 win16drv_SegPtr_DrawMode,
85 win16drv_SegPtr_TextXForm,
88 width = LOWORD(dwRet);
90 switch( dc->textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER) ) {
92 if (dc->textAlign & TA_UPDATECP)
93 dc->CursPosX = XDPTOLP( dc, x + width );
97 if (dc->textAlign & TA_UPDATECP)
98 dc->CursPosX = XDPTOLP( dc, x );
105 switch( dc->textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE) ) {
109 y -= physDev->FontInfo->dfPixHeight;
112 y -= physDev->FontInfo->dfAscent;
116 dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE,
117 x, y, &clipRect, str, (WORD)len,
118 physDev->FontInfo, win16drv_SegPtr_DrawMode,
119 win16drv_SegPtr_TextXForm, NULL, lpOpaqueRect,
122 HeapFree( GetProcessHeap(), 0, str );