Moved all printing output code to NSGraphicsContext.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25268 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2007-06-18 12:49:04 +00:00
parent 1b4f334cda
commit cfff2ce6b4
5 changed files with 479 additions and 326 deletions

View file

@ -1,3 +1,11 @@
2007-06-18 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSGraphicsContext.h: Declare new printing
methods.
* Source/NSGraphicsContext.m: Implement Postscript printing methods.
* Source/NSPrintOperation.m: Move _endSheet method into NSView.
* Source/NSView.m: Use printing methods from NSGraphicsContext.
2007-06-07 Sergii Stoian <stoyan255@gmail.com>
* Source/NSBrowser.m: ([drawWithFrame:inView:]) Pass inset rect by

View file

@ -433,6 +433,37 @@ transform between current user space and image space for this image.</desc>
@end
/* ----------------------------------------------------------------------- */
/* Printing Ops */
/* ----------------------------------------------------------------------- */
@interface NSGraphicsContext (Printing)
- (void) beginPage: (int)ordinalNum
label: (NSString*)aString
bBox: (NSRect)pageRect
fonts: (NSString*)fontNames;
- (void) beginPrologueBBox: (NSRect)boundingBox
creationDate: (NSString*)dateCreated
createdBy: (NSString*)anApplication
fonts: (NSString*)fontNames
forWhom: (NSString*)user
pages: (int)numPages
title: (NSString*)aTitle;
- (void) beginSetup;
- (void) beginTrailer;
- (void) endDocumentPages: (int)pages
documentFonts: (NSSet*)fontNames;
- (void) endHeaderComments;
- (void) endPageSetup;
- (void) endPrologue;
- (void) endSetup;
- (void) endSheet;
- (void) endTrailer;
- (void) printerProlog;
- (void) showPage;
@end
/* NSGraphicContext constants */
APPKIT_EXPORT NSString *NSGraphicsContextDestinationAttributeName;
APPKIT_EXPORT NSString *NSGraphicsContextPDFFormat;

View file

