* Source/cairo/CairoContext.m (-beginPrologueBBox:...): Use

paper size from print info to set the cairo page size, instead
of using the bounding box (which is usually smaller than the
paper size, and was causing cairo print output to be wrong
compared to GNUstep's built-in PostScript writer.)


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@34351 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2011-12-23 19:01:45 +00:00
parent fb1f42cbee
commit 4f613a2a66
2 changed files with 25 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2011-12-23 Eric Wasylishen <ewasylishen@gmail.com>
* Source/cairo/CairoContext.m (-beginPrologueBBox:...): Use
paper size from print info to set the cairo page size, instead
of using the bounding box (which is usually smaller than the
paper size, and was causing cairo print output to be wrong
compared to GNUstep's built-in PostScript writer.)
2011-11-28 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServerEvent.m (initialize_keyboard): Don't use

View file

@ -27,6 +27,8 @@
#include <AppKit/NSBitmapImageRep.h>
#include <AppKit/NSGraphics.h>
#include <AppKit/NSPrintInfo.h>
#include <AppKit/NSPrintOperation.h>
#include "cairo/CairoContext.h"
#include "cairo/CairoGState.h"
@ -225,6 +227,21 @@
NSSize size;
NSString *contextType;
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSPrintInfo *printInfo = [printOp printInfo];
if (printInfo != nil)
{
size = [printInfo paperSize];
}
else
{
[NSException raise: NSInternalInconsistencyException
format: @"current print operation printInfo is nil in %@",
NSStringFromSelector(_cmd)];
return;
}
contextType = [context_info objectForKey:
NSGraphicsContextRepresentationFormatAttributeName];
@ -232,7 +249,6 @@
{
if ([contextType isEqual: NSGraphicsContextPSFormat])
{
size = boundingBox.size;
surface = [[CairoPSSurface alloc] initWithDevice: context_info];
[surface setSize: size];
// This strange setting is needed because of the way GUI handles offset.
@ -241,7 +257,6 @@
}
else if ([contextType isEqual: NSGraphicsContextPDFFormat])
{
size = boundingBox.size;
surface = [[CairoPDFSurface alloc] initWithDevice: context_info];
[surface setSize: size];
// This strange setting is needed because of the way GUI handles offset.