Bug 693640: Fix interpolated painting of images going out of range

When calculating the texture position for interpolated painting we
apply a voodoo correction. This was causing problems by taking us
out of bounds; simply add some checks to avoid this taking us out
of range.

This causes many differences, all small, or progressions. In particular
it solves several 'white lines' cases where images didn't quite
line up.
Bug 693624: Update mudraw and mutool to use Unicode entry points on windows

Convert the unicode argv to utf8, and pass in to our existing main
function.
Force colorspaces to match with JPX images.

If the colorspace given in the dictionary of a JPX image differs from
the colorspace given in the image itself, decode to the native image
format, then convert.

This goes a long way towards fixing "1439 - color softmask fails to
draw jpx image.pdf" (aka hivemind.pdf). The lack of transfer function
support hopefully explains the rest.
Bug 693596: Speed compilation on unix based systems.

Use $(shell xxxx) rather than `xxxx` for pkg-config lines to avoid
repeated reevaluation. Also get X libs from pkg-config too.

Thanks to Michael Weber.
Bug 693595: Fix typo in Makefile resulting in mutool not being installed.

In the MUBUSY -> MUTOOL rename, one was missed.

Thanks to Michael Weber.
Fix bug: failure to set the SubType field of created annotations.

Also, in the app, protect against exceptions thrown due to unknown
annotation types.
Fix pdf_device ignoring the coordinate transform matrix in some cases
Pass bbox to pdf_set_annot_appearance rather than base on display list

Use of the bbox device to derive the area of the display list can lead
to bad results because of heuristics used to handle corners of stroked
paths.
Fix JPX Softmasks being all FF's.

My previous JPX softmask commit was forcing fz_alpha_to_gray to be
called with luminosity = 0, which meant it ended up with solid pixels.
This fix actually reverts the line to what it was before (but not
the rest of the commit). hivemind.pdf is still far from rendering
correctly though.
Bug 693627: Avoid linearisation deleting Outlines.

Due to an unfixed FIXME, the Outline details were always being detected
as being free and hence dropped.

Solve this, ensuring they go into the right part of the file. Also
ensure that Names and Dests go into the final section too.
Bug 693624: Ensure that windows copes with utf8 filenames

When running under Windows, replace fopen with our own fopen_utf8
that converts from utf8 to unicode before calling the unicode
version of fopen.
Avoid interactive features causing bloat in mutool
Fix misalignment of rotated images.

The recent positioning fix for bug 693640 caused a problem with rotated
images. The fix is to only apply the previous fix when we have rectilinear
scalings of images.
Fix warnings seen on cleaning a document.

Seen with the test file from bu 693677. When we read a file in, we
read the trailer, and the encrypt object before we start to decrypt
other objects. These objects do not make it into the xref table though.

When we write a file out, we run through the file reading in objects
prior to writing them out; when we read in the trailer and the encrypt
object we therefore try to decrypt them, giving errors.

To avoid these errors, put the trailer and the encrypt object into the
xref table when they are first read.

This solves all but 1 problem when cleaning this file with "-dif" (as
the signature object contains a digest block of data that is unencrypted).

This solves all but 3 problems when cleaning this file with "-difggg";
the signature object, and one orphan copy of the crypt dictionary that
is reported twice.
Auto-generate appearance streams for strikeout, underline, highlight

This fixes bug #693664, and also simplifies app code.

The example file attached to the bug produces strange results, but that
is because the QuadPoint information is incorrect.
Fix compilation on Mac OS X by partially reverting 61c1f80d36.

Starting with 61c1f80d36bf1d946ce26d39f9afb99897fc9923 mupdf requires
pkg-config to build.  However pkg-config is not supplied with Xcode
and is therefore not routinely installed on Mac OS X.  Even if
pkg-config were available it would not accomplish the goal of that
commit (speed up compilation); on Mac OS X compilation would be
slower.
Add noreturn attribute to throw/rethrow to help improve compiler warnings.
Silence warnings.
Remove unneccessary ./ prefix in generated file makefile recipes.
Fix incorrect scissor boxes for second and subsequent glyphs.