Printing improvements and handle rotated text.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@25296 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2007-06-29 11:31:53 +00:00
parent 98b5c95dcd
commit 508f9e54ec
7 changed files with 58 additions and 8 deletions

View file

@ -1,3 +1,14 @@
2007-06-29 Fred Kiefer <FredKiefer@gmx.de>
* Headers/cairo/CairoSurface.h,
* Source/cairo/CairoSurface.m (-setSize:): Add method.
* Headers/cairo/CairoGState.h,
* Source/cairo/CairoGState.m (-setSize:, -showPage): Add methods.
* Source/cairo/CairoContext.m (-beginPrologueBBox:...title:,
-showPage): New methods.
* Source/cairo/CairoGState.m (-GSShowGlyphs::): Handle rotated
text correctly.
2007-06-05 Fred Kiefer <FredKiefer@gmx.de>
* Source/art/image.m (-DPSimage:): Replaced appendTransform: with

View file

@ -41,7 +41,8 @@
- (void) DPSgsave;
- (void) DPSgrestore;
- (void) setSize: (NSSize)size;
- (void) showPage;
@end
#endif

View file

@ -36,6 +36,7 @@
- (id) initWithDevice: (void *)device;
- (NSSize) size;
- (void) setSize: (NSSize)newSize;
- (cairo_surface_t *) surface;

View file

@ -133,4 +133,20 @@
[CGSTATE GSSetSurface: surface : x : y];
}
- (void) beginPrologueBBox: (NSRect)boundingBox
creationDate: (NSString*)dateCreated
createdBy: (NSString*)anApplication
fonts: (NSString*)fontNames
forWhom: (NSString*)user
pages: (int)numPages
title: (NSString*)aTitle
{
[CGSTATE setSize: boundingBox.size];
}
- (void) showPage
{
[CGSTATE showPage];
}
@end

View file

@ -180,7 +180,7 @@
}
}
- (void) DPSshowpage
- (void) showPage
{
if (_ct)
{
@ -188,6 +188,14 @@
}
}
- (void) setSize: (NSSize)size
{
if (_surface)
{
[_surface setSize: size];
}
}
/*
* Color operations
*/
@ -291,10 +299,24 @@
{
if (_ct)
{
cairo_matrix_t local_matrix;
NSAffineTransformStruct matrix = [ctm transformStruct];
[self _setPoint];
// FIXME: Hack to get font in rotated view working
cairo_save(_ct);
cairo_matrix_init(&local_matrix, matrix.m11, matrix.m12, matrix.m21,
matrix.m22, 0, 0);
cairo_transform(_ct, &local_matrix);
// Undo the
cairo_matrix_init_scale(&local_matrix, 1, -1);
cairo_matrix_translate(&local_matrix, 0, -[_surface size].height);
cairo_transform(_ct, &local_matrix);
[(CairoFontInfo *)font drawGlyphs: glyphs
length: length
on: _ct];
cairo_restore(_ct);
}
}

View file

@ -32,17 +32,12 @@
info = (NSDictionary*)device;
path = [info objectForKey: @"NSOutputFile"];
//NSLog(@"Write to file %@", path);
// This gets only set later on:
// @"NSPrintSheetBounds"
// FIXME: Hard coded size in points
size = NSMakeSize(400, 400);
_surface = cairo_ps_surface_create([path fileSystemRepresentation], size.width, size.height);
if (cairo_surface_status(_surface))
{
NSLog(@"Could not create surface");
DESTROY(self);
}
@ -60,7 +55,6 @@
cairo_ps_surface_set_size(_surface, size.width, size.height);
}
- (void) writeComment: (NSString *)comment
{
cairo_ps_surface_dsc_comment(_surface, [comment UTF8String]);

View file

@ -53,6 +53,11 @@
return NSMakeSize(0, 0);
}
- (void) setSize: (NSSize)newSize
{
[self subclassResponsibility:_cmd];
}
- (cairo_surface_t *) surface
{
return _surface;