Commit 07e79589 authored by Kan-Ru Chen's avatar Kan-Ru Chen

New upstream version 1.13.0+ds1

parent 0fdbf3bc
List of changes in MuPDF 1.13.0
* This is primarily a bugfix release.
* New "mutool sign" tool for showing and verifying digital signatures.
* Chinese, Japanese, Korean, Cyrillic, and Greek font support in mutool create.
* Improvements to annotation editing API.
List of changes in MuPDF 1.12.0
* New Android SDK:
......
......@@ -53,6 +53,7 @@ ALL_DIR += $(OUT)/source/gprf
ALL_DIR += $(OUT)/source/tools
ALL_DIR += $(OUT)/source/helpers
ALL_DIR += $(OUT)/source/helpers/mu-threads
ALL_DIR += $(OUT)/source/helpers/pkcs7
ALL_DIR += $(OUT)/platform/x11
ALL_DIR += $(OUT)/platform/x11/curl
ALL_DIR += $(OUT)/platform/gl
......@@ -72,7 +73,7 @@ QUIET_WINDRES = @ echo ' ' ' ' WINDRES $@ ;
endif
CC_CMD = $(QUIET_CC) $(CC) $(CFLAGS) -o $@ -c $<
CXX_CMD = $(QUIET_CXX) $(CXX) $(CFLAGS) -o $@ -c $<
CXX_CMD = $(QUIET_CXX) $(CXX) $(filter-out -Wdeclaration-after-statement,$(CFLAGS)) -o $@ -c $<
AR_CMD = $(QUIET_AR) $(AR) cr $@ $^
LINK_CMD = $(QUIET_LINK) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
MKDIR_CMD = $(QUIET_MKDIR) mkdir -p $@
......@@ -93,9 +94,12 @@ $(OUT)/%.a :
$(OUT)/%.exe: $(OUT)/%.o | $(ALL_DIR)
$(LINK_CMD)
$(OUT)/source/helpers/%.o : source/helpers/%.c | $(ALL_DIR)
$(OUT)/source/helpers/mu-threads/%.o : source/helpers/mu-threads/%.c | $(ALL_DIR)
$(CC_CMD) $(THREADING_CFLAGS)
$(OUT)/source/helpers/pkcs7/%.o : source/helpers/pkcs7/%.c | $(ALL_DIR)
$(CC_CMD)
$(OUT)/source/tools/%.o : source/tools/%.c | $(ALL_DIR)
$(CC_CMD) $(THREADING_CFLAGS)
......@@ -127,6 +131,7 @@ $(OUT)/%.o : %.cpp | $(ALL_DIR)
FITZ_HDR := include/mupdf/fitz.h $(wildcard include/mupdf/fitz/*.h)
PDF_HDR := include/mupdf/pdf.h $(wildcard include/mupdf/pdf/*.h)
THREAD_HDR := include/mupdf/helpers/mu-threads.h
PKCS7_HDR := $(sort $(wildcard include/mupdf/helpers/pkcs7-*.h))
FITZ_SRC := $(sort $(wildcard source/fitz/*.c))
PDF_SRC := $(sort $(wildcard source/pdf/*.c))
......@@ -136,6 +141,10 @@ CBZ_SRC := $(sort $(wildcard source/cbz/*.c))
HTML_SRC := $(sort $(wildcard source/html/*.c))
GPRF_SRC := $(sort $(wildcard source/gprf/*.c))
THREAD_SRC := $(sort $(wildcard source/helpers/mu-threads/*.c))
PKCS7_SRC := $(wildcard source/helpers/pkcs7/pkcs7-check.c)
ifeq "$(HAVE_LIBCRYPTO)" "yes"
PKCS7_SRC += $(wildcard source/helpers/pkcs7/pkcs7-openssl.c)
endif
FITZ_SRC_HDR := $(wildcard source/fitz/*.h)
PDF_SRC_HDR := $(wildcard source/pdf/*.h) source/pdf/pdf-name-table.h
......@@ -152,6 +161,8 @@ CBZ_OBJ := $(CBZ_SRC:%.c=$(OUT)/%.o)
HTML_OBJ := $(HTML_SRC:%.c=$(OUT)/%.o)
GPRF_OBJ := $(GPRF_SRC:%.c=$(OUT)/%.o)
THREAD_OBJ := $(THREAD_SRC:%.c=$(OUT)/%.o)
PKCS7_OBJ := $(PKCS7_SRC:%.c=$(OUT)/%.o)
SIGNATURE_OBJ := $(OUT)/platform/x11/pdfapp.o $(OUT)/source/tools/pdfsign.o
$(FITZ_OBJ) : $(FITZ_HDR) $(FITZ_SRC_HDR)
$(PDF_OBJ) : $(FITZ_HDR) $(PDF_HDR) $(PDF_SRC_HDR)
......@@ -163,6 +174,8 @@ $(CBZ_OBJ) : $(FITZ_HDR) $(CBZ_HDR) $(CBZ_SRC_HDR)
$(HTML_OBJ) : $(FITZ_HDR) $(HTML_HDR) $(HTML_SRC_HDR)
$(GPRF_OBJ) : $(FITZ_HDR) $(GPRF_HDR) $(GPRF_SRC_HDR)
$(THREAD_OBJ) : $(THREAD_HDR)
$(PKCS7_OBJ) : $(FITZ_HDR) $(PDF_HDR) $(PKCS7_HDR)
$(SIGNATURE_OBJ) : $(PKCS7_HDR)
# --- Generated PDF name tables ---
......@@ -315,6 +328,7 @@ generate: $(JAVASCRIPT_GEN)
MUPDF_LIB = $(OUT)/libmupdf.a
THIRD_LIB = $(OUT)/libmupdfthird.a
THREAD_LIB = $(OUT)/libmuthreads.a
PKCS7_LIB = $(OUT)/libmupkcs7.a
MUPDF_OBJ := \
$(FITZ_OBJ) \
......@@ -341,11 +355,10 @@ THIRD_OBJ := \
$(ZLIB_OBJ) \
$(LCMS2_OBJ)
THREAD_OBJ := $(THREAD_OBJ)
$(MUPDF_LIB) : $(MUPDF_OBJ)
$(THIRD_LIB) : $(THIRD_OBJ)
$(THREAD_LIB) : $(THREAD_OBJ)
$(PKCS7_LIB) : $(PKCS7_OBJ)
INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB)
......@@ -356,7 +369,7 @@ MUTOOL_SRC := source/tools/mutool.c source/tools/muconvert.c source/tools/mudraw
MUTOOL_SRC += $(sort $(wildcard source/tools/pdf*.c))
MUTOOL_OBJ := $(MUTOOL_SRC:%.c=$(OUT)/%.o)
$(MUTOOL_OBJ) : $(FITZ_HDR) $(PDF_HDR)
$(MUTOOL_EXE) : $(MUTOOL_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(THREAD_LIB)
$(MUTOOL_EXE) : $(MUTOOL_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(THREAD_LIB) $(PKCS7_LIB)
$(LINK_CMD) $(THREADING_LIBS)
MURASTER_EXE := $(OUT)/muraster
......@@ -374,21 +387,21 @@ $(MJSGEN_EXE) : $(MJSGEN_OBJ) $(MUPDF_LIB) $(THIRD_LIB)
MUJSTEST_EXE := $(OUT)/mujstest
MUJSTEST_OBJ := $(addprefix $(OUT)/platform/x11/, jstest_main.o pdfapp.o)
$(MUJSTEST_OBJ) : $(FITZ_HDR) $(PDF_HDR)
$(MUJSTEST_EXE) : $(MUJSTEST_OBJ) $(MUPDF_LIB) $(THIRD_LIB)
$(MUJSTEST_EXE) : $(MUJSTEST_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB)
$(LINK_CMD)
ifeq "$(HAVE_X11)" "yes"
MUVIEW_X11_EXE := $(OUT)/mupdf-x11
MUVIEW_X11_OBJ := $(addprefix $(OUT)/platform/x11/, x11_main.o x11_image.o pdfapp.o)
$(MUVIEW_X11_OBJ) : $(FITZ_HDR) $(PDF_HDR)
$(MUVIEW_X11_EXE) : $(MUVIEW_X11_OBJ) $(MUPDF_LIB) $(THIRD_LIB)
$(MUVIEW_X11_EXE) : $(MUVIEW_X11_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB)
$(LINK_CMD) $(X11_LIBS)
ifeq "$(HAVE_CURL)" "yes"
MUVIEW_X11_CURL_EXE := $(OUT)/mupdf-x11-curl
MUVIEW_X11_CURL_OBJ := $(addprefix $(OUT)/platform/x11/curl/, x11_main.o x11_image.o pdfapp.o curl_stream.o)
$(MUVIEW_X11_CURL_OBJ) : $(FITZ_HDR) $(PDF_HDR)
$(MUVIEW_X11_CURL_EXE) : $(MUVIEW_X11_CURL_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(CURL_LIB)
$(MUVIEW_X11_CURL_EXE) : $(MUVIEW_X11_CURL_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(CURL_LIB) $(PKCS7_LIB)
$(LINK_CMD) $(X11_LIBS) $(CURL_LIBS) $(SYS_CURL_DEPS)
endif
endif
......@@ -405,7 +418,7 @@ ifeq "$(HAVE_WIN32)" "yes"
MUVIEW_WIN32_EXE := $(OUT)/mupdf
MUVIEW_WIN32_OBJ := $(addprefix $(OUT)/platform/x11/, win_main.o pdfapp.o win_res.o)
$(MUVIEW_WIN32_OBJ) : $(FITZ_HDR) $(PDF_HDR)
$(MUVIEW_WIN32_EXE) : $(MUVIEW_WIN32_OBJ) $(MUPDF_LIB) $(THIRD_LIB)
$(MUVIEW_WIN32_EXE) : $(MUVIEW_WIN32_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB)
$(LINK_CMD) $(WIN32_LIBS)
endif
......@@ -413,10 +426,10 @@ MUVIEW_EXE := $(MUVIEW_X11_EXE) $(MUVIEW_WIN32_EXE) $(MUVIEW_GLUT_EXE)
MUVIEW_CURL_EXE := $(MUVIEW_X11_CURL_EXE) $(MUVIEW_WIN32_CURL_EXE)
INSTALL_APPS := $(MUTOOL_EXE) $(MUVIEW_EXE)
INSTALL_APPS += $(MURASTER_EXE)
INSTALL_APPS += $(MUVIEW_CURL_EXE)
INSTALL_APPS += $(MUJSTEST_EXE)
INSTALL_APPS += $(MJSGEN_EXE)
EXTRA_APPS += $(MURASTER_EXE)
EXTRA_APPS += $(MUVIEW_CURL_EXE)
EXTRA_APPS += $(MUJSTEST_EXE)
EXTRA_APPS += $(MJSGEN_EXE)
# --- Examples ---
......@@ -454,9 +467,11 @@ mandir ?= $(prefix)/share/man
docdir ?= $(prefix)/share/doc/mupdf
third: $(THIRD_LIB)
extra: $(CURL_LIB) $(GLUT_LIB)
extra-libs: $(CURL_LIB) $(GLUT_LIB)
libs: $(INSTALL_LIBS)
apps: $(INSTALL_APPS)
extra-apps: $(EXTRA_APPS)
extra: extra-libs extra-apps
install: libs apps
install -d $(DESTDIR)$(incdir)/mupdf
......@@ -513,6 +528,12 @@ release:
$(MAKE) build=release
debug:
$(MAKE) build=debug
sanitize:
$(MAKE) build=sanitize
tofu:
$(MAKE) OUT=build/tofu CMAP_GEN= FONT_GEN_DROID= FONT_GEN_NOTO= FONT_GEN_HAN= FONT_GEN_SIL= XCFLAGS="-DNOCJK -DTOFU"
tofumax:
$(MAKE) OUT=build/tofumax CMAP_GEN= FONT_GEN= XCFLAGS="-DNOCJK -DTOFU -DTOFU_BASE14"
android: generate
ndk-build -j8 \
......
......@@ -21,6 +21,9 @@ else
LDREMOVEUNREACH := -Wl,--gc-sections
endif
SANITIZE_FLAGS := -fsanitize=address
SANITIZE_FLAGS += -fsanitize=leak
ifeq "$(build)" "debug"
CFLAGS += -pipe -g
LDFLAGS += -g
......@@ -34,11 +37,11 @@ else ifeq "$(build)" "valgrind"
CFLAGS += -pipe -O2 -DNDEBUG -DPACIFY_VALGRIND -fno-omit-frame-pointer
LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
else ifeq "$(build)" "sanitize"
CFLAGS += -pipe -g -fno-omit-frame-pointer -fsanitize=address
LDFLAGS += -g -fsanitize=address
CFLAGS += -pipe -g -fno-omit-frame-pointer $(SANITIZE_FLAGS)
LDFLAGS += -g $(SANITIZE_FLAGS)
else ifeq "$(build)" "sanitize-release"
CFLAGS += -pipe -O2 -DNDEBUG -fno-omit-frame-pointer -fsanitize=address
LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s -fsanitize=address
CFLAGS += -pipe -O2 -DNDEBUG -fno-omit-frame-pointer $(SANITIZE_FLAGS)
LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s $(SANITIZE_FLAGS)
else ifeq "$(build)" "profile"
CFLAGS += -pipe -O2 -DNDEBUG -pg
LDFLAGS += -pg
......@@ -68,9 +71,6 @@ ifeq "$(OS)" "MINGW"
WINDRES := windres
HAVE_X11 ?= no
HAVE_WIN32 := yes
CC=gcc
# Add flags required for Harfbuzz because of missing strdup
CFLAGS+= -U__STRICT_ANSI__
# Mac OS X doesn't have pkg-config so we hard code paths.
else ifeq "$(OS)" "MACOS"
......@@ -97,7 +97,7 @@ HAVE_GLUT := yes
SYS_GLUT_CFLAGS :=
SYS_GLUT_LIBS := -lglut -lGL
ifeq "$(shell pkg-config --exists 'libcrypto <= 1.0.1t' && echo yes)" "yes"
ifeq "$(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes)" "yes"
HAVE_LIBCRYPTO := yes
SYS_LIBCRYPTO_CFLAGS := -DHAVE_LIBCRYPTO $(shell pkg-config --cflags libcrypto)
SYS_LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto)
......@@ -157,6 +157,7 @@ endif
ifeq "$(OS)" "beagle-cross"
CC = arm-none-linux-gnueabi-gcc
CXX = arm-none-linux-gnueabi-g++
LD = arm-none-linux-gnueabi-gcc
AR = arm-none-linux-gnueabi-ar
CFLAGS += -O3 -mfpu=neon -mcpu=cortex-a8 -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant
......@@ -168,6 +169,7 @@ endif
ifeq "$(OS)" "webos-pre-cross"
CC = arm-none-linux-gnueabi-gcc
CXX = arm-none-linux-gnueabi-g++
LD = arm-none-linux-gnueabi-gcc
AR = arm-none-linux-gnueabi-ar
CFLAGS += -O3 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant
......@@ -176,6 +178,7 @@ endif
ifeq "$(OS)" "webos-pixi-cross"
CC = arm-none-linux-gnueabi-gcc
CXX = arm-none-linux-gnueabi-g++
LD = arm-none-linux-gnueabi-gcc
AR = arm-none-linux-gnueabi-ar
CFLAGS += -O3 -mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -ffast-math -fsingle-precision-constant
......@@ -184,6 +187,7 @@ endif
ifeq "$(OS)" "w64_x86-cross-mingw32"
CC = i686-w64-mingw32-gcc
CXX = i686-w64-mingw32-g++
LD = i686-w64-mingw32-gcc
AR = i686-w64-mingw32-ar
WINDRES = i686-w64-mingw32-windres
......@@ -193,6 +197,7 @@ endif
ifeq "$(OS)" "w64_amd64-cross-mingw32"
CC = x86_64-w64-mingw32-gcc
CXX = x86_64-w64-mingw32-g++
LD = x86_64-w64-mingw32-gcc
AR = x86_64-w64-mingw32-ar
WINDRES = x86-64-mingw32-windres
......@@ -226,6 +231,7 @@ endif
ifeq "$(OS)" "ios"
CC = xcrun cc
CXX = xcrun c++
AR = xcrun ar
LD = xcrun ld
RANLIB_CMD = xcrun ranlib $@
......@@ -236,6 +242,7 @@ ifeq "$(OS)" "tizen-arm"
TIZEN_TOOLS=$(TIZEN_SDK)/tools/arm-linux-gnueabi-gcc-4.6/bin/arm-linux-gnueabi-
TIZEN_FLAGS=--sysroot=$(TIZEN_SDK)/platforms/mobile-2.3/rootstraps/mobile-2.3-device.core
CC = $(TIZEN_TOOLS)gcc $(TIZEN_FLAGS)
CXX = $(TIZEN_TOOLS)g++ $(TIZEN_FLAGS)
AR = $(TIZEN_TOOLS)ar
LD = $(TIZEN_TOOLS)ld $(TIZEN_FLAGS)
CROSSCOMPILE=yes
......@@ -245,6 +252,7 @@ ifeq "$(OS)" "tizen-x86"
TIZEN_TOOLS=$(TIZEN_SDK)/tools/i386-linux-gnueabi-gcc-4.6/bin/i386-linux-gnueabi-
TIZEN_FLAGS=--sysroot=$(TIZEN_SDK)/platforms/mobile-2.3/rootstraps/mobile-2.3-emulator.core
CC = $(TIZEN_TOOLS)gcc $(TIZEN_FLAGS)
CXX = $(TIZEN_TOOLS)g++ $(TIZEN_FLAGS)
AR = $(TIZEN_TOOLS)ar $(TIZEN_FLAGS)
LD = $(TIZEN_TOOLS)ld $(TIZEN_FLAGS)
CROSSCOMPILE=yes
......
......@@ -78,7 +78,8 @@ FREETYPE_OBJ := $(addprefix $(FREETYPE_OUT)/, $(FREETYPE_SRC:%.c=%.o))
$(FREETYPE_OUT):
$(MKDIR_CMD)
FT_CFLAGS := -DFT2_BUILD_LIBRARY -DDARWIN_NO_CARBON \
FT_CFLAGS := -Wno-unused-function \
-DFT2_BUILD_LIBRARY -DDARWIN_NO_CARBON \
'-DFT_CONFIG_MODULES_H="slimftmodules.h"' \
'-DFT_CONFIG_OPTIONS_H="slimftoptions.h"'
......@@ -164,10 +165,10 @@ HARFBUZZ_OBJ := $(addprefix $(HARFBUZZ_OUT)/, $(HARFBUZZ_SRC:%.cc=%.o))
$(HARFBUZZ_OUT):
$(MKDIR_CMD)
$(HARFBUZZ_OUT)/%.o: $(HARFBUZZ_DIR)/src/%.cc | $(HARFBUZZ_OUT)
$(CC_CMD) -DHAVE_OT -DHAVE_UCDN -DHB_NO_MT $(FREETYPE_CFLAGS) \
$(CXX_CMD) -DHAVE_OT -DHAVE_UCDN -DHB_NO_MT $(FREETYPE_CFLAGS) \
-Dhb_malloc_impl=fz_hb_malloc -Dhb_calloc_impl=fz_hb_calloc \
-Dhb_free_impl=fz_hb_free -Dhb_realloc_impl=fz_hb_realloc \
-fno-rtti -fno-exceptions -fvisibility-inlines-hidden --std=c++0x
-fno-rtti -fno-exceptions -fvisibility-inlines-hidden --std=gnu++0x
HARFBUZZ_CFLAGS := -I$(HARFBUZZ_DIR)/src
else
......@@ -376,7 +377,6 @@ ifneq "$(wildcard $(OPENJPEG_DIR)/openjpeg.h)" ""
OPENJPEG_OUT := $(OUT)/thirdparty/openjpeg
OPENJPEG_SRC := \
bio.c \
cidx_manager.c \
cio.c \
dwt.c \
event.c \
......@@ -388,16 +388,12 @@ OPENJPEG_SRC := \
mct.c \
mqc.c \
openjpeg.c \
phix_manager.c \
pi.c \
ppix_manager.c \
raw.c \
t1.c \
t2.c \
tcd.c \
tgt.c \
thix_manager.c \
tpix_manager.c \
thread.c
OPENJPEG_OBJ := $(addprefix $(OPENJPEG_OUT)/, $(OPENJPEG_SRC:%.c=%.o))
......@@ -405,9 +401,9 @@ OPENJPEG_OBJ := $(addprefix $(OPENJPEG_OUT)/, $(OPENJPEG_SRC:%.c=%.o))
$(OPENJPEG_OUT):
$(MKDIR_CMD)
$(OPENJPEG_OUT)/%.o: $(OPENJPEG_DIR)/%.c | $(OPENJPEG_OUT)
$(CC_CMD) -DOPJ_STATIC -DOPJ_HAVE_STDINT_H -DOPJ_HAVE_INTTYPES_H -DUSE_JPIP
$(CC_CMD) $(OPENJPEG_CFLAGS)
OPENJPEG_CFLAGS += -I$(OPENJPEG_DIR)
OPENJPEG_CFLAGS += -I$(OPENJPEG_DIR) -DOPJ_STATIC -DOPJ_HAVE_STDINT_H -DOPJ_HAVE_INTTYPES_H
else
OPENJPEG_CFLAGS := $(SYS_OPENJPEG_CFLAGS)
OPENJPEG_LIBS := $(SYS_OPENJPEG_LIBS)
......
......@@ -18,6 +18,9 @@ gcc -I/usr/local/include -o example \
#include <mupdf/fitz.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
char *input;
......
......@@ -33,6 +33,8 @@ depending on your environment.
//Include the MuPDF header file, and pthread's header file.
#include <mupdf/fitz.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
// A convenience function for dying abruptly on pthread errors.
......@@ -229,7 +231,7 @@ int main(int argc, char **argv)
// Create a white pixmap using the correct dimensions.
pix = fz_new_pixmap_with_bbox(ctx, fz_device_rgb(ctx), fz_round_rect(&rbox, &bbox), 0);
pix = fz_new_pixmap_with_bbox(ctx, fz_device_rgb(ctx), fz_round_rect(&rbox, &bbox), NULL, 0);
fz_clear_pixmap_with_value(ctx, pix, 0xff);
// Populate the data structure to be sent to the
......
......@@ -77,9 +77,32 @@ and image resources:
<pre>
%%MediaBox 0 0 500 800
%%Rotate 90
%%Image Im0 path/to/image.png
</pre>
<p>
Font resources can be created by either giving the name of a standard PDF font, or by giving
the path to a font file. If a third argument is present and either "Greek" or "Cyrillic" the
font will be encoded using ISO 8859-7 or KOI8-U, respectively.
<pre>
%%Font Tm Times-Roman
%%Font TmG Times-Roman Greek
%%Font TmC Times-Roman Cyrillic
%%Font Fn0 path/to/font/file.ttf
%%Image Im0 path/to/image.png
%%Font Fn1 path/to/font/file.ttf Cyrillic
</pre>
<p>
CJK fonts can also be created by passing a code for one of the 4 CID orderings:
CN, TW, JP, or KR (Simplified Chinese, Traditional Chinese, Japanese, and Korean).
A font file will not be embedded, so a PDF viewer will use a substitute font.
<pre>
%%CJKFont Batang KR
%%CJKFont Mincho JP
%%CJKFont Ming TW
%%CJKFont Song CN
</pre>
<p>
......@@ -87,7 +110,12 @@ An example input file:
<pre>
%%MediaBox 0 0 595 842
%%Font F0 Times-Roman
%%Font TmRm Times-Roman
%%Font Helv-C Helvetica Cyrillic
%%Font Helv-G Helvetica Greek
%%CJKFont Song CN
%%CJKFont Mincho JP
%%CJKFont Batang KR
%%Image I0 logo/mupdf-simplified-logo.png
% Draw an image.
......@@ -108,11 +136,12 @@ Q
% Show some text.
q
0 0 1 rg
BT
/F0 24 Tf
50 760 Td
(Hello, world!) Tj
ET
BT /TmRm 24 Tf 50 760 Td (Hello, world!) Tj ET
BT /Helv-C 24 Tf 50 730 Td <fac4d2c1d7d3d4d7d5cad4c521> Tj ET
BT /Helv-G 24 Tf 50 700 Td <eae1ebe7ecddf1e1> Tj ET
BT /Song 24 Tf 50 670 Td <4F60 597D> Tj ET
BT /Mincho 24 Tf 50 640 Td <3053 3093 306b 3061 306f> Tj ET
BT /Batang 24 Tf 50 610 Td <c548 b155 d558 c138 c694> Tj ET
Q
</pre>
......
......@@ -35,8 +35,6 @@ mutool run script.js [ arguments ... ]
<p>
If invoked without any arguments, it will drop you into an interactive REPL (read-eval-print-loop).
On the interactive prompt, if you prefix a line with an equal ('=') character it will automatically print the result
of the line.
<h2>
Example scripts
......@@ -212,8 +210,9 @@ If skipAnnotations is true, ignore annotations.
If alpha is true, the page will be drawn on a transparent background, otherwise white.
<dt>Page#toDisplayList(skipAnnotations)
<dd>Record the contents on the page into a DisplayList.
<dt>Page#toStructuredText()
<dt>Page#toStructuredText(options)
<dd>Extract the text on the page into a StructuredText object.
The options argument is a comma separated list of flags: preserve-ligatures, preserve-whitespace, and preserve-images.
<dt>Page#search(needle)
<dd>Search for 'needle' text on the page, and return an array with rectangles of all matches found.
<dt>Page#getAnnotations()
......@@ -235,8 +234,8 @@ depending on whether it's an internal or external link.
<dd>Render the annotation into a Pixmap, using the transform and colorspace.
<dt>Annotation#toDisplayList()
<dd>Record the contents of the annotation into a DisplayList.
<dt>Annotation#toPDF()
<dd>Returns the PDFObject/PDFAnnotation for the annotation, if the document is a PDF file.
<dt>Annotation#isPDF()
<dd>Returns true if the annotation is from a PDF document.
</dl>
<h2>
......@@ -250,10 +249,10 @@ StructuredText objects hold text from a page that has been analyzed and grouped
<dl>
<dt>StructuredText#search(needle)
<dd>Search the text for all instances of 'needle', and return an array with rectangles of all matches found.
<dt>StructuredText#highlight(rect)
<dd>Return an array with rectangles needed to highlight a selection defined by the two corners of the rectangle.
<dt>StructuredText#copy(rect)
<dd>Return the text from the selection defined by the two corners of the rectangle.
<dt>StructuredText#highlight(p, q)
<dd>Return an array with rectangles needed to highlight a selection defined by the start and end points.
<dt>StructuredText#copy(p, q)
<dd>Return the text from the selection defined by the start and end points.
</dl>
<h2>
......@@ -339,8 +338,9 @@ will keep all the graphics required in memory, so will increase the amount of me
<dd>Play back the recorded device calls onto the device.
<dt>DisplayList#toPixmap(transform, colorspace, alpha)
<dd>Render display list to a pixmap. If alpha is true, it will render to a transparent background, otherwise white.
<dt>DisplayList#toStructuredText(skipAnnotations)
<dt>DisplayList#toStructuredText(options)
<dd>Extract the text in the display list into a StructuredText object.
The options argument is a comma separated list of flags: preserve-ligatures, preserve-whitespace, and preserve-images.
<dt>DisplayList#search(needle)
<dd>Search the display list text for all instances of 'needle', and return an array with rectangles of all matches found.
<dd>
......@@ -469,7 +469,7 @@ A Path object represents vector graphics as drawn by a pen. A path can be either
<dt>Path#rect(x1, y1, x2, y2)
<dd>Shorthand for moveTo, lineTo, lineTo, lineTo, closePath to draw a rectangle.
<dt>Path#walk(pathWalker)
<dd>Call moveTo, lineTo, curveTo and closePath methods on the pathWalker to replay the path.
<dd>Call moveTo, lineTo, curveTo and closePath methods on the pathWalker object to replay the path.
</dl>
<h2>
......@@ -491,7 +491,7 @@ WMode is 0 for horizontal writing, and 1 for vertical writing.
<dt>Text#showString(font, transform, string)
<dd>Add a simple string to the text object. Will do font substitution if the font does not have all the unicode characters required.
<dt>Text#walk(textWalker)
<dd>Call showGlyph on textWalker for each glyph in the text object.
<dd>Call the showGlyph method on the textWalker object for each glyph in the text object.
</dl>
<h2>
......@@ -561,42 +561,8 @@ The argument must be the same device object that was returned by the beginPage m
</dl>
<p>
The current output formats supported are CBZ, PNG and PDF.
<p>
The image format (CBZ, PNG, etc) output options are:
<dl>
<dt>rotate=N
<dd>Rotate rendered pages N degrees counterclockwise.
<dt>resolution=N, x-resolution=N, y-resolution=N
<dd>Render each page to an image at N pixels per inch.
<dt>width=N
<dd>Render pages to fit N pixels wide (ignore resolution option).
<dt>height=N
<dd>Render pages to fit N pixels tall (ignore resolution option).
<dt>colorspace=(gray|rgb|cmyk)
<dd>Render using specified colorspace.
<dt>alpha
<dd>Render pages with alpha channel and transparent background.
</dl>
<p id="pdf-write-options">
The PDF output options are:
<dl>
<dt>linearize<dd>optimize for web browsers.
<dt>garbage
<dd>remove unused objects.
<dt>garbage=compact<dd>Remove unused objects, and compact cross reference table.
<dt>garbage=deduplicate<dd>Remove unused objects, compact cross reference table, and remove duplicate objects.
<dt>pretty<dd>Pretty-print objects with indentation.
<dt>ascii<dd>ASCII hex encode binary streams.
<dt>compress-fonts<dd>Compress embedded fonts.
<dt>compress-images<dd>Compress images.
<dt>compress<dd>Compress all streams.
<dt>decompress<dd>Decompress all streams (except when compress-fonts or compress-images).
<dt>sanitize<dd>Clean up graphics commands in content streams.
</dl>
The output formats and options supported are the same as in the
<a href="manual-mutool-convert.html">mutool convert</a> command.
<h2>
PDFDocument and PDFObject
......
......@@ -33,6 +33,7 @@ These are the third party libraries used by MuPDF.
<tr><td><a href="http://www.freetype.org/">freetype</a><td>2.6.3<td>Font scaling and rendering <td>BSD-style
<tr><td><a href="http://www.harfbuzz.org/">harfbuzz</a><td>1.3.2 with patches <td>Text shaping <td>MIT-style
<tr><td><a href="http://www.ijg.org/">libjpeg</a><td>9.0 with patches <td>JPEG decoding <td>BSD-style
<tr><td><a href="http://git.ghostscript.com/?p=thirdparty-lcms2.git;a=summary">Incompatible fork of lcms2</a><td>2.9rc1 with patches<td>Color management <td>MIT-style
<tr><td><a href="http://www.openjpeg.org/">openjpeg</a><td>2.1.0 with patches <td>JPEG 2000 decoding <td>BSD-style
<tr><td><a href="http://www.zlib.net/">zlib</a><td>1.2.7<td>Deflate compression <td>zlib License
......
......@@ -61,6 +61,8 @@ fz_archive *fz_open_archive_with_stream(fz_context *ctx, fz_stream *file);
*/
fz_archive *fz_open_directory(fz_context *ctx, const char *path);
int fz_is_directory(fz_context *ctx, const char *path);
/*
fz_drop_archive: Release an open archive.
......
......@@ -16,6 +16,14 @@ enum
FZ_RI_ABSOLUTE_COLORIMETRIC,
};
enum
{
FZ_COLORSPACE_IS_DEVICE = 1,
FZ_COLORSPACE_IS_ICC = 2,
FZ_COLORSPACE_IS_CAL = 4,
FZ_COLORSPACE_LAST_PUBLIC_FLAG = 8,
};
typedef struct fz_color_params_s fz_color_params;
struct fz_color_params_s
......@@ -26,7 +34,6 @@ struct fz_color_params_s
uint8_t opm;
};
int fz_lookup_rendering_intent(const char *name);
char *fz_rendering_intent_name(int ri);
......@@ -39,6 +46,20 @@ char *fz_rendering_intent_name(int ri);
*/
typedef struct fz_colorspace_s fz_colorspace;
enum fz_colorspace_type
{
FZ_COLORSPACE_NONE,
FZ_COLORSPACE_GRAY,
FZ_COLORSPACE_RGB,
FZ_COLORSPACE_BGR,
FZ_COLORSPACE_CMYK,
FZ_COLORSPACE_LAB,
FZ_COLORSPACE_INDEXED,
FZ_COLORSPACE_SEPARATION,
};
enum fz_colorspace_type fz_colorspace_type(fz_context *ctx, fz_colorspace *cs);
/*
A fz_iccprofile object encapsulates details about the icc profile. It
also includes the profile handle provided by the cmm and as such is used
......@@ -63,13 +84,6 @@ typedef struct fz_default_colorspaces_s fz_default_colorspaces;
*/
int fz_colorspace_is_subtractive(fz_context *ctx, const fz_colorspace *cs);
/*
fz_colorspace_is_device_n: Return true if a colorspace is separation or devicen.
True for Separation and DeviceN colorspaces.
*/
int fz_colorspace_is_device_n(fz_context *ctx, const fz_colorspace *cs);
/*
fz_colorspace_device_n_has_only_cmyk: Return true if devicen color space
has only colorants from the cmyk set.
......@@ -83,10 +97,24 @@ int fz_colorspace_device_n_has_only_cmyk(fz_context *ctx, const fz_colorspace *c
int fz_colorspace_device_n_has_cmyk(fz_context *ctx, const fz_colorspace *cs);
/*
fz_colorspace_is_device_gray: Return true if the color space is
device gray.
Colorspace feature test functions.
*/
int fz_colorspace_is_gray(fz_context *ctx, const fz_colorspace *cs);
int fz_colorspace_is_rgb(fz_context *ctx, const fz_colorspace *cs);
int fz_colorspace_is_bgr(fz_context *ctx, const fz_colorspace *cs);
int fz_colorspace_is_cmyk(fz_context *ctx, const fz_colorspace *cs);
int fz_colorspace_is_lab(fz_context *ctx, const fz_colorspace *cs);
int fz_colorspace_is_indexed(fz_context *ctx, const fz_colorspace *cs);
int fz_colorspace_is_device_n(fz_context *ctx, const fz_colorspace *cs);
int fz_colorspace_is_device(fz_context *ctx, const fz_colorspace *cs);
int fz_colorspace_is_icc(fz_context *ctx, const fz_colorspace *cs);
int fz_colorspace_is_cal(fz_context *ctx, const fz_colorspace *cs);
int fz_colorspace_is_device_gray(fz_context *ctx, const fz_colorspace *cs);
int fz_colorspace_is_device_cmyk(fz_context *ctx, const fz_colorspace *cs);
int fz_colorspace_is_lab_icc(fz_context *ctx, const fz_colorspace *cs);
/*
fz_device_gray: Get colorspace representing device specific gray.
......@@ -126,16 +154,7 @@ typedef fz_colorspace *(fz_colorspace_base_fn)(const fz_colorspace *cs);
typedef void (fz_colorspace_clamp_fn)(const fz_colorspace *cs, const float *src, float *dst);
enum
{
FZ_CS_DEVICE_GRAY = 1,
FZ_CS_DEVICE_N = 2,
FZ_CS_SUBTRACTIVE = 4,
FZ_CS_LAST_PUBLIC_FLAG = 4
};
fz_colorspace *fz_new_colorspace(fz_context *ctx, const char *name, int n, int flags, fz_colorspace_convert_fn *to_ccs, fz_colorspace_convert_fn *from_ccs, fz_colorspace_base_fn *base, fz_colorspace_clamp_fn *clamp, fz_colorspace_destruct_fn *destruct, void *data, size_t size);
fz_colorspace *fz_new_colorspace(fz_context *ctx, const char *name, enum fz_colorspace_type type, int flags, int n, fz_colorspace_convert_fn *to_ccs, fz_colorspace_convert_fn *from_ccs, fz_colorspace_base_fn *base, fz_colorspace_clamp_fn *clamp, fz_colorspace_destruct_fn *destruct, void *data, size_t size);
void fz_colorspace_name_colorant(fz_context *ctx, fz_colorspace *cs, int n, const char *name);
const char *fz_colorspace_colorant(fz_context *ctx, const fz_colorspace *cs, int n);
fz_colorspace *fz_new_indexed_colorspace(fz_context *ctx, fz_colorspace *base, int high, unsigned char *lookup);
......@@ -147,11 +166,6 @@ void fz_drop_colorspace(fz_context *ctx, fz_colorspace *colorspace);
void fz_drop_colorspace_imp(fz_context *ctx, fz_storable *colorspace);