Commit e3e49d20 authored by Christian Hesse's avatar Christian Hesse Committed by Moritz Lipp

mupdf 1.9 compatibility

parent cd96a975
Pipeline #135 skipped
......@@ -5,5 +5,6 @@ Sebastian Ramacher <s.ramacher@gmx.at>
Other contributors are (in alphabetical order):
Christian Hesse <mail@eworm.de>
Pavel Borzenkov <pavel.borzenkov@gmail.com>
William Skeith <wes@cs.ccny.cuny.edu>
......@@ -32,7 +32,7 @@ endif
OPENSSL_INC ?= $(shell pkg-config --cflags libcrypto)
OPENSSL_LIB ?= $(shell pkg-config --libs libcrypto)
MUPDF_LIB ?= -lmupdf -lmujs
MUPDF_LIB ?= -lmupdf -lmupdfthird
INCS = ${GTK_INC} ${GIRARA_INC} ${OPENSSL_INC} ${ZATHURA_INC}
LIBS = ${GTK_LIB} ${GIRARA_LIB} ${MUPDF_LIB} ${OPENSSL_LIB} -ljbig2dec -lopenjp2 -ljpeg
......
......@@ -109,12 +109,12 @@ pdf_document_save_as(zathura_document_t* document, mupdf_document_t*
}
fz_try (mupdf_document->ctx) {
/* fz_write_document claims to accepts NULL as third argument but doesn't.
/* pdf_save_document claims to accepts NULL as third argument but doesn't.
* pdf_write_document does not check if the third arguments is NULL for some
* options. */
fz_write_options opts = { 0 }; /* just use the default options */
fz_write_document(mupdf_document->ctx, mupdf_document->document, (char*) path, &opts);
pdf_write_options opts = { 0 }; /* just use the default options */
pdf_save_document(mupdf_document->ctx, (pdf_document*) mupdf_document->document, (char*) path, &opts);
} fz_catch (mupdf_document->ctx) {
return ZATHURA_ERROR_UNKNOWN;
}
......
......@@ -93,7 +93,7 @@ pdf_page_image_get_cairo(zathura_page_t* page, mupdf_page_t* mupdf_page,
fz_pixmap* pixmap = NULL;
cairo_surface_t* surface = NULL;
pixmap = fz_new_pixmap_from_image(mupdf_page->ctx, mupdf_image, 0, 0);
pixmap = fz_get_pixmap_from_image(mupdf_page->ctx, mupdf_image, 0, 0);
if (pixmap == NULL) {
goto error_free;
}
......
......@@ -43,12 +43,12 @@ pdf_page_init(zathura_page_t* page)
/* setup text */
mupdf_page->extracted_text = false;
mupdf_page->text = fz_new_text_page(mupdf_page->ctx);
mupdf_page->text = fz_new_stext_page(mupdf_page->ctx);
if (mupdf_page->text == NULL) {
goto error_free;
}
mupdf_page->sheet = fz_new_text_sheet(mupdf_page->ctx);
mupdf_page->sheet = fz_new_stext_sheet(mupdf_page->ctx);
if (mupdf_page->sheet == NULL) {
goto error_free;
}
......@@ -74,11 +74,11 @@ pdf_page_clear(zathura_page_t* page, mupdf_page_t* mupdf_page)
if (mupdf_page != NULL) {
if (mupdf_page->text != NULL) {
fz_drop_text_page(mupdf_page->ctx, mupdf_page->text);
fz_drop_stext_page(mupdf_page->ctx, mupdf_page->text);
}
if (mupdf_page->sheet != NULL) {
fz_drop_text_sheet(mupdf_page->ctx, mupdf_page->sheet);
fz_drop_stext_sheet(mupdf_page->ctx, mupdf_page->sheet);
}
if (mupdf_page->page != NULL) {
......
......@@ -21,8 +21,8 @@ typedef struct mupdf_page_s
{
fz_page* page; /**< Reference to the mupdf page */
fz_context* ctx; /**< Context */
fz_text_sheet* sheet; /**< Text sheet */
fz_text_page* text; /**< Page text */
fz_stext_sheet* sheet; /**< Text sheet */
fz_stext_page* text; /**< Page text */
fz_rect bbox; /**< Bbox */
bool extracted_text; /**< If text has already been extracted */
} mupdf_page_t;
......
......@@ -40,7 +40,7 @@ pdf_page_search_text(zathura_page_t* page, mupdf_page_t* mupdf_page, const char*
}
fz_rect* hit_bbox = fz_malloc_array(mupdf_page->ctx, N_SEARCH_RESULTS, sizeof(fz_rect));
int num_results = fz_search_text_page(mupdf_page->ctx, mupdf_page->text,
int num_results = fz_search_stext_page(mupdf_page->ctx, mupdf_page->text,
(char*) text, hit_bbox, N_SEARCH_RESULTS);
for (int i = 0; i < num_results; i++) {
......
......@@ -14,7 +14,7 @@ mupdf_page_extract_text(mupdf_document_t* mupdf_document, mupdf_page_t* mupdf_pa
fz_device* text_device = NULL;
fz_try (mupdf_page->ctx) {
text_device = fz_new_text_device(mupdf_page->ctx, mupdf_page->sheet, mupdf_page->text);
text_device = fz_new_stext_device(mupdf_page->ctx, mupdf_page->sheet, mupdf_page->text);
/* Disable FZ_IGNORE_IMAGE to collect image blocks */
fz_disable_device_hints(mupdf_page->ctx, text_device, FZ_IGNORE_IMAGE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment