Moved the OEM bitmaps that don't depend on the Wine look into the
[wine] / graphics / win16drv / text.c
1 /*
2  * win16 driver text functions
3  *
4  * Copyright 1996 John Harvey
5  *           1998 Huw Davies
6  */
7
8 #include <stdlib.h>
9 #include "win16drv.h"
10 #include "gdi.h"
11 #include "debugtools.h"
12 #include "winbase.h"
13 #include "winnls.h"
14
15 DEFAULT_DEBUG_CHANNEL(win16drv);
16
17 /***********************************************************************
18  *           WIN16DRV_ExtTextOut
19  */
20 BOOL WIN16DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
21                            const RECT *lprect, LPCWSTR wstr, UINT count,
22                            const INT *lpDx )
23 {
24     WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
25     BOOL bRet = 1;
26     RECT16       clipRect;
27     RECT16       opaqueRect;
28     RECT16      *lpOpaqueRect = NULL; 
29     WORD wOptions = 0;
30     DWORD len;
31     INT16 width;
32     char *str;
33     DWORD dwRet;
34
35     if (count == 0)
36         return FALSE;
37
38     TRACE("%04x %d %d %x %p %s %p\n",
39           dc->hSelf, x, y, flags, lprect, debugstr_wn(wstr, count), lpDx);
40
41     len = WideCharToMultiByte( CP_ACP, 0, wstr, count, NULL, 0, NULL, NULL );
42     str = HeapAlloc( GetProcessHeap(), 0, len );
43     WideCharToMultiByte( CP_ACP, 0, wstr, count, str, len, NULL, NULL );
44
45     clipRect.left = 0;
46     clipRect.top = 0;
47         
48     clipRect.right = physDev->DevCaps.horzRes;
49     clipRect.bottom = physDev->DevCaps.vertRes;
50     if (lprect) {
51         opaqueRect.left = lprect->left;
52         opaqueRect.top = lprect->top;
53         opaqueRect.right = lprect->right;
54         opaqueRect.bottom = lprect->bottom;
55         lpOpaqueRect = &opaqueRect;
56     }
57         
58     TRACE("textalign = %d\n", dc->textAlign);
59
60     if (dc->textAlign & TA_UPDATECP) {
61         x = dc->CursPosX;
62         y = dc->CursPosY;
63     }
64
65     x = XLPTODP( dc, x );
66     y = YLPTODP( dc, y );
67
68     dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0, 
69                               NULL, str, -len,  physDev->FontInfo, 
70                               win16drv_SegPtr_DrawMode,
71                               win16drv_SegPtr_TextXForm,
72                               NULL, NULL, 0);
73
74     width = LOWORD(dwRet);
75
76     switch( dc->textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER) ) {
77     case TA_LEFT:
78         if (dc->textAlign & TA_UPDATECP)
79             dc->CursPosX = XDPTOLP( dc, x + width );
80         break;
81     case TA_RIGHT:
82         x -= width;
83         if (dc->textAlign & TA_UPDATECP)
84             dc->CursPosX = XDPTOLP( dc, x );
85         break;
86     case TA_CENTER:
87         x -= width / 2;
88         break;
89     }
90
91     switch( dc->textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE) ) {
92     case TA_TOP:
93         break;
94     case TA_BOTTOM:
95         y -= physDev->FontInfo->dfPixHeight;
96         break;
97     case TA_BASELINE:
98         y -= physDev->FontInfo->dfAscent;
99         break;    
100     }
101
102     dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 
103                               x, y, &clipRect, str, (WORD)len,
104                               physDev->FontInfo, win16drv_SegPtr_DrawMode, 
105                               win16drv_SegPtr_TextXForm, NULL, lpOpaqueRect,
106                               wOptions);
107
108     HeapFree( GetProcessHeap(), 0, str );
109     return bRet;
110 }
111
112
113
114
115
116
117
118
119