Ticket #51918: patch-mupdf.diff

File patch-mupdf.diff, 4.6 KB (added by harciga, 8 years ago)
  • AUTHORS

    diff --git a/AUTHORS b/AUTHORS
    index f5f8430..371ebf1 100644
    a b Sebastian Ramacher <s.ramacher@gmx.at> 
    55
    66Other contributors are (in alphabetical order):
    77
     8Christian Hesse <mail@eworm.de>
    89Pavel Borzenkov <pavel.borzenkov@gmail.com>
    910William Skeith <wes@cs.ccny.cuny.edu>
  • config.mk

    diff --git a/config.mk b/config.mk
    index cba8d40..6407ae6 100644
    a b endif 
    3232OPENSSL_INC ?= $(shell pkg-config --cflags libcrypto)
    3333OPENSSL_LIB ?= $(shell pkg-config --libs libcrypto)
    3434
    35 MUPDF_LIB ?= -lmupdf -lmujs
     35MUPDF_LIB ?= -lmupdf -lmupdfthird
    3636
    3737INCS = ${GTK_INC} ${GIRARA_INC} ${OPENSSL_INC} ${ZATHURA_INC}
    3838LIBS = ${GTK_LIB} ${GIRARA_LIB} ${MUPDF_LIB} ${OPENSSL_LIB} -ljbig2dec -lopenjp2 -ljpeg
  • document.c

    diff --git a/document.c b/document.c
    index 873866c..8d0aae4 100644
    a b pdf_document_save_as(zathura_document_t* document, mupdf_document_t* 
    109109  }
    110110
    111111  fz_try (mupdf_document->ctx) {
    112     /* fz_write_document claims to accepts NULL as third argument but doesn't.
    113      * pdf_write_document does not check if the third arguments is NULL for some
    114      * options. */
    115 
    116     fz_write_options opts = { 0 }; /* just use the default options */
    117     fz_write_document(mupdf_document->ctx, mupdf_document->document, (char*) path, &opts);
     112    pdf_save_document(mupdf_document->ctx, (pdf_document*) mupdf_document->document, (char*) path, NULL);
    118113  } fz_catch (mupdf_document->ctx) {
    119114    return ZATHURA_ERROR_UNKNOWN;
    120115  }
  • image.c

    diff --git a/image.c b/image.c
    index 97d4143..8f6912b 100644
    a b pdf_page_image_get_cairo(zathura_page_t* page, mupdf_page_t* mupdf_page, 
    9393  fz_pixmap* pixmap = NULL;
    9494  cairo_surface_t* surface = NULL;
    9595
    96   pixmap = fz_new_pixmap_from_image(mupdf_page->ctx, mupdf_image, 0, 0);
     96  pixmap = fz_get_pixmap_from_image(mupdf_page->ctx, mupdf_image, 0, 0);
    9797  if (pixmap == NULL) {
    9898    goto error_free;
    9999  }
  • page.c

    diff --git a/page.c b/page.c
    index beb0351..219fc2a 100644
    a b pdf_page_init(zathura_page_t* page) 
    4343  /* setup text */
    4444  mupdf_page->extracted_text = false;
    4545
    46   mupdf_page->text = fz_new_text_page(mupdf_page->ctx);
     46  mupdf_page->text = fz_new_stext_page(mupdf_page->ctx);
    4747  if (mupdf_page->text == NULL) {
    4848    goto error_free;
    4949  }
    5050
    51   mupdf_page->sheet = fz_new_text_sheet(mupdf_page->ctx);
     51  mupdf_page->sheet = fz_new_stext_sheet(mupdf_page->ctx);
    5252  if (mupdf_page->sheet == NULL) {
    5353    goto error_free;
    5454  }
    pdf_page_clear(zathura_page_t* page, mupdf_page_t* mupdf_page) 
    7474
    7575  if (mupdf_page != NULL) {
    7676    if (mupdf_page->text != NULL) {
    77       fz_drop_text_page(mupdf_page->ctx, mupdf_page->text);
     77      fz_drop_stext_page(mupdf_page->ctx, mupdf_page->text);
    7878    }
    7979
    8080    if (mupdf_page->sheet != NULL) {
    81       fz_drop_text_sheet(mupdf_page->ctx, mupdf_page->sheet);
     81      fz_drop_stext_sheet(mupdf_page->ctx, mupdf_page->sheet);
    8282    }
    8383
    8484    if (mupdf_page->page != NULL) {
  • plugin.h

    diff --git a/plugin.h b/plugin.h
    index f2fb4a0..84c5e53 100644
    a b typedef struct mupdf_page_s 
    2121{
    2222  fz_page* page; /**< Reference to the mupdf page */
    2323  fz_context* ctx; /**< Context */
    24   fz_text_sheet* sheet; /**< Text sheet */
    25   fz_text_page* text; /**< Page text */
     24  fz_stext_sheet* sheet; /**< Text sheet */
     25  fz_stext_page* text; /**< Page text */
    2626  fz_rect bbox; /**< Bbox */
    2727  bool extracted_text; /**< If text has already been extracted */
    2828} mupdf_page_t;
  • search.c

    diff --git a/search.c b/search.c
    index 3a9fad4..c672b9f 100644
    a b pdf_page_search_text(zathura_page_t* page, mupdf_page_t* mupdf_page, const char* 
    4040  }
    4141
    4242  fz_rect* hit_bbox = fz_malloc_array(mupdf_page->ctx, N_SEARCH_RESULTS, sizeof(fz_rect));
    43   int num_results = fz_search_text_page(mupdf_page->ctx, mupdf_page->text,
     43  int num_results = fz_search_stext_page(mupdf_page->ctx, mupdf_page->text,
    4444      (char*) text, hit_bbox, N_SEARCH_RESULTS);
    4545
    4646  for (int i = 0; i < num_results; i++) {
  • utils.c

    diff --git a/utils.c b/utils.c
    index 4a003b9..a4b9320 100644
    a b mupdf_page_extract_text(mupdf_document_t* mupdf_document, mupdf_page_t* mupdf_pa 
    1414  fz_device* text_device = NULL;
    1515
    1616  fz_try (mupdf_page->ctx) {
    17     text_device = fz_new_text_device(mupdf_page->ctx, mupdf_page->sheet, mupdf_page->text);
     17    text_device = fz_new_stext_device(mupdf_page->ctx, mupdf_page->sheet, mupdf_page->text);
    1818
    1919    /* Disable FZ_IGNORE_IMAGE to collect image blocks */
    2020    fz_disable_device_hints(mupdf_page->ctx, text_device, FZ_IGNORE_IMAGE);