Skip to content

Commit

Permalink
update mupdf to 1.25-rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Nov 20, 2024
1 parent ee66e5c commit 321403f
Show file tree
Hide file tree
Showing 27 changed files with 679 additions and 277 deletions.
1 change: 1 addition & 0 deletions mupdf/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ List of changes in MuPDF 1.25
- fz_text_item now has an explicit pen "advance" member.
- mutool recolor can now be used as a function.
- pdf_annot_rect works with the "design" rectangle.
- structured text "color" field renamed to "argb" and now includes alpha channel

Important bug fixes:
- More robust font subsetting.
Expand Down
13 changes: 10 additions & 3 deletions mupdf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -503,19 +503,26 @@ install-docs:

install: install-libs install-apps install-docs

install-docs-html:
docs:
python3 scripts/build-docs.py

install-docs-html: docs
install -d $(DESTDIR)$(docdir)
install -d $(DESTDIR)$(docdir)/_images
install -d $(DESTDIR)$(docdir)/_static
install -d $(DESTDIR)$(docdir)/_static/styles
install -d $(DESTDIR)$(docdir)/_static/scripts
install -m 644 build/docs/html/*.html $(DESTDIR)$(docdir)
install -m 644 build/docs/html/*.inv $(DESTDIR)$(docdir)
install -m 644 build/docs/html/*.js $(DESTDIR)$(docdir)
install -m 644 build/docs/html/_images/* $(DESTDIR)$(docdir)/_images
install -m 644 build/docs/html/_static/*.css $(DESTDIR)$(docdir)/_static
install -m 644 build/docs/html/_static/*.ico $(DESTDIR)$(docdir)/_static
install -m 644 build/docs/html/_static/*.js $(DESTDIR)$(docdir)/_static
install -m 644 build/docs/html/_static/*.png $(DESTDIR)$(docdir)/_static
install -m 644 build/docs/html/_static/*.css $(DESTDIR)$(docdir)/_static
install -m 644 build/docs/html/_static/scripts/*.js $(DESTDIR)$(docdir)/_static/scripts
install -m 644 build/docs/html/_static/scripts/*.map $(DESTDIR)$(docdir)/_static/scripts
install -m 644 build/docs/html/_static/styles/*.css $(DESTDIR)$(docdir)/_static/styles

tarball:
bash scripts/archive.sh
Expand Down Expand Up @@ -668,7 +675,7 @@ install-% c++-% python-% csharp-%:

endif

.PHONY: all clean nuke install third libs apps generate tags
.PHONY: all clean nuke install third libs apps generate tags docs
.PHONY: shared shared-debug shared-clean
.PHONY: c++-% python-% csharp-%
.PHONY: c++-clean python-clean csharp-clean
29 changes: 28 additions & 1 deletion mupdf/docs/src/changes.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. Copyright (C) 2001-2023 Artifex Software, Inc.
.. Copyright (C) 2001-2024 Artifex Software, Inc.
.. All Rights Reserved.
Expand Down Expand Up @@ -34,6 +34,33 @@ To minimise the impact of such changes, we undertake to list the :title:`API` ch

The changes listed below only affects *existing* :title:`APIs`.

Changes from 1.24 to 1.25
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- New `wants_file` member for `fz_document_handler`.
- `fz_text_item` now has an explicit pen `advance` member.
- `pdf_annot_rect` works with the "design" rectangle.
- mutool recolor can now be used as a function.


Changes from 1.23 to 1.24
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- You must call `pdf_report_error` in the final `fz_catch`. Any unreported errors will be automatically reported when a new error is raised, or when closing the fitz context.
- The deprecated pdf_check_signature was removed.


Changes from 1.22 to 1.23
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- `pdf_field_name` renamed to `pdf_load_field_name`.
- mutool run changed many methods to match Java and new WASM library.


Changes from 1.21 to 1.22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

None.


Changes from 1.20 to 1.21
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 3 additions & 3 deletions mupdf/docs/src/language-bindings.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. Copyright (C) 2001-2023 Artifex Software, Inc.
.. Copyright (C) 2001-2024 Artifex Software, Inc.
.. All Rights Reserved.
.. include:: header.rst
Expand Down Expand Up @@ -350,9 +350,9 @@ The Python and C# MuPDF APIs
`mupdf::FzBuffer` instance and `truncated` is an integer.

* Allows implementation of mutool in Python - see
`mupdf:scripts/mutool.py <https://git.ghostscript.com/?p=mupdf.git;a=blob;f=mupdf:scripts/mutool.py>`_
`mupdf:scripts/mutool.py <https://git.ghostscript.com/?p=mupdf.git;a=blob;f=scripts/mutool.py>`_
and
`mupdf:scripts/mutool_draw.py <https://git.ghostscript.com/?p=mupdf.git;a=blob;f=mupdf:scripts/mutool_draw.py>`_.
`mupdf:scripts/mutool_draw.py <https://git.ghostscript.com/?p=mupdf.git;a=blob;f=scripts/mutool_draw.py>`_.

* Provides text representation of simple 'POD' structs:

Expand Down
8 changes: 8 additions & 0 deletions mupdf/include/mupdf/fitz/outline.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ int fz_outline_iterator_down(fz_context *ctx, fz_outline_iterator *iter);
After an insert, we do not change where we are pointing.
The return code is the same as for next, it indicates the current iterator position.
Note that for PDF documents at least, the is_open field is ignored. All childless
nodes are considered closed by PDF, hence (given every newly inserted node is
childless by definition) all new nodes are inserted with is_open == false.
*/
int fz_outline_iterator_insert(fz_context *ctx, fz_outline_iterator *iter, fz_outline_item *item);

