Age | Commit message (Collapse) | Author |
|
Rename fz_write to fz_write_data.
Rename fz_write_buffer_* and fz_buffer_printf to fz_append_*.
Be consistent in naming:
fz_write_* calls write to fz_output.
fz_append_* calls append to fz_buffer.
Update documentation.
|
|
|
|
|
|
This drastically reduces the size of the android library.
Unfortunately it means font support is limited to what is available
on the device. We look for both the old DroidSans fonts and the more
recent Noto fonts.
|
|
It can be simplified now that we support custom strides in pixmaps.
|
|
Requires use of Document.openDocument(path) to open a document. No more
new Document(path) since we may need to return a PDFDocument.
Create a new blank PDF with new PDFDocument() constructor.
|
|
|
|
Run 'make android' to invoke ndk-build with the proper arguments.
The results are placed in build/android.
|
|
|
|
|
|
Most strings coming out of various MuPDF functions are already decoded
to utf-8; so manually decoding from PDFDocEncoding or UCS-2 is actually
harmful rather than helpful.
|
|
|
|
Also expose the argument to JS and JNI.
|
|
Move the definition of the structure contents into new fitz-imp.h
file. Make all code outside of fitz access the buffer through the
defined API.
Add a convenience API for people that want to get buffers as
null terminated C strings.
|
|
Correctly transformed target coordinates for PDF.
Target coordinates for EPUB and HTML.
|
|
|
|
Just some typecasting required.
|
|
|
|
|
|
|
|
All link destinations should be URIs, and a document specific function
can be called to resolve them to actual page numbers.
Outlines have cached page numbers as well as string URIs.
|
|
In addition, make all callers passing 0 as a point pass NULL
instead.
|
|
|
|
|
|
At the moment, when we create java Strings from string or name
PDFObjects, we assume they are all in javas not-quite-UTF-but-almost
encoding.
Here we assume they are in standard PDF format (namely that if
they do not start with one of 2 specific BOMs, that they are in
PDFDocEncoding). We update the code to convert to unicode, and
create strings from that.
This has the added side effect of correctly coping with 0 bytes
in the middle of string buffers.
|
|
|
|
Java has a convention that 'toString' should return a printable
version of an object. We cannot both support this, and support
a sane naming of functions to interpret pdf objects that begins
with 'to'. Instead use 'as'.
This means we have 'asBoolean', 'asInteger', 'asString' which
expect to work just on pdf objects of the required type. 'toString'
continues to work on all types and gives a printable version.
We split 'toByteString' into 2 separate functions, one for acting
on strings (asByteString) and one for acting on names (asByteName)
more nicely mirroring the C level functions (pdf_to_string and
pdf_to_name).
For simplicity of use, we add asString and asName functions that
return using java Strings rather than byte arrays. There are
potential encoding issues with these, but then there are throughout
our string handling at the moment, so we will deal with those in a
followup commit.
We also update the internal workings of several functions so
that they never return NULL pointers, but rather return the null
object. To avoid repeatedly creating new null objects we introduce
a global static PDFObject.Null object.
This is important as we want get("SomethingNonexistent") to return a
valid java object, so we can safely do things like:
get("Foo").get("Bar").get("Baz").asInteger()
without having to error check at every stage.
Update DocViewActivity to call the new versions.
|
|
Applications must be able to run e.g. Document.destroy() and later
set that reference to null and have the JVM successfully run the
finalizer an arbitrary time later. Previously the JVM would fail
to do so because the finalizer would throw an exception since the
native pointer was null.
|
|
|
|
As reasonable a place to call it as we can hope for. If we
ever have 2 documents open and we close 1 then it will dump
more blocks than we like, but when we get to that stage we
can worry about it then.
|
|
In the JNI code, we attach a cloned context onto each thread
we encounter in thread local storage. When the thread shuts
down, we should destroy that context.
This can theoretically be achieved on pthreads by using the
destructor registered to the tls slot. I have yet to see
Android ever actually call this destructor yet though.
No such mechanism exists for windows thread, so we'll just leak
here for now. There is a potential fix for this, but it's
hairy, so details are left in a comment in the code.
|
|
If Java code creates e.g. a Document object and later calls
Document.destroy() and then keeps using the Document object
the library would end up crashing because the native pointer
was null. This case rather special case is now handled.
|
|
The underlying pdf_dict_put() converts into a null object.
|
|
But do not check it twice.
|
|
|
|
|
|
This case can be handled gracefully since commit
2d3eca6dec6b8fc7a169b3fc357904069df6b6c4.
|
|
|
|
The JNI interface throws exceptions of its own,
keep those instead of replacing them.
|
|
|
|
|
|
Also there is no need to check self pointer since JVM does not
even call the JNI binding for null pointers.
|
|
|
|
This avoids a symbol clash when using scripts/destatic.sh
|
|
|
|
|
|
|
|
By making the scope smaller fitz exceptions and Java exceptions
can be disentangled. This makes it clearer what happens in failure
cases.
|
|
|
|
If a large number of text spans uses a huge number of fonts
the JMV may run out of local references since we never cleaned
up the local reference to the font objects.
|