summaryrefslogtreecommitdiff
path: root/pdf/mupdf-internal.h
AgeCommit message (Collapse)Author
2012-12-19Bug 693503: 'Flatten' display list for all type3 glyphs.Robin Watts
It is perfectly allowable to have type3 glyphs that refer to other type3 glyphs in the same font (and in theory it's probably even possible to have type3 glyphs that refer back and forth between 2 or more type3 fonts). The old code used to cope with this just fine, but with the change to 'early loading' of the glyphs to display lists at interpret time a problem has crept in. When we load the type 3 font, we load each glyph in turn. If glyph 1 tries to use glyph 2, then we look up the font, only to find that that the font has not been installed yet, so we reload the entire font. This gets us into an infinite loop. As a fix for this, we split the loading of the type3 font into 2; we load the font as normal, then allow the font to be inserted into the list of current fonts. Then we run through the glyphs in the font 'preparing' them (turning them into display lists). This solves the infinite loop issue, but causes another problem; recursive references (such as a font holding a display list that contains a text node that contains a reference to the original font) result in us never being able to free the structures. To avoid this, we insist on never allowing type3 glyphs to be referenced within a type3 display list. The display lists for all type3 glyphs are therefore 'flat'. We achieve this by adding a 'nested' flag to the pdf command stream interpreter structure, and setting this in the case where we are running a glyph stream. We check for that flag in the type3 glyph render function, and if present, we force the 'render_direct' path to be used. Finally, we ensure that fz_text groups are not needlessly created with no contents. Problem found in 2923.pdf.asan.22.2139, a test file supplied by Mateusz "j00ru" Jurczyk and Gynvael Coldwind of the Google Security Team using Address Sanitizer. Many thanks!
2012-11-29Bug 693463: Various small fixes.Robin Watts
Thanks to zeniko for these. Use otf as extension for opentype fonts. fz_clampi should take ints, not floats! Fix typo in prototype. Squash unwanted warning. Remove magic number in favour of #define. Reset generation numbers when renumbering.
2012-11-07Javascript: implement Field.namePaul Gardiner
2012-10-29Add fz_update_pagePaul Gardiner
Regenerate dirty appearance streams and report changed annotations since last call. Also include a partial revert of changes in 96f335bc, that turn out not to be necessary. fz_update_page must now be called between each document-changing event and the next render. pdfapp.c and the android app have been updated to do so, but do not yet take advantage of the possibility to render only the updated areas of the screen.
2012-10-17First steps towards supporting transitions.Robin Watts
Only Fade, Wipe and Blinds supported so far. Hit 'p' in the viewer to go into 'presentation' mode. Page swaps then transition from page to page. Pages auto advance until key or mouse is used.
2012-10-16Forms: avoid the need to reload the page on every changePaul Gardiner
Add pdf_update_annot, which is called before rendering an annotation, and checks that the annotation structure has correct information. There are three reasons the information can be out of date. Attributes of a field may have been changed such that its appearance stream needs updating. In this case the field will have have "Dirty" added to its dictionary The mouse may have changed state over the field, and a different appearance stream needs selecting. The annotation structure now records the mouse states for which the current appearance stream is acceptable. The field may have changed state as recorded by its "AS" value, and a different appearance stream needs selecting.
2012-10-11Android Forms: pass in mouse events and handle updatingPaul Gardiner
Also add a function to report whether the core has javascript support, so that the additional features can be enabled only when the javascript engine is present
2012-10-05Refactor compressed stream loading.Robin Watts
Refactor 'short stopped' image stream loading into fz_compressed_buffer loading. Nicer overall, and reflects the fact that this can be used for non-image streams that we want to hold compressed in memory (for instance for shading streams). This is a preparatory step for pdfwrite, and enables further shading memory use optimisations. Remove unused jbig2 function pointer from the fz_compression_params (previously fz_image_params) structure to avoid confusion.
2012-09-25Forms: support doc.mailDoc.Paul Gardiner
2012-09-25Javascript: support test for booleanPaul Gardiner
2012-09-25Forms: handle app.launchUrl, currently by displaying a warningPaul Gardiner
2012-09-25Forms: show warning for use of app.execDialogPaul Gardiner
app.execDialog looks very difficult to support. Hopefully we wont have to
2012-09-25Forms: handle app.execMenuItem (presently just as a not-supported warning)Paul Gardiner
The name of the menu item is passed, so presumably the app could respond to some of the possibilities.
2012-09-19Forms: handle print request, both from javascript and from named actionPaul Gardiner
Currently the app windows app responds with a message box explaining that the MuPDF library passes print requests to the app, but the app does not implement printing.
2012-09-18Forms: add event handling api and specifically support for javascript alertPaul Gardiner
2012-09-18Forms: support property access in the javascript enginePaul Gardiner
2012-09-04Make pdf resource localisation procedure non-static.Robin Watts
And add a flag in the xref for evey PDF document to say whether it has been localised or not; this will be important for PDF editing to avoid us having to localise on every edit.
2012-09-04Merge branch 'master' into formsPaul Gardiner
Conflicts: pdf/pdf_xref_aux.c
2012-09-04Forms: mass renaming for the sake of consistencyPaul Gardiner
2012-08-31Forms: rework form reset action to use new method introduced for JSPaul Gardiner
2012-08-31Forms: implement javascript doc.resetForm methodPaul Gardiner
2012-08-31Forms: provide js engine method for determining object typePaul Gardiner
2012-08-29Forms: implement javascript Field.display propertyPaul Gardiner
2012-08-28Add fz_open_document_with_stream function.Tor Andersson
Use a "magic" string for filetype detection: filename or mime-type.
2012-08-24Forms: avoid javascript action execution when engine not availablePaul Gardiner
This was necessary to avoid indirecting through a NULL pointer returned from pdf_js_get_event, but is a generally sensible restriction. Also separate the execution of the document-level javascript actions from the pdf_js contstructor, so that doc->js is set during those actions. Also add a missing const
2012-08-16Forms: respond to failed validation in windows appPaul Gardiner
2012-08-10Forms: handle Keystroke and Validate actionsPaul Gardiner
2012-08-10Forms: alter the handling of the javascript event objectPaul Gardiner
2012-08-08Merge branch 'master' into formsPaul Gardiner
Conflicts: Makefile apps/mudraw.c pdf/pdf_write.c win32/libmupdf-v8.vcproj
2012-08-06Expose both PDF encryption version and revisionSebastian Rasmussen
Thanks to Zeniko for pointing out that version as missing.
2012-08-02Forms: add document dirty flagPaul Gardiner
2012-08-01Merge branch 'master' into formsPaul Gardiner
Conflicts: pdf/mupdf-internal.h pdf/pdf_font.c
2012-08-01Enable pdf_print_xref in release builds; required for pdfshow.Robin Watts
Previously this had been disabled other than in DEBUG builds under the belief that it was only used for debugging.
2012-07-23Provide number of inputs/outpus when loading pdf functionsSebastian Rasmussen
This will allow the loading of pdf functions to validate that a pdf function has the correct number of inputs/outputs. Additionally it will allow for handling pdf functions with incorrect number of inputs/outputs.
2012-07-17Forms: implement library api for handling list boxes and combo boxesPaul Gardiner
2012-07-17Forms: remove unhelpful type distinctionPaul Gardiner
2012-07-17Forms: protect agains recursion during internal field recalculationPaul Gardiner
2012-07-09Forms: add widget enumeration, and text-widget content typePaul Gardiner
Now reusing the internal representation of an annotation for widgets to avoid two separate lists
2012-07-06Remove debugging functions for release builds.Sebastian Rasmussen
2012-06-28Forms: implement javascript form-field formattingPaul Gardiner
Consists in adding JS function AFNumber_Format and updating the DOM to include event.value
2012-06-22Rework pdf_lexbuf to allow for dynamic parsing buffers.Robin Watts
Currently pdf_lexbufs use a static scratch buffer for parsing. In the main case this is 64K in size, but in other cases it can be just 256 bytes; this causes problems when parsing long strings. Even the 64K limit is an implementation limit of Acrobat, not an architectural limit of PDF. Change here to allow dynamic buffers. This means a slightly more complex setup and destruction for each buffer, but more importantly requires correct cleanup on errors. To avoid having to insert lots more try/catch clauses this commit includes various changes to the code so we reuse pdf_lexbufs where possible. This keeps the speed up.
2012-06-22Rework pdf_lexbuf to allow for dynamic parsing buffers.Robin Watts
Currently pdf_lexbufs use a static scratch buffer for parsing. In the main case this is 64K in size, but in other cases it can be just 256 bytes; this causes problems when parsing long strings. Even the 64K limit is an implementation limit of Acrobat, not an architectural limit of PDF. Change here to allow dynamic buffers. This means a slightly more complex setup and destruction for each buffer, but more importantly requires correct cleanup on errors. To avoid having to insert lots more try/catch clauses this commit includes various changes to the code so we reuse pdf_lexbufs where possible. This keeps the speed up.
2012-06-20Add better mechanism for enumerating annotation rectangles.Robin Watts
Rather than having a dedicated call to enumerate the rectangles for the annotations on a page, add an interface for enumerating annotations with accessor functions. Currently the only accessor function is the one to get the annotation rectangle. Use this new scheme in place of fz_bound_annots within mudraw. Also use this scheme to set the caret cursor in the viewer when over a data field.
2012-06-19Fix bug 693133: MuPDF forms support: Text incorrectly transformedPaul Gardiner
Refactor the text-widget updating code to use the later-written, button-updating technique, which accounts for rotation. Also now delays generation of appearance streams until required for rendering.
2012-06-13Merge branch 'master' into formsPaul Gardiner
2012-06-13Remove unnecessary function and improve namingPaul Gardiner
2012-06-13Merge branch 'master' into formsPaul Gardiner
Conflicts: fitz/fitz-internal.h fitz/stm_buffer.c pdf/mupdf-internal.h
2012-06-12A few general utility functions added for the sake of the forms workPaul Gardiner
2012-06-12Forms: improved handling of text scaling in multiline text widgetsPaul Gardiner
2012-06-11Forms: first version appearance synthesis for multiline text widgetsPaul Gardiner