*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*
* - Made bitmap code much more efficient and compact.
*/
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
paint = !paint;
}
if(row != h || inrow != w) {
- error(_("Bad PK file: More bits than required\n"));
+ mdvi_error(_("Bad PK file: More bits than required\n"));
bitmap_destroy(bm);
return NULL;
}
{
int i;
int flag_byte;
- int loc, hic, maxch;
+ int hic, maxch;
Int32 checksum;
FILE *p;
#ifndef NODEBUG
char s[256];
#endif
long alpha, beta, z;
+ unsigned int loc;
font->chars = xnalloc(DviFontChar, 256);
p = font->in;
/* get the checksum */
checksum = fuget4(p);
if(checksum && font->checksum && font->checksum != checksum) {
- warning(_("%s: checksum mismatch (expected %u, got %u)\n"),
- font->fontname, font->checksum, checksum);
+ mdvi_warning(_("%s: checksum mismatch (expected %u, got %u)\n"),
+ font->fontname, font->checksum, checksum);
} else if(!font->checksum)
font->checksum = checksum;
/* skip pixel per point ratios */
case PK_NOOP:
break;
case PK_PRE:
- error(_("%s: unexpected preamble\n"), font->fontname);
+ mdvi_error(_("%s: unexpected preamble\n"), font->fontname);
goto error;
}
} else {
}
if(feof(p))
break;
+
+ /* Although the PK format support bigger char codes,
+ * XeTeX and other extended TeX engines support charcodes up to
+ * 65536, while normal TeX engine supports only charcode up to 255.*/
+ if (cc < 0 || cc > 65536) {
+ mdvi_error (_("%s: unexpected charcode (%d)\n"),
+ font->fontname,cc);
+ goto error;
+ }
if(cc < loc)
loc = cc;
if(cc > hic)
}
}
if(flag_byte != PK_POST) {
- error(_("%s: unexpected end of file (no postamble)\n"),
- font->fontname);
+ mdvi_error(_("%s: unexpected end of file (no postamble)\n"),
+ font->fontname);
goto error;
}
while((flag_byte = fuget1(p)) != EOF) {
if(flag_byte != PK_NOOP) {
- error(_("invalid PK file! (junk in postamble)\n"));
+ mdvi_error(_("invalid PK file! (junk in postamble)\n"));
goto error;
}
}
return 0;
badpk:
- error(_("%s: File corrupted, or not a PK file\n"), font->fontname);
+ mdvi_error(_("%s: File corrupted, or not a PK file\n"), font->fontname);
error:
mdvi_free(font->chars);
font->chars = NULL;