@ -44,9 +44,12 @@
#include "AppKit/NSGraphicsContext.h"
#include "AppKit/NSAffineTransform.h"
#include "AppKit/NSBezierPath.h"
#include "AppKit/NSPrintInfo.h"
#include "AppKit/NSPrintOperation.h"
#include "AppKit/NSWindow.h"
#include "AppKit/NSView.h"
#include "AppKit/DPSOperators.h"
#include "GNUstepGUI/GSVersion.h"
/* The memory zone where all global objects are allocated from (Contexts
are also allocated from this zone) */
@ -1530,3 +1533,173 @@ NSGraphicsContext *GSCurrentContext(void)
}
@end
@implementation NSGraphicsContext (Printing)
- (void) beginPage: (int)ordinalNum
label: (NSString*)aString
bBox: (NSRect)pageRect
fonts: (NSString*)fontNames
{
if (aString == nil)
aString = [[NSNumber numberWithInt: ordinalNum] description];
DPSPrintf(self, "%%%%Page: %s %d\n", [aString lossyCString], ordinalNum);
if (NSIsEmptyRect(pageRect) == NO)
DPSPrintf(self, "%%%%PageBoundingBox: %d %d %d %d\n",
(int)NSMinX(pageRect), (int)NSMinY(pageRect),
(int)NSMaxX(pageRect), (int)NSMaxY(pageRect));
if (fontNames)
DPSPrintf(self, "%%%%PageFonts: %s\n", [fontNames lossyCString]);
DPSPrintf(self, "%%%%BeginPageSetup\n");
}
- (void) beginPrologueBBox: (NSRect)boundingBox
creationDate: (NSString*)dateCreated
createdBy: (NSString*)anApplication
fonts: (NSString*)fontNames
forWhom: (NSString*)user
pages: (int)numPages
title: (NSString*)aTitle
{
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSPrintingOrientation orient;
BOOL epsOp;
epsOp = [printOp isEPSOperation];
orient = [[printOp printInfo] orientation];
if (epsOp)
DPSPrintf(self, "%%!PS-Adobe-3.0 EPSF-3.0\n");
else
DPSPrintf(self, "%%!PS-Adobe-3.0\n");
DPSPrintf(self, "%%%%Title: %s\n", [aTitle lossyCString]);
DPSPrintf(self, "%%%%Creator: %s\n", [anApplication lossyCString]);
DPSPrintf(self, "%%%%CreationDate: %s\n",
[[dateCreated description] lossyCString]);
DPSPrintf(self, "%%%%For: %s\n", [user lossyCString]);
if (fontNames)
DPSPrintf(self, "%%%%DocumentFonts: %s\n", [fontNames lossyCString]);
else
DPSPrintf(self, "%%%%DocumentFonts: (atend)\n");
if (NSIsEmptyRect(boundingBox) == NO)
DPSPrintf(self, "%%%%BoundingBox: %d %d %d %d\n",
(int)NSMinX(boundingBox), (int)NSMinY(boundingBox),
(int)NSMaxX(boundingBox), (int)NSMaxY(boundingBox));
else
DPSPrintf(self, "%%%%BoundingBox: (atend)\n");
if (epsOp == NO)
{
if (numPages)
DPSPrintf(self, "%%%%Pages: %d\n", numPages);
else
DPSPrintf(self, "%%%%Pages: (atend)\n");
if ([printOp pageOrder] == NSDescendingPageOrder)
DPSPrintf(self, "%%%%PageOrder: Descend\n");
else if ([printOp pageOrder] == NSAscendingPageOrder)
DPSPrintf(self, "%%%%PageOrder: Ascend\n");
else if ([printOp pageOrder] == NSSpecialPageOrder)
DPSPrintf(self, "%%%%PageOrder: Special\n");
if (orient == NSPortraitOrientation)
DPSPrintf(self, "%%%%Orientation: Portrait\n");
else
DPSPrintf(self, "%%%%Orientation: Landscape\n");
}
DPSPrintf(self, "%%%%GNUstepVersion: %d.%d.%d\n",
GNUSTEP_GUI_MAJOR_VERSION, GNUSTEP_GUI_MINOR_VERSION,
GNUSTEP_GUI_SUBMINOR_VERSION);
}
- (void) beginSetup
{
DPSPrintf(self, "%%%%BeginSetup\n");
}
- (void) beginTrailer
{
DPSPrintf(self, "%%%%Trailer\n");
}
- (void) endDocumentPages: (int)pages
documentFonts: (NSSet*)fontNames
{
if (pages != 0)
{
DPSPrintf(self, "%%%%Pages: %d\n", pages);
}
if (fontNames && [fontNames count])
{
NSString *name;
NSEnumerator *e = [fontNames objectEnumerator];
DPSPrintf(self, "%%%%DocumentFonts: %@\n", [e nextObject]);
while ((name = [e nextObject]))
{
DPSPrintf(self, "%%%%+ %@\n", name);
}
}
}
- (void) endHeaderComments
{
DPSPrintf(self, "%%%%EndComments\n\n");
}
- (void) endPageSetup
{
DPSPrintf(self, "%%%%EndPageSetup\n");
}
- (void) endPrologue
{
DPSPrintf(self, "%%%%EndProlog\n\n");
}
- (void) endSetup
{
DPSPrintf(self, "%%%%EndSetup\n\n");
}
- (void) endSheet
{
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
if ([printOp isEPSOperation] == NO)
{
[self showPage];
}
DPSPrintf(self, "%%%%PageTrailer\n\n");
}
- (void) endTrailer
{
DPSPrintf(self, "%%%%EOF\n");
}
- (void) printerProlog
{
NSString *prolog;
DPSPrintf(self, "%%%%BeginProlog\n");
prolog = [NSBundle pathForLibraryResource: @"GSProlog"
ofType: @"ps"
inDirectory: @"PostScript"];
if (prolog == nil)
{
NSLog(@"Cannot find printer prolog file");
return;
}
prolog = [NSString stringWithContentsOfFile: prolog];
DPSPrintf(self, [prolog cString]);
}
- (void) showPage
{
DPSPrintf(self, "showpage\n");
}
@end

View file

