aboutsummaryrefslogtreecommitdiff
path: root/src/render.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-09-10 07:35:04 +0200
committerThomas White <taw@bitwiz.org.uk>2013-09-10 07:35:04 +0200
commitba50adbd5cc957e40d2496cdbcec6de03b34648e (patch)
treebc8f65d78ab9a435bab740de944976b5b43bde02 /src/render.c
parentd970f81edbcbbcba6137fe1541501ad1af49ab6d (diff)
Improve quality of PDF output
Diffstat (limited to 'src/render.c')
-rw-r--r--src/render.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/render.c b/src/render.c
index 9eb4459..c78cce6 100644
--- a/src/render.c
+++ b/src/render.c
@@ -493,11 +493,15 @@ cairo_surface_t *render_slide(struct slide *s, int w, double ww, double hh,
int export_pdf(struct presentation *p, const char *filename)
{
int i;
+ double r;
+ double w = 2048.0;
cairo_surface_t *surf;
cairo_t *cr;
+ double scale;
+
+ r = p->slide_height / p->slide_width;
- surf = cairo_pdf_surface_create(filename, p->slide_width,
- p->slide_height);
+ surf = cairo_pdf_surface_create(filename, w, w*r);
if ( cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS ) {
fprintf(stderr, "Couldn't create Cairo surface\n");
@@ -506,6 +510,9 @@ int export_pdf(struct presentation *p, const char *filename)
cr = cairo_create(surf);
+ scale = w / p->slide_width;
+ cairo_scale(cr, scale, scale);
+
for ( i=0; i<p->num_slides; i++ ) {
struct slide *s;
@@ -517,10 +524,10 @@ int export_pdf(struct presentation *p, const char *filename)
s->top->lop.x = 0.0;
s->top->lop.y = 0.0;
- s->top->lop.w = p->slide_width;
- s->top->lop.h = p->slide_height;
- s->top->w = p->slide_width;
- s->top->h = p->slide_height;
+ s->top->lop.w = w;
+ s->top->lop.h = w*r;
+ s->top->w = w;
+ s->top->h = w*r;
render_frame(cr, s->top, p->is, ISZ_SLIDESHOW, s->constants,
s->parent->constants);