fixed pdf scalefactor bug

This commit is contained in:
Florian Stecker 2019-01-18 15:26:04 +01:00
parent 80957d590e
commit 78ad483918
2 changed files with 3 additions and 1 deletions

View File

@ -12,6 +12,7 @@ static Bool alwaysTruePredicate(Display *display, XEvent *event, XPointer arg)
return true;
}
// this computes center, radius and scalefactor out of ctx->matrix
void updateDimensions(DrawingContext *ctx)
{
double det = ctx->matrix.xx * ctx->matrix.yy - ctx->matrix.xy * ctx->matrix.yx;

View File

@ -501,7 +501,8 @@ void print(DrawingContext *screen)
file.width = screen->width;
file.height = screen->width / sqrt(2.0);
file.matrix = screen->matrix;
file.matrix.y0 += (file.height - screen->height) / 2.0; // recenter vertically
file.matrix.y0 += ((double)file.height - (double)screen->height) / 2.0; // recenter vertically
updateDimensions(&file);
surface = cairo_pdf_surface_create(filename, (double)file.width, (double)file.height);
file.cairo = cairo_create(surface);