@ -68,7 +68,7 @@ typedef struct _page_info_t {
and page fitting */
NSRect paperBounds; /* Print area of a page in default user space, possibly
rotated if printing Landscape */
NSRect sheetBounds; /* Print are of a page in default user space */
NSRect sheetBounds; /* Print area of a sheet in default user space */
NSSize paperSize; /* Size of the paper */
int xpages, ypages;
int first, last;
@ -106,12 +106,11 @@ typedef struct _page_info_t {
@interface NSView (NSPrintOperation)
- (void) _displayPageInRect: (NSRect)pageRect
atPlacement: (NSPoint)location
withInfo: (page_info_t)info;
- (void) _endSheet;
@end
@interface NSView (NPrintOperationPrivate)
- (void) _endSheet;
- (void) _cleanupPrinting;
@end
@ -717,7 +716,7 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
/*
static NSSize
scaleSize(NSSize size, double scale)
{
@ -725,6 +724,7 @@ scaleSize(NSSize size, double scale)
size.width *= scale;
return size;
}
*/
static NSRect
scaleRect(NSRect rect, double scale)
@ -989,8 +989,8 @@ scaleRect(NSRect rect, double scale)
i = 0;
while (i < (info.last-info.first+1))
{
NSPoint location;
NSRect pageRect, scaledPageRect;
NSRect pageRect;
if (knowsPageRange == YES)
{
pageRect = [_view rectForPage: _currentPage];
@ -1012,12 +1012,8 @@ scaleRect(NSRect rect, double scale)
if (NSIsEmptyRect(pageRect))
break;
scaledPageRect = scaleRect(pageRect, info.printScale*info.pageScale);
location = [_view locationOfPrintRect: scaledPageRect];
/* Draw using our special view routine */
[_view _displayPageInRect: pageRect
atPlacement: location
withInfo: info];
if (dir > 0 && _currentPage == info.last && allPages == YES)
@ -1044,7 +1040,7 @@ scaleRect(NSRect rect, double scale)
/* Make sure we end the sheet */
if (info.nup > 1 && (info.last - info.first) % info.nup != info.nup - 1)
{
[_view drawSheetBorderWithSize: info.paperBounds.size];
[_view drawSheetBorderWithSize: info.sheetBounds.size];
[_view _endSheet];
}
[_view endDocument];
@ -1063,25 +1059,28 @@ scaleRect(NSRect rect, double scale)
@implementation NSView (NSPrintOperation)
- (void) _displayPageInRect: (NSRect)pageRect
atPlacement: (NSPoint)location
withInfo: (page_info_t)info
{
int currentPage;
int numberOnSheet;
float xoffset, yoffset, scale;
NSString *label;
NSPoint location;
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
currentPage = [printOp currentPage];
numberOnSheet = (currentPage - info.first) % info.nup;
/* Begin a sheet (i.e. a physical page in Postscript terms). If
nup > 1 then this occurs only once every nup pages */
if (numberOnSheet == 0)
{
NSString *label;
label = nil;
if (info.nup == 1)
label = [NSString stringWithFormat: @"%d", currentPage];
/* Begin a sheet (i.e. a physical page in Postscript terms). If
nup > 1 then this occurs only once every nup pages */
if ((currentPage - info.first) % info.nup == 0)
{
[self beginPage: floor((currentPage - info.first)/info.nup)+1
label: label
bBox: info.sheetBounds
@ -1093,13 +1092,24 @@ scaleRect(NSRect rect, double scale)
}
/* Also offset by margins */
DPStranslate(ctxt, NSMinX(info.paperBounds), NSMinY(info.paperBounds));
/* End page setup for multi page */
if (info.nup != 1)
{
[self addToPageSetup];
[self endPageSetup];
}
}
scale = info.pageScale * info.printScale;
location = [self locationOfPrintRect: scaleRect(pageRect, scale)];
/* Begin a logical page */
[self beginPageInRect: pageRect atPlacement: location];
scale = info.pageScale * info.printScale;
if (scale != 1.0)
DPSscale(ctxt, scale, scale);
/* FIXME: Why is this needed? Shouldn't the flip be handled by the lockFocus method? */
if ([self isFlipped])
{
NSAffineTransformStruct ats = { 1, 0, 0, -1, 0, NSHeight(_bounds) };
@ -1127,35 +1137,28 @@ scaleRect(NSRect rect, double scale)
xoffset = 0 - NSMinX(pageRect);
DPStranslate(ctxt, xoffset, yoffset);
if ((currentPage - info.first) % info.nup == 0)
/* End page setup for single page */
if (info.nup == 1)
{
[self addToPageSetup];
[self endPageSetup];
}
/* Do the actual drawing */
[self displayRectIgnoringOpacity: pageRect];
/* End a logical page */
DPSgrestore(ctxt); // Balance gsave in beginPageInRect:
[self drawPageBorderWithSize:
scaleSize(info.paperBounds.size, info.nupScale)];
// Balance gsave in beginPageInRect:
DPSgrestore(ctxt);
[self drawPageBorderWithSize: info.paperBounds.size];
[self endPage];
/* End a physical page */
if (((currentPage - info.first) % info.nup == info.nup-1))
if (numberOnSheet == info.nup - 1)
{
[self drawSheetBorderWithSize: info.paperBounds.size];
[self drawSheetBorderWithSize: info.sheetBounds.size];
[self _endSheet];
}
}
- (void) _endSheet
{
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
if ([printOp isEPSOperation] == NO)
DPSPrintf(ctxt, "showpage\n");
DPSPrintf(ctxt, "%%%%PageTrailer\n");
DPSPrintf(ctxt, "\n");
}
@end

View file

@ -71,7 +71,6 @@
#include "AppKit/PSOperators.h"
#include "GNUstepGUI/GSDisplayServer.h"
#include "GNUstepGUI/GSTrackingRect.h"
#include "GNUstepGUI/GSVersion.h"
#include "GSToolTips.h"
/*
@ -3794,16 +3793,10 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
if (aString == nil)
aString = [[NSNumber numberWithInt: ordinalNum] description];
DPSPrintf(ctxt, "%%%%Page: %s %d\n", [aString lossyCString], ordinalNum);
if (NSIsEmptyRect(pageRect) == NO)
DPSPrintf(ctxt, "%%%%PageBoundingBox: %d %d %d %d\n",
(int)NSMinX(pageRect), (int)NSMinY(pageRect),
(int)NSMaxX(pageRect), (int)NSMaxY(pageRect));
if (fontNames)
DPSPrintf(ctxt, "%%%%PageFonts: %s\n", [fontNames lossyCString]);
DPSPrintf(ctxt, "%%%%BeginPageSetup\n");
[ctxt beginPage: ordinalNum
label: aString
bBox: pageRect
fonts: fontNames];
}
- (void) beginPageSetupRect: (NSRect)aRect placement: (NSPoint)location
@ -3821,55 +3814,14 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
{
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
NSPrintingOrientation orient;
BOOL epsOp;
epsOp = [printOp isEPSOperation];
orient = [[printOp printInfo] orientation];
if (epsOp)
DPSPrintf(ctxt, "%%!PS-Adobe-3.0 EPSF-3.0\n");
else
DPSPrintf(ctxt, "%%!PS-Adobe-3.0\n");
DPSPrintf(ctxt, "%%%%Title: %s\n", [aTitle lossyCString]);
DPSPrintf(ctxt, "%%%%Creator: %s\n", [anApplication lossyCString]);
DPSPrintf(ctxt, "%%%%CreationDate: %s\n",
[[dateCreated description] lossyCString]);
DPSPrintf(ctxt, "%%%%For: %s\n", [user lossyCString]);
if (fontNames)
DPSPrintf(ctxt, "%%%%DocumentFonts: %s\n", [fontNames lossyCString]);
else
DPSPrintf(ctxt, "%%%%DocumentFonts: (atend)\n");
if (NSIsEmptyRect(boundingBox) == NO)
DPSPrintf(ctxt, "%%%%BoundingBox: %d %d %d %d\n",
(int)NSMinX(boundingBox), (int)NSMinY(boundingBox),
(int)NSMaxX(boundingBox), (int)NSMaxY(boundingBox));
else
DPSPrintf(ctxt, "%%%%BoundingBox: (atend)\n");
if (epsOp == NO)
{
if (numPages)
DPSPrintf(ctxt, "%%%%Pages: %d\n", numPages);
else
DPSPrintf(ctxt, "%%%%Pages: (atend)\n");
if ([printOp pageOrder] == NSDescendingPageOrder)
DPSPrintf(ctxt, "%%%%PageOrder: Descend\n");
else if ([printOp pageOrder] == NSAscendingPageOrder)
DPSPrintf(ctxt, "%%%%PageOrder: Ascend\n");
else if ([printOp pageOrder] == NSSpecialPageOrder)
DPSPrintf(ctxt, "%%%%PageOrder: Special\n");
if (orient == NSPortraitOrientation)
DPSPrintf(ctxt, "%%%%Orientation: Portrait\n");
else
DPSPrintf(ctxt, "%%%%Orientation: Landscape\n");
}
DPSPrintf(ctxt, "%%%%GNUstepVersion: %d.%d.%d\n",
GNUSTEP_GUI_MAJOR_VERSION, GNUSTEP_GUI_MINOR_VERSION,
GNUSTEP_GUI_SUBMINOR_VERSION);
[ctxt beginPrologueBBox: boundingBox
creationDate: dateCreated
createdBy: anApplication
fonts: fontNames
forWhom: user
pages: numPages
title: aTitle];
}
- (void) addToPageSetup
@ -3881,7 +3833,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
DPSPrintf(ctxt, "%%%%BeginSetup\n");
[ctxt beginSetup];
}
- (void) beginTrailer
@ -3889,7 +3841,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
DPSPrintf(ctxt, "%%%%Trailer\n");
[ctxt beginTrailer];
}
- (void) drawPageBorderWithSize: (NSSize)borderSize
@ -3905,7 +3857,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
DPSPrintf(ctxt, "%%%%EndComments\n\n");
[ctxt endHeaderComments];
}
- (void) endPrologue
@ -3913,7 +3865,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
DPSPrintf(ctxt, "%%%%EndProlog\n\n");
[ctxt endPrologue];
}
- (void) endSetup
@ -3921,7 +3873,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
DPSPrintf(ctxt, "%%%%EndSetup\n\n");
[ctxt endSetup];
}
- (void) endPageSetup
@ -3929,7 +3881,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
DPSPrintf(ctxt, "%%%%EndPageSetup\n");
[ctxt endPageSetup];
}
- (void) endPage
@ -3953,13 +3905,12 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
DPSPrintf(ctxt, "%%%%EOF\n");
[ctxt endTrailer];
}
- (NSAttributedString *) pageFooter
{
return [[[NSAttributedString alloc]
initWithString:
return [[[NSAttributedString alloc] initWithString:
[NSString stringWithFormat:@"Page %d",
[[NSPrintOperation currentOperation] currentPage]]]
autorelease];
@ -3967,27 +3918,11 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
- (NSAttributedString *) pageHeader
{
return [[[NSAttributedString alloc]
initWithString:
return [[[NSAttributedString alloc] initWithString:
[NSString stringWithFormat:@"%@ %@", [self printJobTitle],
[[NSCalendarDate calendarDate] description]]] autorelease];
}
- (void) _loadPrinterProlog: (NSGraphicsContext *)ctxt
{
NSString *prolog;
prolog = [NSBundle pathForLibraryResource: @"GSProlog"
ofType: @"ps"
inDirectory: @"PostScript"];
if (prolog == nil)
{
NSLog(@"Cannot find printer prolog file");
return;
}
prolog = [NSString stringWithContentsOfFile: prolog];
DPSPrintf(ctxt, [prolog cString]);
}
/**
Writes header and job information for the PostScript document. This
@ -4044,8 +3979,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
title: [self printJobTitle]];
[self endHeaderComments];
DPSPrintf(ctxt, "%%%%BeginProlog\n");
[self _loadPrinterProlog: ctxt];
[ctxt printerProlog];
[self endPrologue];
if ([printOp isEPSOperation] == NO)
{
@ -4064,13 +3998,13 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
atPlacement:(NSPoint)location
{
int nup;
float scale;
NSRect bounds;
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
NSDictionary *dict = [[printOp printInfo] dictionary];
// FIXME: Need to place this correctly
// FIXME: Need to place this correctly. Maybe it isn't needed at all,
// as all drawing happens in displayRectIgnoringOpacity:
[self lockFocusIfCanDrawInContext: ctxt];
if ([dict objectForKey: @"NSPrintPaperBounds"])
@ -4083,11 +4017,14 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
{
int page;
float xoff, yoff;
float scale;
DPSPrintf(ctxt, "/__GSpagesaveobject save def\n");
scale = [[dict objectForKey: @"NSNupScale"] floatValue];
page = [printOp currentPage]
- [[dict objectForKey: NSPrintFirstPage] intValue];
page = page % nup;
scale = [[dict objectForKey: @"NSNupScale"] floatValue];
if (nup == 2)
xoff = page;
else
@ -4099,10 +4036,10 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
yoff = (int)((nup-page-1) / (nup/2));
yoff *= NSHeight(bounds) * scale;
DPStranslate(ctxt, xoff, yoff);
DPSgsave(ctxt);
DPSscale(ctxt, scale, scale);
}
else
// FIXME: This needs to be balanced explicitly
DPSgsave(ctxt);
/* Translate to placement */
@ -4110,10 +4047,17 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
DPStranslate(ctxt, location.x, location.y);
}
- (void) _endSheet
{
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
[ctxt endSheet];
}
- (void)endDocument
{
int first, last, current, pages;
NSSet *fontNames;
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSGraphicsContext *ctxt = [printOp context];
NSDictionary *dict = [[printOp printInfo] dictionary];
@ -4130,19 +4074,13 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
pages = current - first; // Current is 1 more than the last page
if (nup > 1)
pages = ceil((float)pages / nup);
DPSPrintf(ctxt, "%%%%Pages: %d\n", pages);
}
fontNames = [ctxt usedFonts];
if (fontNames && [fontNames count])
else
{
NSString *name;
NSEnumerator *e = [fontNames objectEnumerator];
DPSPrintf(ctxt, "%%%%DocumentFonts: %@\n", [e nextObject]);
while ((name = [e nextObject]))
{
DPSPrintf(ctxt, "%%%%+ %@\n", name);
}
// Already reported at start of document
pages = 0;
}
[ctxt endDocumentPages: pages documentFonts: [ctxt usedFonts]];
[self endTrailer];
[self _invalidateCoordinates];