summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2016-10-28epub: Add links to XHTML and FB2 formats.Tor Andersson
2016-10-28epub: Add 'id' attribute to all HTML elements, not just <a> tags.Tor Andersson
Allows id anchoring to block elements as well as inline elements. Fix for bug 697123.
2016-10-28Clean up link destination handling.Tor Andersson
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.
2016-10-26Bump version number to 1.10.Tor Andersson
2016-10-26Introduce options for structured text.Sebastian Rasmussen
2016-10-24Fix cluster timeouts with test file.Robin Watts
tests_private/pdf/sumatra/1297_-_interpolate_at_lower_resolutions.pdf times out in the cluster. This is due to us having empty t3 glyphs defined that define d1 rectangles that are wildly different to the default font bbox. Add code to spot that t3 glyphs are empty, and to use a tiny font bbox for them. (It might be nicer to drop the empty display lists, but then this produces knock on problems further on, where non-existent display lists lead to NULL pixmaps, which lead to us think that renders failed etc).
2016-10-21Clean up FZ_IMAGE_XXX enums and purge unused FZ_IMAGE_JBIG2.Tor Andersson
2016-10-19Move headers to make svg_document an internal type.Sebastian Rasmussen
2016-10-19Move headers to make xps_document an internal type.Sebastian Rasmussen
2016-10-19Make document handler declarations internal.Sebastian Rasmussen
2016-10-18Remove unused luminosity.Sebastian Rasmussen
2016-10-14epub: Add hyperlinks.Tor Andersson
2016-10-12Use pool allocator when parsing CSS.Tor Andersson
Fixes memory leaks when parsing throws exceptions and saves a lot of tiny mallocs for objects that have common life times.
2016-10-12Split fz_html into fz_html and fz_html_box for nodes.Tor Andersson
Removes the need to carry fz_pool along in all boxes.
2016-10-12Change code from using bandheight to using band_height.Robin Watts
Keep to our naming conventions.
2016-10-12Regularize band writer interface.Robin Watts
We have various functions that, for different image formats, write a header, then a band, then (sometimes) a trailer. Push them all through a single interface. This change also fixes potential problems caused by the trailer writing being an implicit destructor, which can cause problems in cleanup code if the trailer writing throws an error.
2016-10-10PDF Images: Add a flag for if we need to apply the decode arrayRobin Watts
This avoids us having to check the entire array each time, and makes the next commit simpler.
2016-10-10HTML: Keep 'Anchors' in the html box list.Robin Watts
Keep them as 'FLOW' entries rather than box entries. Although they technically enclose areas of text, we only ever use them as points. Thanks to Tor for fixing this code.
2016-10-10Use more bitfields in HTML.Robin Watts
Saves 12 bytes per fz_html, and we have a lot.
2016-10-10Change HTML agent to use bitfields rather than chars.Robin Watts
Saves 8 bytes on every css_style (and we have a lot of those).
2016-10-07More SWAR optimisation in plotters.Robin Watts
Slightly revised blending, making use of the fact that we can no longer overflow due to ma + masa <= 0x100.
2016-10-07Correct maths error in painters.Robin Watts
As part of the blending calculations, we do: dst = src * mask_alpha + dst * (1-mask_alpha.src_alpha) We calculate mask_alpha as ma, and 1-mask_alpha.src_alpha as masa. In full accuracy, we should never have ma + masa >= 1. Unfortunately, with the formulation used in the painters at the moment, we can. We therefore rejig the calculations slightly.
2016-10-07Rename fz_process_mesh to fz_process_shade.Robin Watts
Better name as not all shadings are meshes.
2016-10-07Add API comments for fz_shade.Robin Watts
2016-10-07Add ctx to fz_font functions.Robin Watts
2016-10-07Add comments to API declarations.Robin Watts
2016-10-07pdf: Separate functions to read text strings and text streams as UTF-8.Tor Andersson
The stream loading is used only by the JS code loading.
2016-10-07pdf: Remove unneccessary document argument to pdf_to_utf8 etc.Tor Andersson
2016-10-07Add annotation editing functions and clean interface of existing ones.Tor Andersson
2016-10-07Remove separate tmp/deleted/changed annotation lists.Tor Andersson
Use a flag in the pdf_annot struct instead. Don't pass pdf_document to annotation edit functions.
2016-10-06Hide internals of fz_colorspaceRobin Watts
The implementation does not need to be in the public API.
2016-10-05Add a const to a lookup function.Robin Watts
2016-10-05Uncouple font shaper data from harfbuzz.Robin Watts
The fz_font structure now doesn't know anything about harfbuzz at all, it merely offers an abstract 'fz_shaper_data_t' entry.
2016-10-05Move fz_font definition to be private.Robin Watts
Move the definition of fz_font to be in a private header file rather than in the public API. Add accessors for specific parts of the structure and use them as appropriate. The font flags, and the harfbuzz records remain public. This means that only 3 files now need access to the font implementation (font.c, pdf-font.c and pdf-type3.c). This may be able to be improved further in future.
2016-10-05Add some more comments to API headersRobin Watts
2016-09-26tiff: Add support for thunder decoding.Sebastian Rasmussen
2016-09-23Clean up annotation enum names.Tor Andersson
Put them in the PDF name space and separate words with underscores. Remove redundant namespace prefixes in java constants. Device.FLAG_MASK rather than Device.FZ_DEVFLAG_MASK. Use namespace for PDF annotation flag enum.
2016-09-22Bug 697015: Avoid object references vanishing during repair.Robin Watts
A PDF repair can be triggered 'just in time', when we encounter a problem in the file. The idea is that this can happen without the enclosing code being aware of it. Thus the enclosing code may be holding 'borrowed' references (such as those returned by pdf_dict_get()) at the time when the repair is triggered. We are therefore at pains to ensure that the repair does not replace any objects that exist already, so that the calling code will not have these references unexpectedly invalidated. The sole exception to this is when we replace the 'Length' fields in stream dictionaries with the actual lengths. Bug 697015 shows exactly this situation causing a reference to become invalid. The solution implemented here is to add an 'orphan list' to the document, where we put these (hopefully few, small) objects. These orphans are kept around until the document is closed.
2016-09-20Sync Memento with gs.Robin Watts
Including: Bug 697134: Tweak MEMENTO_GS_HACKS inclusion. Rather than rolling our own memset prototype in this case, use the one that gs provides. And, bug 697133: Fix typo in Memento. Causing a significant slowdown. Thanks to George Burgess IV for spotting this.
2016-09-19fz_store: Reap passes.Robin Watts
A few commits back, we introduced the fz_key_storable concept to allow us to cope with objects that were used both as values within the store and as parts of keys within the store. This commit worked, but showed up performance problems; when the store has several million PDF objects in it, bulk changes (such as dropping a display list or document) could trigger many passes across the store. We therefore introduce a mechanism to ameliorate this. These passes, now known as "reap passes", can be batched together using fz_defer_reap_start and fz_defer_reap_end. We trigger this start/end around display list dropping, and around PDF content stream processing. This should be fine, as deferral will be interrupted if we ever run our of memory during mallocing.
2016-09-18Make printing empty hash table entries optional.Sebastian Rasmussen
2016-09-16Add some missing #ifdeffery for Memento.Robin Watts
2016-09-16Tweak store handling of PDF document destroy.Robin Watts
When we destroy a PDF document, currently we bin everything from the store. Instead, drop just the objects that are specifically tied to that document. Any object tied to the document has a pdf_obj with the required document pointer in it as the key.
2016-09-16Extend store to cope with references used in keys.Robin Watts
The store is effectively a list of items, where each item is a (key, value) pair. The design is such that we can easily get into the state where the only reference to a value is that held by the store. Subsequent references can then be generated by things being 'found' from within the store. While the only reference to an object is that held by it being a value in the store, the store is free to evict it to save memory. Images present a complication to this design; images are stored both as values within the store (by the pdf agent, so that we do not regenerate images each time we meet them in the file), and as parts of the keys within the store. For example, once an image is decoded to give a pixmap, the pixmap is cached in the store. The key to look that pixmap up again includes a reference to the image from which the pixmap was generated. This means, that for document handlers such as gproof that do not place images in the store, we can end up with images that are kept around purely by dint of being used as references in store keys. There is no chance of the value (the decoded pixmap) ever being 'found' from the store as no one other than the key is holding a reference to the image required. Thus the images/pixmaps are never freed until the store is emptied. This commit offers a fix for this situation. Standard store items are based on an fz_storable type. Here we introduce a new fz_key_storable type derived from that. As well as keeping track of the number of references a given item has to it, it keeps a separate count of the number of references a given item has to it from keys in the store. On dropping a reference, we check to see if the number of references has become the same as the number of references from keys in the store. If it has, then we know that these keys can never be 'found' again. So we filter them out of the store, which drops the items.
2016-09-14Redirect fprintf to android logcat in debug builds.Robin Watts
This makes debugging much simpler.
2016-09-14Fix typo in Memento header.Robin Watts
2016-09-13Update Memento for Android.Robin Watts
Add backtrace abilities, and fix missing return value from android logging.
2016-09-13Bug 696984: Type 3 fonts bbox fixes.Robin Watts
The upshot of debugging this is that: 1) We can't trust the FontBBox. Certainly it appears that no one else trusts it. 2) We can't trust the d1 values in all cases, as it can lead to use rendering glyphs far larger than we'd want to. So we have the compromise used here. 1) We never clip to the FontBBox. 2) If the FontBBox is invalid, then we calculate the bbox from the contents of the data streams. 3) If the FontBBox is valid, and the d1 rectangle given does not fit inside it, then we calculate the bbox from the contents of the data streams. This could theoretically produce problems with glyphs that have much more content than they actually need, and rely on the d1 rect to clip it down to sanity. If the FontBBox is invalid in such fonts, we will go wrong. It's not clear to me that this will actually work in Acrobat/ Foxit/gs etc either, so we defer handling this better until we actually have an example. Tested with bug 694952, and bug 695843 which were the last 2 in this area.
2016-09-09Fix VS2005 build; missing stat definition.Robin Watts
Windows requires sys/stat.h to be included.
2016-09-08Add options to control heuristics in structured text.Sebastian Rasmussen