diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2015-04-07 13:49:31 +0200 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2015-04-07 13:35:08 +0100 |
commit | 0ccfd9c40b6790fca0f753e03b473b5f78ba97f9 (patch) | |
tree | 6dfc359cb0a88a4bc887672bf7048a6c5337d74e /platform/x11 | |
parent | b8eb55a488aa9dc6884e01b06e948faf1f83012d (diff) | |
download | mupdf-0ccfd9c40b6790fca0f753e03b473b5f78ba97f9.tar.xz |
Add EPUB layout options to mupdf-x11 and mudraw.
Diffstat (limited to 'platform/x11')
-rw-r--r-- | platform/x11/pdfapp.c | 7 | ||||
-rw-r--r-- | platform/x11/pdfapp.h | 4 | ||||
-rw-r--r-- | platform/x11/x11_main.c | 33 |
3 files changed, 26 insertions, 18 deletions
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c index 651b3844..3d727ed1 100644 --- a/platform/x11/pdfapp.c +++ b/platform/x11/pdfapp.c @@ -115,6 +115,11 @@ void pdfapp_init(fz_context *ctx, pdfapp_t *app) app->scrh = 480; app->resolution = 72; app->ctx = ctx; + + app->layout_w = 450; + app->layout_h = 600; + app->layout_em = 12; + app->transition.duration = 0.25; app->transition.type = FZ_TRANSITION_FADE; #if defined(_WIN32) || defined(_WIN64) @@ -389,6 +394,8 @@ void pdfapp_open_progressive(pdfapp_t *app, char *filename, int reload, int bps) app->doctitle = strrchr(app->doctitle, '/') + 1; app->doctitle = fz_strdup(ctx, app->doctitle); + fz_layout_document(app->ctx, app->doc, app->layout_w, app->layout_h, app->layout_em); + while (1) { fz_try(ctx) diff --git a/platform/x11/pdfapp.h b/platform/x11/pdfapp.h index 5d748ad6..46f09640 100644 --- a/platform/x11/pdfapp.h +++ b/platform/x11/pdfapp.h @@ -54,6 +54,10 @@ struct pdfapp_s fz_outline *outline; int outline_deferred; + float layout_w; + float layout_h; + float layout_em; + int pagecount; /* current view params */ diff --git a/platform/x11/x11_main.c b/platform/x11/x11_main.c index 0da79469..80c86a23 100644 --- a/platform/x11/x11_main.c +++ b/platform/x11/x11_main.c @@ -798,10 +798,13 @@ static void signal_handler(int signal) static void usage(void) { fprintf(stderr, "usage: mupdf [options] file.pdf [page]\n"); - fprintf(stderr, "\t-b -\tset anti-aliasing quality in bits (0=off, 8=best)\n"); fprintf(stderr, "\t-p -\tpassword\n"); fprintf(stderr, "\t-r -\tresolution\n"); + fprintf(stderr, "\t-A -\tset anti-aliasing quality in bits (0=off, 8=best)\n"); fprintf(stderr, "\t-C -\tRRGGBB (tint color in hexadecimal syntax)\n"); + fprintf(stderr, "\t-W -\tpage width for EPUB layout\n"); + fprintf(stderr, "\t-H -\tpage height for EPUB layout\n"); + fprintf(stderr, "\t-S -\tfont size for EPUB layout\n"); exit(1); } @@ -822,8 +825,6 @@ int main(int argc, char **argv) struct timeval now; struct timeval *timeout; struct timeval tmo_advance_delay; - int tint = 0; - int tint_r, tint_g, tint_b; ctx = fz_new_context(NULL, NULL, FZ_STORE_DEFAULT); if (!ctx) @@ -832,20 +833,25 @@ int main(int argc, char **argv) exit(1); } - while ((c = fz_getopt(argc, argv, "p:r:b:C:")) != -1) + pdfapp_init(ctx, &gapp); + + while ((c = fz_getopt(argc, argv, "p:r:A:C:W:H:S:")) != -1) { switch (c) { case 'C': c = strtol(fz_optarg, NULL, 16); - tint = 1; - tint_r = (c >> 16) & 255; - tint_g = (c >> 8) & 255; - tint_b = (c) & 255; + gapp.tint = 1; + gapp.tint_r = (c >> 16) & 255; + gapp.tint_g = (c >> 8) & 255; + gapp.tint_b = (c) & 255; break; case 'p': password = fz_optarg; break; case 'r': resolution = atoi(fz_optarg); break; - case 'b': fz_set_aa_level(ctx, atoi(fz_optarg)); break; + case 'A': fz_set_aa_level(ctx, atoi(fz_optarg)); break; + case 'W': gapp.layout_w = fz_atof(fz_optarg); break; + case 'H': gapp.layout_h = fz_atof(fz_optarg); break; + case 'S': gapp.layout_em = fz_atof(fz_optarg); break; default: usage(); } } @@ -858,15 +864,6 @@ int main(int argc, char **argv) if (argc - fz_optind == 1) pageno = atoi(argv[fz_optind++]); - pdfapp_init(ctx, &gapp); - if (tint) - { - gapp.tint = tint; - gapp.tint_r = tint_r; - gapp.tint_g = tint_g; - gapp.tint_b = tint_b; - } - winopen(); if (resolution == -1) |