Expand Down Expand Up @@ -107,6 +111,10 @@ void fz_drop_outline_iterator(fz_context *ctx, fz_outline_iterator *iter);
down: The outline items immediate children in the hierarchy.
May be NULL if no children exist.
is_open: If zero, the outline element is closed in the UI. If
1, it should be open, showing any child elements. All other
values reserved.
*/
typedef struct fz_outline
{
Expand Down
4 changes: 2 additions & 2 deletions mupdf/include/mupdf/fitz/structured-text.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ struct fz_stext_block
struct { fz_stext_line *first_line, *last_line; } t;
struct { fz_matrix transform; fz_image *image; } i;
struct { fz_stext_struct *down; int index; } s;
struct { uint8_t stroked; uint8_t rgba[4]; } v;
struct { uint8_t stroked; uint32_t argb; } v;
struct { fz_stext_grid_positions *xs; fz_stext_grid_positions *ys; } b;
} u;
fz_stext_block *prev, *next;
Expand All @@ -338,7 +338,7 @@ struct fz_stext_char
int c; /* unicode character value */
uint16_t bidi; /* even for LTR, odd for RTL - probably only needs 8 bits? */
uint16_t flags;
int color; /* sRGB hex color */
uint32_t argb; /* sRGB hex color (alpha in top 8 bits, then r, then g, then b in low bits) */
fz_point origin;
fz_quad quad;
float size;
Expand Down
2 changes: 1 addition & 1 deletion mupdf/platform/gl/gl-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3275,7 +3275,7 @@ int main(int argc, char **argv)
return 0;
}

#ifdef _MSC_VER
#ifdef _WIN32
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
int argc;
Expand Down
1 change: 1 addition & 0 deletions mupdf/scripts/wrap/cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5324,6 +5324,7 @@ def show_clang_diagnostic( diagnostic, depth=0):
#include "mupdf/fitz/geometry.h"
#include <algorithm>
#include <map>
#include <mutex>
#include <sstream>
Expand Down
8 changes: 4 additions & 4 deletions mupdf/source/fitz/directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <errno.h>
#include <sys/stat.h>

