Fix JBIG2 decoding issue #5026

This PR fixes two issues that caused #5026:

1. A `0` was missing in the old template (I think Figure 8 in the [draft](http://www.jpeg.org/public/fcd14492.pdf#page=44) is slightly wrong, the leftmost zero should be in thick borders). Up to the missing zero, the old constants (almost) matched those in xpdf.
2. We are sorting the template since abcc72a173d6c88f01938ef8326b63b6e12cdafb, and so the template bits must be reordered as well. The new constants match those in [jbig2dec](https://github.com/rillian/jbig2dec/blob/master/jbig2_generic.c).

EDIT: Fixed wrong link to the sorting commit.