2 * metafile driver text functions
4 * Copyright 1993, 1994 Alexandre Julliard
11 #include "metafiledrv.h"
12 #include "debugtools.h"
15 DEFAULT_DEBUG_CHANNEL(metafile)
18 /******************************************************************
19 * MFDRV_MetaExtTextOut
21 static BOOL MFDRV_MetaExtTextOut(DC*dc, short x, short y, UINT16 flags,
22 const RECT16 *rect, LPCSTR str, short count,
29 if((!flags && rect) || (flags && !rect))
30 WARN("Inconsistent flags and rect\n");
31 len = sizeof(METARECORD) + (((count + 1) >> 1) * 2) + 2 * sizeof(short)
34 len += sizeof(RECT16);
36 len+=count*sizeof(INT16);
37 if (!(mr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len)))
41 mr->rdFunction = META_EXTTEXTOUT;
43 *(mr->rdParm + 1) = x;
44 *(mr->rdParm + 2) = count;
45 *(mr->rdParm + 3) = flags;
46 if (rect) memcpy(mr->rdParm + 4, rect, sizeof(RECT16));
47 memcpy(mr->rdParm + (rect ? 8 : 4), str, count);
49 memcpy(mr->rdParm + (rect ? 8 : 4) + ((count + 1) >> 1),lpDx,
51 ret = MFDRV_WriteRecord( dc, mr, mr->rdSize * 2);
52 HeapFree( GetProcessHeap(), 0, mr);
58 /***********************************************************************
62 MFDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
63 const RECT *lprect, LPCWSTR str, UINT count,
67 LPINT16 lpdx16 = NULL;
73 lpdx16 = HeapAlloc( GetProcessHeap(), 0, sizeof(INT16)*count );
74 if (lprect) CONV_RECT32TO16(lprect,&rect16);
78 ascii = HeapAlloc( GetProcessHeap(), 0, count+1 );
79 lstrcpynWtoA(ascii, str, count+1);
80 ret = MFDRV_MetaExtTextOut(dc,x,y,flags,lprect?&rect16:NULL,ascii,count,
82 HeapFree( GetProcessHeap(), 0, ascii );
83 if (lpdx16) HeapFree( GetProcessHeap(), 0, lpdx16 );