Bracket code inserted by the PASSTHROUGH escapes by
%%{Begin,End}Document. This stops cups' pstops becoming confused if it comes across an %%EOF in an imported eps file. The hack in PSDRV_Rectangle to fix eps files in office2k turns out to be almost what Windows really does - update the code and the comment to match Windows behaviour more precisely.
This commit is contained in:
parent
fe13d6a0a9
commit
780667fe1e
|
@ -31,6 +31,9 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
|
||||
|
||||
static const char psbegindocument[] =
|
||||
"%%BeginDocument: Wine passthrough\n";
|
||||
|
||||
/**********************************************************************
|
||||
* ExtEscape (WINEPS.@)
|
||||
*/
|
||||
|
@ -214,6 +217,10 @@ INT PSDRV_ExtEscape( PSDRV_PDEVICE *physDev, INT nEscape, INT cbInput, LPCVOID i
|
|||
* length of the string, rather than 2 more. So we'll use the WORD at
|
||||
* in_data[0] instead.
|
||||
*/
|
||||
if(!physDev->job.in_passthrough) {
|
||||
WriteSpool16(physDev->job.hJob, (LPSTR)psbegindocument, sizeof(psbegindocument)-1);
|
||||
physDev->job.in_passthrough = TRUE;
|
||||
}
|
||||
return WriteSpool16(physDev->job.hJob,((char*)in_data)+2,*(WORD*)in_data);
|
||||
}
|
||||
|
||||
|
@ -373,7 +380,9 @@ INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc )
|
|||
physDev->job.banding = FALSE;
|
||||
physDev->job.OutOfPage = TRUE;
|
||||
physDev->job.PageNo = 0;
|
||||
|
||||
physDev->job.quiet = FALSE;
|
||||
physDev->job.in_passthrough = FALSE;
|
||||
physDev->job.had_passthrough_rect = FALSE;
|
||||
if(doc->lpszDocName) {
|
||||
physDev->job.DocName = HeapAlloc(GetProcessHeap(), 0, strlen(doc->lpszDocName)+1);
|
||||
strcpy(physDev->job.DocName, doc->lpszDocName);
|
||||
|
|
|
@ -124,11 +124,14 @@ BOOL PSDRV_Rectangle( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT
|
|||
rect.bottom = bottom;
|
||||
LPtoDP( physDev->hdc, (POINT *)&rect, 2 );
|
||||
|
||||
/* HACK to get inserted eps files printing from Office 2k */
|
||||
if(GetROP2(physDev->hdc) == R2_NOP) {
|
||||
/* Windows does something truely hacky here. If we're in passthrough mode
|
||||
and our rop is R2_NOP, then we output the string below. This is used in
|
||||
Office 2k when inserting eps files */
|
||||
if(physDev->job.in_passthrough && !physDev->job.had_passthrough_rect && GetROP2(physDev->hdc) == R2_NOP) {
|
||||
char buf[256];
|
||||
sprintf(buf, "%ld %ld %ld %ld B\n", rect.right - rect.left, rect.bottom - rect.top, rect.left, rect.top);
|
||||
PSDRV_WriteSpool(physDev, buf, strlen(buf));
|
||||
sprintf(buf, "N %ld %ld %ld %ld B\n", rect.right - rect.left, rect.bottom - rect.top, rect.left, rect.top);
|
||||
WriteSpool16(physDev->job.hJob, buf, strlen(buf));
|
||||
physDev->job.had_passthrough_rect = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ static const char psprolog[] =
|
|||
" for\n"
|
||||
"} bind def\n"
|
||||
"/B {pop pop pop pop} def\n"
|
||||
"/N {newpath} def\n"
|
||||
"/havetype42gdir {version cvi 2015 ge} bind def\n";
|
||||
|
||||
static const char psbeginsetup[] =
|
||||
|
@ -195,6 +196,8 @@ static const char psarrayput[] =
|
|||
static const char psarraydef[] =
|
||||
"/%s %d array def\n";
|
||||
|
||||
static const char psenddocument[] =
|
||||
"\n%%EndDocument\n";
|
||||
|
||||
DWORD PSDRV_WriteSpool(PSDRV_PDEVICE *physDev, LPCSTR lpData, DWORD cch)
|
||||
{
|
||||
|
@ -205,6 +208,11 @@ DWORD PSDRV_WriteSpool(PSDRV_PDEVICE *physDev, LPCSTR lpData, DWORD cch)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if(physDev->job.in_passthrough) { /* Was in PASSTHROUGH mode */
|
||||
WriteSpool16( physDev->job.hJob, (LPSTR)psenddocument, sizeof(psenddocument)-1 );
|
||||
physDev->job.in_passthrough = physDev->job.had_passthrough_rect = FALSE;
|
||||
}
|
||||
|
||||
if(physDev->job.OutOfPage) { /* Will get here after NEWFRAME Escape */
|
||||
if( !PSDRV_StartPage(physDev) )
|
||||
return 0;
|
||||
|
|
|
@ -321,6 +321,8 @@ typedef struct {
|
|||
BOOL OutOfPage; /* Page header not sent yet */
|
||||
INT PageNo;
|
||||
BOOL quiet; /* Don't actually output anything */
|
||||
BOOL in_passthrough; /* In PASSTHROUGH mode */
|
||||
BOOL had_passthrough_rect; /* See the comment in PSDRV_Rectangle */
|
||||
} JOB;
|
||||
|
||||
typedef struct {
|
||||
|
|
Loading…
Reference in New Issue