Release 971101
[wine] / graphics / win16drv / text.c
1 /*
2  * win16 driver text functions
3  *
4  * Copyright 1996 John Harvey
5  */
6
7 #include <stdlib.h>
8 #include "windows.h"
9 #include "win16drv.h"
10 #include "dc.h"
11 #include "gdi.h"
12 #include "stddebug.h"
13 /* #define DEBUG_WIN16DRV */
14 #include "debug.h"
15
16 /***********************************************************************
17  *           WIN16DRV_ExtTextOut
18  */
19 BOOL32 WIN16DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
20                            const RECT32 *lprect, LPCSTR str, UINT32 count,
21                            const INT32 *lpDx )
22 {
23     WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
24     BOOL32 bRet = 1;
25     RECT16       clipRect;
26     RECT16       opaqueRect;
27     RECT16      *lpOpaqueRect = NULL; 
28     WORD wOptions = 0;
29     WORD wCount = count;
30
31     static BOOL32 bInit = FALSE;
32     
33
34
35     if (count == 0)
36       return FALSE;
37
38     dprintf_win16drv(stddeb, "WIN16DRV_ExtTextOut: %04x %d %d %x %p %*s %p\n", dc->hSelf, x, y, 
39            flags,  lprect, count > 0 ? count : 8, str, lpDx);
40
41
42     if (bInit == FALSE)
43     {
44         DWORD dwRet;
45
46         dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0, 
47                                   NULL, " ", 
48                                   -1,  physDev->segptrFontInfo, win16drv_SegPtr_DrawMode, 
49                                   win16drv_SegPtr_TextXForm, NULL, NULL, 0);
50         bInit = TRUE;
51     }
52
53     if (dc != NULL)   
54     {
55         DWORD dwRet;
56         clipRect.left = 0;
57         clipRect.top = 0;
58         
59         clipRect.right = dc->w.devCaps->horzRes;
60         clipRect.bottom = dc->w.devCaps->vertRes;
61         if (lprect)
62         {
63             opaqueRect.left = lprect->left;
64             opaqueRect.top = lprect->top;
65             opaqueRect.right = lprect->right;
66             opaqueRect.bottom = lprect->bottom;
67             lpOpaqueRect = &opaqueRect;
68             
69         }
70         
71 #ifdef NOTDEF
72     {
73         RECT16 rcPageSize;
74         FONTINFO16 *p = (FONTINFO16 *)PTR_SEG_TO_LIN(physDev->segptrFontInfo);
75         rcPageSize.left = 0;
76         rcPageSize.right = 0x3c0;
77         
78         rcPageSize.top = 0;
79         rcPageSize.bottom = 0x630;
80         
81
82
83
84         if(y < rcPageSize.top  ||  y + p->dfPixHeight > rcPageSize.bottom)
85         {
86             printf("Failed 1 y %d top %d y +height %d bottom %d\n",
87                    y, rcPageSize.top  ,  y + p->dfPixHeight , rcPageSize.bottom);
88         }
89         
90
91         if(x >= rcPageSize.right  ||
92             x + wCount * p->dfPixWidth < rcPageSize.left)
93         {
94             printf("Faile 2\n");
95         }
96         
97     }
98 #endif        
99
100         dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, XLPTODP(dc,x), YLPTODP(dc,y), 
101                                   &clipRect, str, 
102                                   wCount,  physDev->segptrFontInfo, win16drv_SegPtr_DrawMode, 
103                                   win16drv_SegPtr_TextXForm, NULL, lpOpaqueRect, wOptions);
104     }
105     return bRet;
106 }