summaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)Author
2016-09-14Add scripts to remove/replace 'static' from functions.Robin Watts
Getting a backtrace out with missing functions makes the backtrace much less useful. Some backtrace routines (such as that used by Memento on Android) are incapable of resolving static functions. We therefore provide 2 scripts (scripts/destatic.sh and scripts/restatic.sh) that respectively remove and replace the 'static' from function definitions. The scripts do not affect "static inline" or "static const" definitions, and they are are restricted to working in the source directory (excluding source/tools), thirdparty/mujs and the platform/{java,android} directories. The transformed source should NOT be checked in. To avoid problems with clashing symbols, some functions are renamed or tweaked slightly in this patch.
2016-09-08Limit length of fontfile name in fontdump.Sebastian Rasmussen
2016-09-01Simplify PDF resource caching table handling.Tor Andersson
2016-07-14Fix whitespace and indentation.Tor Andersson
2016-06-22Update cmap cleaning scripts.Tor Andersson
2016-06-08Move to using size_t for all mallocs.Robin Watts
This has knock on effects in the store. fix
2016-05-13Update script that generates browsable hyperlinked html source.Tor Andersson
2016-05-13Introduce a general output context.Sebastian Rasmussen
This makes it possible to redirect standard out and standard error output streams to output streams of your liking. This means that now you can, in gdb, type: (gdb) call pdf_print_obj(ctx, fz_stdout(ctx), obj, 0) (gdb) call fflush(0) or when dealing with an unresolved indirect reference: (gdb) call pdf_print_obj(ctx, fz_stdout(ctx), pdf_resolve_indirect(ctx, ref), 0) (gdb) call fflush(0)
2016-04-28Introduce tuning context.Robin Watts
For now, just use it for controlling image decoding and image scaling.
2016-04-22thirdparty: Update to openjpeg 2.1.0.Sebastian Rasmussen
2016-03-23Fix font builds on raspberry piRobin Watts
(And presumably other platforms). .align is broken - on some archs it wants the padding size, on others (like ARM) it wants log2(padding size). Use .balign which is consistent. Avoid using @ or # as these are comment chars on some archs. Use the STT_OBJECT form instead.
2016-03-23Compile embedded fonts in separate C files.Tor Andersson
Also change unsigned char into const char for embedded data.
2016-03-21Update freetype to version 2.6.3.Tor Andersson
2016-02-10Add build=sanitize option to makefile.Tor Andersson
2016-02-03Bug 696546: Add fast strtofRobin Watts
Take on a (slightly tweaked) version of Simon Reinhardt's patch. The actual logic is left entirely unchanged; minor changes have been made to the names of functions/types to avoid clashing in the cmapdump.c repeated inclusion. Currently this should really only affect xps files, as strtof is only used as fz_atof, and that's (effectively) all xps for now. I will look at updating lex_number to call this in future.
2016-01-28Add Noto fallback fonts.Tor Andersson
Look up fallback fonts by unicode script, with a flag to select the serif or sans-serif font style where such variants exist. Move all builtin fonts into fitz namespace.
2016-01-28Tweak fontdump .incbin directive.Tor Andersson
Newer versions of clang supports .incbin, so enable it for clang. Disable .incbin for release builds, since then the compiler can strip out unused font data.
2016-01-13Add lots of consts.Robin Watts
In general, we should use 'const fz_blah' in device calls whenever the callee should not alter the fz_blah. Push this through. This shows up various places where we fz_keep and fz_drop these const things. I've updated the fz_keep and fz_drops with appropriate casts to remove the consts. We may need to do the union dance to avoid the consts for some compilers, but will only do that if required. I think this is nicer overall, even allowing for the const<->no const problems.
2015-12-14Fix Windows build; cmapdump.c requires fz_fopen_utf8Robin Watts
2015-10-06Update freetype submodule to version 2.6.1.Tor Andersson
2015-05-15Support pdf files larger than 2Gig.Robin Watts
If FZ_LARGEFILE is defined when building, MuPDF uses 64bit offsets for files; this allows us to open streams larger than 2Gig. The downsides to this are that: * The xref entries are larger. * All PDF ints are held as 64bit things rather than 32bit things (to cope with /Prev entries, hint stream offsets etc). * All file positions are stored as 64bits rather than 32. The implementation works by detecting FZ_LARGEFILE. Some #ifdeffery in fitz/system.h sets fz_off_t to either int or int64_t as appropriate, and sets defines for fz_fopen, fz_fseek, fz_ftell etc as required. These call the fseeko64 etc functions on linux (and so define _LARGEFILE64_SOURCE) and the explicit 64bit functions on windows.
2015-03-24Rework handling of PDF names for speed and memory.Robin Watts
Currently, every PDF name is allocated in a pdf_obj structure, and comparisons are done using strcmp. Given that we can predict most of the PDF names we'll use in a given file, this seems wasteful. The pdf_obj type is opaque outside the pdf-object.c file, so we can abuse it slightly without anyone outside knowing. We collect a sorted list of names used in PDF (resources/pdf/names.txt), and we add a utility (namedump) that preprocesses this into 2 header files. The first (include/mupdf/pdf/pdf-names-table.h, included as part of include/mupdf/pdf/object.h), defines a set of "PDF_NAME_xxxx" entries. These are pdf_obj *'s that callers can use to mean "A PDF object that means literal name 'xxxx'" The second (source/pdf/pdf-name-impl.h) is a C array of names. We therefore update the code so that rather than passing "xxxx" to functions (such as pdf_dict_gets(...)) we now pass PDF_NAME_xxxx (to pdf_dict_get(...)). This is a fairly natural (if widespread) change. The pdf_dict_getp (and sibling) functions that take a path (e.g. "foo/bar/baz") are therefore supplemented with equivalents that take a list (pdf_dict_getl(... , PDF_NAME_foo, PDF_NAME_bar, PDF_NAME_baz, NULL)). The actual implementation of this relies on the fact that small pointer values are never valid values. For a given pdf_obj *p, if NULL < (intptr_t)p < PDF_NAME__LIMIT then p is a literal entry in the name table. This enables us to do fast pointer compares and to skip expensive strcmps. Also, bring "null", "true" and "false" into the same style as PDF names. Rather than using full pdf_obj structures for null/true/false, use special pointer values just above the PDF_NAME_ table. This saves memory and makes comparisons easier.
2015-03-16switch to VER-2-5-5 of freetype.fredrossperry
2015-02-17Add ctx parameter and remove embedded contexts for API regularity.Tor Andersson
Purge several embedded contexts: Remove embedded context in fz_output. Remove embedded context in fz_stream. Remove embedded context in fz_device. Remove fz_rebind_stream (since it is no longer necessary). Remove embedded context in svg_device. Remove embedded context in XML parser. Add ctx argument to fz_document functions. Remove embedded context in fz_document. Remove embedded context in pdf_document. Remove embedded context in pdf_obj. Make fz_page independent of fz_document in the interface. We shouldn't need to pass the document to all functions handling a page. If a page is tied to the source document, it's redundant; otherwise it's just pointless. Fix reference counting oddity in fz_new_image_from_pixmap.
2015-02-17Rename fz_close_* and fz_free_* to fz_drop_*.Tor Andersson
Rename fz_close to fz_drop_stream. Rename fz_close_archive to fz_drop_archive. Rename fz_close_output to fz_drop_output. Rename fz_free_* to fz_drop_*. Rename pdf_free_* to pdf_drop_*. Rename xps_free_* to xps_drop_*.
2014-09-22Fix 695467: Add and use fz_ftoa function (like dtoa but with floats).Tor Andersson
The dtoa function is for doubles (which is what MuJS uses) but for MuPDF we only need and want float precision in our output formatting.
2014-09-02Add locale-independent number formatting and parsing functions.Tor Andersson
2014-06-26Fix some compiler warnings on Android.Matt Holgate
Use intptr_t when casting between a jlong and a pointer to suppress errors about different size words. Add a 'u' suffix to unsigned values output by the cmap dump utility.
2014-05-11Add cmap cleaning scripts.Tor Andersson
One to write a CMap out in expanded form ready for text processing tools. Another to write a CMap out as compactly as possible. The output is not in proper CMap format and can only be parsed by MuPDF.
2014-05-10Fix 694698: Support 32-bit values in CMaps.Tor Andersson
Increasing the existing data structure to 32-bit values would bloat the data tables too much. Simplify the data structure and use three separate range tables for lookups -- one with small 16-bit to 16-bit range lookups, one with 32-bit range lookups, and a final one for one-to-many lookups. This loses the range-to-table optimization we had before, but even with the extra ranges this necessitates, the total size of the compiled binary CMap data is smaller than if we were to extend the previous scheme to 32 bits.
2014-05-05Fix 695105: openjpeg configuration for big-endian.Tor Andersson
Stupid unportable code needs stupid unportable preprocessor macros. This only works with GCC, but should be good enough since I expect anyone using a big-endian machine to also use a GCC compatible compiler.
2014-05-02Fix 692171: Guard against .incbin on Intel's C compiler.Tor Andersson
2014-04-23Fix 692986: add OpenBSD to list of systems that may have .incbinTor Andersson
2014-03-19Implement our own vsnprintf variant.Tor Andersson
The primary motivator for this is so that we can print floating point values and get the full accuracy out, without having to print 1.5 as 1.5000000, and without getting 23e24 etc. We only support %c, %f, %d, %o, %x and %s currently. We only support the zero padding qualifier, for integers. We do support some extensions: %C turns values >=128 into UTF-8. %M prints a fz_matrix. %R prints a fz_rect. %P prints a fz_point. We also implement a fprintf variant on top of this to allow for consistent results when using fz_output. a
2014-01-07Introduce 'document handlers'.Robin Watts
We define a document handler for each file type (2 in the case of PDF, one to handle files with the ability to 'run' them, and one without). We then register these handlers with the context at startup, and then call fz_open_document... as usual. This enables people to select the document types they want at will (and even to extend the library with more document types should they wish).
2013-11-28Put thirdparty config headers in separate directories.Tor Andersson
Only -I the config header directory if building the thirdparty library, not if using the system library. Fix bug 694808.
2013-11-26Add Objective-C files to git's list of files to use tab indents.Tor Andersson
2013-08-28make cmapdump ignore VCS foldersSimon Bünzli
If MuPDF is used in a project using Subversion or another VCS adding hidden subfolders to each folder, cmapdump breaks when trying to load the subfolder as cmap file. This fix is required starting with 643370f04348569b5e5e577660031d638537671c
2013-08-21Update source code browser html generation scripts for new layout.Tor Andersson
2013-07-26Add script to create source tarballs using git-archive.Tor Andersson
2013-06-20Update source, makefiles and win32 projects.Tor Andersson
2013-06-18Merge common and internal headers into one.Tor Andersson
2013-06-18Move header files into separate include directory.Tor Andersson
2013-06-08Silence warning.Tor Andersson
2013-06-03Assume non-clang compilers support incbinSebastian Rasmussen
2013-06-03Clean out some old renaming scripts.Tor Andersson
2013-05-30Generate C-includable version of Adobe CA certificatePaul Gardiner
2013-05-29Fix fontdump .incbin ifdef for clang.Tor Andersson
2013-05-29Trivial (and probably needless) simplification of git hook.Tor Andersson
2013-05-27Strip trailing whitespace.Tor Andersson