#ifdef _MSC_VER
#ifdef _WIN32
#include <windows.h>
#include <errno.h>
#define stat _stat
Expand Down Expand Up @@ -139,7 +139,7 @@ fz_archive *
fz_open_directory(fz_context *ctx, const char *path)
{
fz_directory *dir;
#ifdef _MSC_VER
#ifdef _WIN32
WCHAR *wpath = NULL;
size_t z = 3;
HANDLE h = NULL;
Expand Down Expand Up @@ -168,7 +168,7 @@ fz_open_directory(fz_context *ctx, const char *path)

fz_try(ctx)
{
#ifdef _MSC_VER
#ifdef _WIN32
char const *p = path;
WCHAR *w;
while (*p)
Expand Down Expand Up @@ -254,7 +254,7 @@ fz_open_directory(fz_context *ctx, const char *path)
}
fz_always(ctx)
{
#ifdef _MSC_VER
#ifdef _WIN32
fz_free(ctx, wpath);
if (h)
(void)FindClose(h);
Expand Down
1 change: 0 additions & 1 deletion mupdf/source/fitz/draw-rasterize.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ fz_set_rasterizer_graphics_aa_level(fz_context *ctx, fz_aa_context *aa, int leve
aa->bits = 0;
}
aa->scale = 0xFF00 / (aa->hscale * aa->vscale);
fz_set_rasterizer_text_aa_level(ctx, aa, level);
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion mupdf/source/fitz/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <string.h>
#include <errno.h>

#ifdef _MSC_VER
#ifdef _WIN32
#ifndef NDEBUG
#define USE_OUTPUT_DEBUG_STRING
#include <windows.h>
Expand Down
26 changes: 25 additions & 1 deletion mupdf/source/fitz/printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static void fmtquote(struct fmtbuf *out, const char *s, int sq, int eq, int verb
for (i = 0; i < n; ++i)
fmtputc(out, s[i]);
}
else
else if (c <= 0xffff)
{
fmtputc(out, '\\');
fmtputc(out, 'u');
Expand All @@ -262,6 +262,24 @@ static void fmtquote(struct fmtbuf *out, const char *s, int sq, int eq, int verb
fmtputc(out, "0123456789ABCDEF"[(c>>4)&15]);
fmtputc(out, "0123456789ABCDEF"[(c)&15]);
}
else
{
/* Use a surrogate pair */
int hi = 0xd800 + ((c - 0x10000) >> 10);
int lo = 0xdc00 + ((c - 0x10000) & 0x3ff);
fmtputc(out, '\\');
fmtputc(out, 'u');
fmtputc(out, "0123456789ABCDEF"[(hi>>12)&15]);
fmtputc(out, "0123456789ABCDEF"[(hi>>8)&15]);
fmtputc(out, "0123456789ABCDEF"[(hi>>4)&15]);
fmtputc(out, "0123456789ABCDEF"[(hi)&15]);
fmtputc(out, '\\');
fmtputc(out, 'u');
fmtputc(out, "0123456789ABCDEF"[(lo>>12)&15]);
fmtputc(out, "0123456789ABCDEF"[(lo>>8)&15]);
fmtputc(out, "0123456789ABCDEF"[(lo>>4)&15]);
fmtputc(out, "0123456789ABCDEF"[(lo)&15]);
}
} else {
if (c == sq || c == eq)
fmtputc(out, '\\');
Expand Down Expand Up @@ -356,6 +374,12 @@ static void fmtquote_xml(struct fmtbuf *out, const char *s)
if (c < 32 || c >= 127) {
fmtputc(out, '&');
fmtputc(out, '#');
fmtputc(out, 'x');
if (c > 65535)
{
fmtputc(out, "0123456789ABCDEF"[(c>>20)&15]);
fmtputc(out, "0123456789ABCDEF"[(c>>16)&15]);
}
if (c > 255)
{
fmtputc(out, "0123456789ABCDEF"[(c>>12)&15]);
Expand Down
Loading

0 comments on commit 321403f

Please sign in to comment.