texlive[48663] Build/source/texk/dvipdfm-x: Cleanup. Remove
commits+kakuto at tug.org
commits+kakuto at tug.org
Fri Sep 14 05:34:50 CEST 2018
Revision: 48663
http://tug.org/svn/texlive?view=revision&revision=48663
Author: kakuto
Date: 2018-09-14 05:34:50 +0200 (Fri, 14 Sep 2018)
Log Message:
-----------
Cleanup. Remove duplicated code. Reorganize global variables. (S. Hirata)
Modified Paths:
--------------
trunk/Build/source/texk/dvipdfm-x/ChangeLog
trunk/Build/source/texk/dvipdfm-x/agl.c
trunk/Build/source/texk/dvipdfm-x/agl.h
trunk/Build/source/texk/dvipdfm-x/bmpimage.c
trunk/Build/source/texk/dvipdfm-x/cid.c
trunk/Build/source/texk/dvipdfm-x/cid.h
trunk/Build/source/texk/dvipdfm-x/cidtype0.c
trunk/Build/source/texk/dvipdfm-x/cidtype0.h
trunk/Build/source/texk/dvipdfm-x/cidtype2.c
trunk/Build/source/texk/dvipdfm-x/cidtype2.h
trunk/Build/source/texk/dvipdfm-x/cmap.c
trunk/Build/source/texk/dvipdfm-x/cmap.h
trunk/Build/source/texk/dvipdfm-x/cmap_read.c
trunk/Build/source/texk/dvipdfm-x/configure
trunk/Build/source/texk/dvipdfm-x/configure.ac
trunk/Build/source/texk/dvipdfm-x/dpxconf.c
trunk/Build/source/texk/dvipdfm-x/dpxconf.h
trunk/Build/source/texk/dvipdfm-x/dpxfile.c
trunk/Build/source/texk/dvipdfm-x/dpxfile.h
trunk/Build/source/texk/dvipdfm-x/dvi.c
trunk/Build/source/texk/dvipdfm-x/dvi.h
trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c
trunk/Build/source/texk/dvipdfm-x/dvipdfmx.h
trunk/Build/source/texk/dvipdfm-x/epdf.c
trunk/Build/source/texk/dvipdfm-x/fontmap.c
trunk/Build/source/texk/dvipdfm-x/fontmap.h
trunk/Build/source/texk/dvipdfm-x/jp2image.c
trunk/Build/source/texk/dvipdfm-x/jpegimage.c
trunk/Build/source/texk/dvipdfm-x/mpost.c
trunk/Build/source/texk/dvipdfm-x/mpost.h
trunk/Build/source/texk/dvipdfm-x/pdfcolor.c
trunk/Build/source/texk/dvipdfm-x/pdfcolor.h
trunk/Build/source/texk/dvipdfm-x/pdfdev.c
trunk/Build/source/texk/dvipdfm-x/pdfdev.h
trunk/Build/source/texk/dvipdfm-x/pdfdoc.c
trunk/Build/source/texk/dvipdfm-x/pdfdoc.h
trunk/Build/source/texk/dvipdfm-x/pdfdraw.c
trunk/Build/source/texk/dvipdfm-x/pdfencoding.c
trunk/Build/source/texk/dvipdfm-x/pdfencoding.h
trunk/Build/source/texk/dvipdfm-x/pdfencrypt.c
trunk/Build/source/texk/dvipdfm-x/pdfencrypt.h
trunk/Build/source/texk/dvipdfm-x/pdffont.c
trunk/Build/source/texk/dvipdfm-x/pdffont.h
trunk/Build/source/texk/dvipdfm-x/pdfobj.c
trunk/Build/source/texk/dvipdfm-x/pdfobj.h
trunk/Build/source/texk/dvipdfm-x/pdfximage.c
trunk/Build/source/texk/dvipdfm-x/pdfximage.h
trunk/Build/source/texk/dvipdfm-x/pngimage.c
trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c
trunk/Build/source/texk/dvipdfm-x/spc_util.c
trunk/Build/source/texk/dvipdfm-x/spc_util.h
trunk/Build/source/texk/dvipdfm-x/specials.c
trunk/Build/source/texk/dvipdfm-x/specials.h
trunk/Build/source/texk/dvipdfm-x/subfont.c
trunk/Build/source/texk/dvipdfm-x/subfont.h
trunk/Build/source/texk/dvipdfm-x/t1_char.c
trunk/Build/source/texk/dvipdfm-x/tfm.c
trunk/Build/source/texk/dvipdfm-x/tfm.h
trunk/Build/source/texk/dvipdfm-x/truetype.c
trunk/Build/source/texk/dvipdfm-x/tt_aux.c
trunk/Build/source/texk/dvipdfm-x/tt_aux.h
trunk/Build/source/texk/dvipdfm-x/tt_cmap.c
trunk/Build/source/texk/dvipdfm-x/tt_cmap.h
trunk/Build/source/texk/dvipdfm-x/tt_gsub.c
trunk/Build/source/texk/dvipdfm-x/tt_gsub.h
trunk/Build/source/texk/dvipdfm-x/type0.c
trunk/Build/source/texk/dvipdfm-x/type0.h
trunk/Build/source/texk/dvipdfm-x/type1.c
trunk/Build/source/texk/dvipdfm-x/type1c.c
trunk/Build/source/texk/dvipdfm-x/vf.c
trunk/Build/source/texk/dvipdfm-x/vf.h
trunk/Build/source/texk/dvipdfm-x/xbb.c
Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,3 +1,17 @@
+2018-09-14 Shunsaku Hirata <shunsaku.hirata74 at gmail.com>
+
+ * agl.[ch], bmpimage.c, cid.[ch], cidtype0.[ch], cidtype2.[ch],
+ cmap.[ch], cmap_read.c, dpxconf.[ch], dpxfile.[ch], dvi.[ch],
+ dvipdfmx.[ch], epdf.c, fontmap.[ch], jp2image.c, jpegimage.c,
+ mpost.[ch], pdfcolor.[ch], pdfdev.[ch], pdfdoc.[ch], pdfdraw.c,
+ pdfencoding.[ch], pdfencrypt.[ch], pdffont.[ch], pdfobj.[ch],
+ pdfximage.[ch], pngimage.c, spc_pdfm.c, spc_util.[ch],
+ specials.[ch], subfont.[ch], t1_char.c, tfm.[ch], truetype.c,
+ tt_aux.[ch], tt_cmap.[ch], tt_gsub.[ch], type0.[ch], type1.c,
+ type1c.c, vf.[ch], xbb.c: Cleanup. Remove duplicated code.
+ Reorganize global variables.
+ * configure.ac: Version 20180914.
+
2018-09-09 Karl Berry <karl at tug.org>
* xdvipfm-bb.test: LC_ALL=LANGUAGE=C.
Modified: trunk/Build/source/texk/dvipdfm-x/agl.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/agl.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/agl.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2007-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -40,10 +40,9 @@
#include "mfileio.h"
#include "pdfparse.h"
-
+#include "dpxconf.h"
/* Hash */
#include "dpxutil.h"
-
#include "dpxfile.h"
#include "unicode.h"
@@ -52,14 +51,6 @@
static int agl_load_listfile (const char *filename, int format);
-static int verbose = 0;
-
-void
-agl_set_verbose (void)
-{
- verbose++;
-}
-
static agl_name *
agl_new_name (void)
{
@@ -408,7 +399,7 @@
return -1;
}
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("<AGL:%s", filename);
while ((p = mfgets(wbuf, WBUF_SIZE, fp)) != NULL) {
@@ -478,7 +469,7 @@
duplicate->alternate = agln;
}
- if (verbose > 3) {
+ if (dpx_conf.verbose_level > 5) {
if (agln->suffix)
MESG("agl: %s [%s.%s] -->", name, agln->name, agln->suffix);
else
@@ -498,7 +489,7 @@
}
DPXFCLOSE(fp);
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG(">");
return count;
@@ -705,7 +696,7 @@
IS_PUA(agln1->unicodes[0]))) {
agln0 = agl_normalized_name(name);
if (agln0) {
- if (verbose > 1 && agln0->suffix) {
+ if (dpx_conf.verbose_level > 1 && agln0->suffix) {
WARN("agl: fix %s --> %s.%s",
name, agln0->name, agln0->suffix);
}
@@ -718,7 +709,7 @@
len += UC_UTF16BE_encode_char(agln1->unicodes[i], dstpp, limptr);
}
} else {
- if (verbose) {
+ if (dpx_conf.verbose_level > 0) {
WARN("No Unicode mapping for glyph name \"%s\" found.", name);
}
count++;
@@ -795,7 +786,7 @@
IS_PUA(agln1->unicodes[0]))) {
agln0 = agl_normalized_name(name);
if (agln0) {
- if (verbose > 1 && agln0->suffix) {
+ if (dpx_conf.verbose_level > 1 && agln0->suffix) {
WARN("agl: fix %s --> %s.%s",
name, agln0->name, agln0->suffix);
}
@@ -812,7 +803,7 @@
unicodes[count++] = agln1->unicodes[i];
}
} else {
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
WARN("No Unicode mapping for glyph name \"%s\" found.", name);
RELEASE(name);
return -1;
Modified: trunk/Build/source/texk/dvipdfm-x/agl.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/agl.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/agl.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2007-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -58,7 +58,6 @@
extern int agl_select_listfile (const char *mapfile);
#endif
-extern void agl_set_verbose (void);
extern void agl_init_map (void);
extern void agl_close_map (void);
Modified: trunk/Build/source/texk/dvipdfm-x/bmpimage.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/bmpimage.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/bmpimage.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -33,7 +33,8 @@
#include "error.h"
#include "mem.h"
-#include "dvipdfmx.h" /* only for "compat_mode" */
+#include "dpxconf.h"
+
#include "pdfobj.h"
#include "bmpimage.h"
@@ -87,7 +88,7 @@
static void
get_density (double *xdensity, double *ydensity, struct hdr_info *hdr)
{
- if (compat_mode)
+ if (dpx_conf.compat_mode == dpx_mode_compat_mode)
*xdensity = *ydensity = 72.0 / 100.0;
else if (hdr->x_pix_per_meter > 0 && hdr->y_pix_per_meter > 0) { /* 0 for undefined. FIXME */
*xdensity = 72.0 / (hdr->x_pix_per_meter * 0.0254);
Modified: trunk/Build/source/texk/dvipdfm-x/cid.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/cid.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/cid.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -33,6 +33,7 @@
#include "system.h"
#include "mem.h"
#include "error.h"
+#include "dpxconf.h"
#include "dpxutil.h"
#include "pdfobj.h"
@@ -115,17 +116,8 @@
static void release_opt (cid_opt *opt);
static CIDSysInfo *get_cidsysinfo (const char *map_name, fontmap_opt *fmap_opt);
-static int __verbose = 0;
-static int cidoptflags = 0;
+static int cidoptflags = 0;
-void
-CIDFont_set_verbose (void)
-{
- CIDFont_type0_set_verbose();
- CIDFont_type2_set_verbose();
- __verbose++;
-}
-
#if 0
int
CIDFont_require_version (void)
@@ -343,9 +335,9 @@
if (!font || !font->indirect)
return;
- if (__verbose)
+ if (dpx_conf.verbose_level > 0)
MESG(":%s", font->ident);
- if (__verbose > 1) {
+ if (dpx_conf.verbose_level > 1) {
if (font->fontname)
MESG("[%s]", font->fontname);
}
@@ -352,7 +344,7 @@
switch (font->subtype) {
case CIDFONT_TYPE0:
- if(__verbose)
+ if(dpx_conf.verbose_level > 0)
MESG("[CIDFontType0]");
if (CIDFont_get_flag(font, CIDFONT_FLAG_TYPE1))
CIDFont_type0_t1dofont(font);
@@ -362,7 +354,7 @@
CIDFont_type0_dofont(font);
break;
case CIDFONT_TYPE2:
- if(__verbose)
+ if(dpx_conf.verbose_level > 0)
MESG("[CIDFontType2]");
CIDFont_type2_dofont(font);
break;
@@ -670,7 +662,7 @@
font = __cache->fonts[font_id];
- if (__verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("(CID");
CIDFont_dofont (font);
@@ -679,7 +671,7 @@
RELEASE(font);
- if (__verbose)
+ if (dpx_conf.verbose_level > 0)
MESG(")");
}
RELEASE(__cache->fonts);
Modified: trunk/Build/source/texk/dvipdfm-x/cid.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/cid.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/cid.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
This program is free software; you can redistribute it and/or modify
@@ -36,7 +36,6 @@
typedef struct CIDFont CIDFont;
-extern void CIDFont_set_verbose (void);
#if 0
extern int CIDFont_require_version (void);
#endif
Modified: trunk/Build/source/texk/dvipdfm-x/cidtype0.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/cidtype0.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/cidtype0.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -33,6 +33,7 @@
#include "numbers.h"
#include "mem.h"
#include "error.h"
+#include "dpxconf.h"
#include "dpxfile.h"
@@ -70,16 +71,9 @@
#include "cmap_write.h"
#include "fontmap.h"
-static int verbose = 0;
static int opt_flags = 0;
void
-CIDFont_type0_set_verbose (void)
-{
- verbose++;
-}
-
-void
CIDFont_type0_set_flags (int flags)
{
opt_flags = flags;
@@ -820,7 +814,7 @@
CIDFontInfo_close(&info);
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
MESG("[%u/%u glyphs][%ld bytes]", num_glyphs, cs_count, destlen);
CIDFont_type0_add_CIDSet(font, used_chars, last_cid);
@@ -1264,7 +1258,7 @@
CIDFontInfo_close(&info);
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
MESG("[%u glyphs][%ld bytes]", num_glyphs, destlen);
CIDFont_type0_add_CIDSet(font, used_chars, last_cid);
Modified: trunk/Build/source/texk/dvipdfm-x/cidtype0.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/cidtype0.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/cidtype0.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
This program is free software; you can redistribute it and/or modify
@@ -25,7 +25,6 @@
#include "cid_p.h"
#include "fontmap.h"
-extern void CIDFont_type0_set_verbose (void);
extern void CIDFont_type0_set_flags (int flags);
extern int CIDFont_type0_open (CIDFont *font, const char *name,
Modified: trunk/Build/source/texk/dvipdfm-x/cidtype2.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/cidtype2.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/cidtype2.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -31,6 +31,7 @@
#include "numbers.h"
#include "mem.h"
#include "error.h"
+#include "dpxconf.h"
#include "dpxfile.h"
#include "pdfobj.h"
@@ -57,16 +58,9 @@
#include "cid_p.h"
#include "cidtype2.h"
-static int verbose = 0;
static int opt_flags = 0;
void
-CIDFont_type2_set_verbose (void)
-{
- verbose++;
-}
-
-void
CIDFont_type2_set_flags (int32_t flags)
{
opt_flags = flags;
@@ -837,7 +831,7 @@
if (CIDFont_get_embedding(font)) {
if (tt_build_tables(sfont, glyphs) < 0)
ERROR("Could not created FontFile stream.");
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
MESG("[%u glyphs (Max CID: %u)]", glyphs->num_glyphs, last_cid);
} else {
if (tt_get_metrics(sfont, glyphs) < 0)
@@ -910,7 +904,7 @@
if (!fontfile)
ERROR("Could not created FontFile stream for \"%s\".", font->ident);
- if (verbose > 1) {
+ if (dpx_conf.verbose_level > 1) {
MESG("[%ld bytes]", pdf_stream_length(fontfile));
}
Modified: trunk/Build/source/texk/dvipdfm-x/cidtype2.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/cidtype2.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/cidtype2.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
This program is free software; you can redistribute it and/or modify
@@ -24,7 +24,6 @@
#include "cid.h"
#include "cid_p.h"
-extern void CIDFont_type2_set_verbose (void);
extern void CIDFont_type2_set_flags (int flags);
extern int CIDFont_type2_open (CIDFont *font, const char *name,
Modified: trunk/Build/source/texk/dvipdfm-x/cmap.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/cmap.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/cmap.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -45,21 +45,15 @@
#include "system.h"
#include "mem.h"
#include "error.h"
+#include "dpxconf.h"
#include "dpxutil.h"
#include "cmap_p.h"
#include "cmap.h"
-static int __verbose = 0;
static int __silent = 0;
void
-CMap_set_verbose (void)
-{
- __verbose++;
-}
-
-void
CMap_set_silent (int value)
{
__silent = value ? 1 : 0;
@@ -932,7 +926,7 @@
return -1;
}
- if (__verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("(CMap:%s", cmap_name);
if (__cache->num >= __cache->max) {
@@ -948,7 +942,7 @@
DPXFCLOSE(fp);
- if (__verbose)
+ if (dpx_conf.verbose_level > 0)
MESG(")");
return id;
Modified: trunk/Build/source/texk/dvipdfm-x/cmap.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/cmap.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/cmap.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -56,7 +56,6 @@
/************************** CMAP_MAIN **************************/
-extern void CMap_set_verbose (void);
extern void CMap_set_silent (int value);
extern CMap *CMap_new (void);
Modified: trunk/Build/source/texk/dvipdfm-x/cmap_read.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/cmap_read.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/cmap_read.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -30,6 +30,7 @@
#include "mem.h"
#include "error.h"
+#include "dpxconf.h"
#include "dpxutil.h"
#include "pst.h"
@@ -38,8 +39,6 @@
#include "cmap_read.h"
-static int __verbose = 0;
-
#define CMAP_PARSE_DEBUG_STR "CMap_parse:"
#define CMAP_PARSE_DEBUG 3
@@ -97,8 +96,6 @@
ASSERT(reader);
bytesrem = (size_t) reader->endptr - (size_t) reader->cursor;
if (size > reader->max) {
- if (__verbose)
- MESG("\nExtending buffer (%ld bytes)...\n", size);
reader->buf = RENEW(reader->buf, size+1, unsigned char);
reader->max = size;
}
@@ -111,8 +108,6 @@
ERROR("Reading file failed.");
reader->endptr += bytesread;
reader->unread -= bytesread;
- if (__verbose)
- MESG("Reading more %ld bytes (%ld bytes remains in buffer)...\n", bytesread, bytesrem);
}
*reader->endptr = 0;
Modified: trunk/Build/source/texk/dvipdfm-x/configure
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/configure 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/configure 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for dvipdfm-x (TeX Live) 20180906.
+# Generated by GNU Autoconf 2.69 for dvipdfm-x (TeX Live) 20180914.
#
# Report bugs to <tex-k at tug.org>.
#
@@ -590,8 +590,8 @@
# Identity of this package.
PACKAGE_NAME='dvipdfm-x (TeX Live)'
PACKAGE_TARNAME='dvipdfm-x--tex-live-'
-PACKAGE_VERSION='20180906'
-PACKAGE_STRING='dvipdfm-x (TeX Live) 20180906'
+PACKAGE_VERSION='20180914'
+PACKAGE_STRING='dvipdfm-x (TeX Live) 20180914'
PACKAGE_BUGREPORT='tex-k at tug.org'
PACKAGE_URL=''
@@ -1350,7 +1350,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures dvipdfm-x (TeX Live) 20180906 to adapt to many kinds of systems.
+\`configure' configures dvipdfm-x (TeX Live) 20180914 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1421,7 +1421,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20180906:";;
+ short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20180914:";;
esac
cat <<\_ACEOF
@@ -1551,7 +1551,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-dvipdfm-x (TeX Live) configure 20180906
+dvipdfm-x (TeX Live) configure 20180914
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2390,7 +2390,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by dvipdfm-x (TeX Live) $as_me 20180906, which was
+It was created by dvipdfm-x (TeX Live) $as_me 20180914, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -8075,7 +8075,7 @@
# Define the identity of the package.
PACKAGE='dvipdfm-x--tex-live-'
- VERSION='20180906'
+ VERSION='20180914'
cat >>confdefs.h <<_ACEOF
@@ -14744,7 +14744,7 @@
Report bugs to <bug-libtool at gnu.org>."
lt_cl_version="\
-dvipdfm-x (TeX Live) config.lt 20180906
+dvipdfm-x (TeX Live) config.lt 20180914
configured by $0, generated by GNU Autoconf 2.69.
Copyright (C) 2011 Free Software Foundation, Inc.
@@ -16624,7 +16624,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by dvipdfm-x (TeX Live) $as_me 20180906, which was
+This file was extended by dvipdfm-x (TeX Live) $as_me 20180914, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16694,7 +16694,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-dvipdfm-x (TeX Live) config.status 20180906
+dvipdfm-x (TeX Live) config.status 20180914
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Modified: trunk/Build/source/texk/dvipdfm-x/configure.ac
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/configure.ac 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/configure.ac 2018-09-14 03:34:50 UTC (rev 48663)
@@ -7,7 +7,7 @@
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl
-AC_INIT([dvipdfm-x (TeX Live)], [20180906], [tex-k at tug.org])
+AC_INIT([dvipdfm-x (TeX Live)], [20180914], [tex-k at tug.org])
AC_PREREQ([2.65])
AC_CONFIG_SRCDIR([agl.c])
AC_CONFIG_AUX_DIR([../../build-aux])
Modified: trunk/Build/source/texk/dvipdfm-x/dpxconf.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/dpxconf.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/dpxconf.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is DVIPDFMx, an eXtended version of DVIPDFM by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -30,6 +30,8 @@
#include "dpxconf.h"
+struct _dpx_conf dpx_conf = {0, dpx_mode_normal_mode, {0}};
+
#ifndef HAVE_LIBPAPER
const struct paper paperspecs[] = {
{"letter", 612.00, 792.00},
Modified: trunk/Build/source/texk/dvipdfm-x/dpxconf.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/dpxconf.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/dpxconf.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is DVIPDFMx, an eXtended version of DVIPDFM by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -23,6 +23,21 @@
#ifndef _DPXCONF_H_
#define _DPXCONF_H_
+enum dpx_mode {
+ dpx_mode_normal_mode,
+ dpx_mode_compat_mode,
+ dpx_mode_xdv_mode,
+ dpx_mode_mpost_mode
+};
+
+extern struct _dpx_conf {
+ int verbose_level;
+ enum dpx_mode compat_mode;
+ struct {
+ int keep_cache;
+ } file;
+} dpx_conf;
+
#ifdef HAVE_LIBPAPER
#include <paper.h>
#else
Modified: trunk/Build/source/texk/dvipdfm-x/dpxfile.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/dpxfile.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/dpxfile.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -36,6 +36,7 @@
#include "error.h"
#include "mem.h"
+#include "dpxconf.h"
#include "dpxutil.h"
#include "mfileio.h"
@@ -70,16 +71,6 @@
#endif
#endif /* MIKTEX || TESTCOMPILE */
-static int verbose = 0;
-int keep_cache = 0;
-
-void
-dpx_file_set_verbose (void)
-{
- verbose++;
-}
-
-
/* Kpathsea library does not check file type. */
static int qcheck_filetype (const char *fqpn, dpx_res_type type);
@@ -359,7 +350,7 @@
#else
kpse_format_info_type *fif;
kpse_format_info_type *fir;
- if (verbose < 1)
+ if (dpx_conf.verbose_level < 1)
return;
fif = &kpse_format_info[foolformat];
fir = &kpse_format_info[realformat];
@@ -431,7 +422,7 @@
switch (type) {
case DPX_RES_TYPE_FONTMAP:
fqpn = dpx_find_fontmap_file(filename);
- if (verbose) {
+ if (dpx_conf.verbose_level > 0) {
if (fqpn != NULL)
MESG(fqpn);
}
@@ -969,7 +960,7 @@
time_t limit;
if (life == -2) {
- keep_cache = -1;
+ dpx_conf.file.keep_cache = -1;
return;
}
@@ -977,7 +968,7 @@
pathname = NEW(strlen(dir)+1+strlen(PREFIX)+MAX_KEY_LEN*2 + 1, char);
limit = time(NULL) - life * 60 * 60;
- if (life >= 0) keep_cache = 1;
+ if (life >= 0) dpx_conf.file.keep_cache = 1;
if ((dp = opendir(dir)) != NULL) {
while((de = readdir(dp)) != NULL) {
if (dpx_clear_cache_filter(de)) {
@@ -1001,7 +992,7 @@
{
if (!tmp)
return;
- if (force || keep_cache != 1) remove (tmp);
+ if (force || dpx_conf.file.keep_cache != 1) remove (tmp);
RELEASE(tmp);
return;
Modified: trunk/Build/source/texk/dvipdfm-x/dpxfile.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/dpxfile.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/dpxfile.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -56,8 +56,6 @@
#define DPXFOPEN(n,t) dpx_open_file((const char *)(n),(t))
#define DPXFCLOSE(f) MFCLOSE((f))
-extern void dpx_file_set_verbose (void);
-
extern int dpx_file_apply_filter (const char *cmdtmpl,
const char *input, const char *output,
int version);
@@ -66,5 +64,4 @@
extern void dpx_delete_old_cache (int life);
extern void dpx_delete_temp_file (char *tmp, int force); /* tmp freed here */
-extern int keep_cache;
#endif /* _DPXFILE_H_ */
Modified: trunk/Build/source/texk/dvipdfm-x/dvi.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/dvi.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/dvi.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -41,6 +41,7 @@
#include "error.h"
#include "mfileio.h"
#include "numbers.h"
+#include "dpxconf.h"
#include "pdfdev.h"
#include "pdfdoc.h"
@@ -195,7 +196,6 @@
static int num_def_fonts = 0, max_def_fonts = 0;
static int compute_boxes = 0, link_annot = 1;
-static int verbose = 0;
#define DVI_PAGE_BUF_CHUNK 0x10000U /* 64K should be plenty for most pages */
@@ -292,16 +292,6 @@
#define skip_bufferd_bytes(n) dvi_page_buf_index += n
-void
-dvi_set_verbose (void)
-{
- verbose++;
- subfont_set_verbose();
- tfm_set_verbose();
- vf_set_verbose ();
- spc_set_verbose();
-}
-
unsigned int
dvi_npages (void)
{
@@ -326,7 +316,7 @@
static void
need_XeTeX (int c) {
- if (!is_xdv)
+ if (dpx_conf.compat_mode != dpx_mode_xdv_mode)
ERROR ("DVI opcode %i only valid for XeTeX", c);
}
@@ -366,7 +356,8 @@
}
post_id_byte = ch;
- is_xdv = (ch == XDV_ID || ch == XDV_ID_OLD);
+ if (ch == XDV_ID || ch == XDV_ID_OLD)
+ dpx_conf.compat_mode = dpx_mode_xdv_mode;
is_ptex = ch == DVIV_ID;
/* Make sure post_post is really there */
@@ -411,7 +402,7 @@
if (num_pages == 0) {
ERROR("Page count is 0!");
}
- if (verbose > 2) {
+ if (dpx_conf.verbose_level > 2) {
MESG("Page count:\t %4d\n", num_pages);
}
@@ -464,7 +455,7 @@
ERROR("Capacity exceeded.");
}
- if (verbose > 2) {
+ if (dpx_conf.verbose_level > 2) {
MESG("DVI File Info\n");
MESG("Unit: %ld / %ld\n", dvi_info.unit_num, dvi_info.unit_den);
MESG("Magnification: %ld\n", dvi_info.mag);
@@ -493,7 +484,8 @@
}
pre_id_byte = ch;
- is_xdv = (ch == XDV_ID || ch == XDV_ID_OLD);
+ if (ch == XDV_ID || ch == XDV_ID_OLD)
+ dpx_conf.compat_mode = dpx_mode_xdv_mode;
is_ptex = ch == DVI_ID; /* maybe */
dvi_info.unit_num = get_positive_quad(dvi_file, "DVI", "unit_num");
@@ -507,13 +499,13 @@
}
dvi_info.comment[ch] = '\0';
- if (verbose > 2) {
+ if (dpx_conf.verbose_level > 2) {
MESG("DVI File Info\n");
MESG("Unit: %ld / %ld\n", dvi_info.unit_num, dvi_info.unit_den);
MESG("Magnification: %ld\n", dvi_info.mag);
}
- if (verbose) {
+ if (dpx_conf.verbose_level > 0) {
MESG("DVI Comment: %s\n", dvi_info.comment);
}
@@ -651,7 +643,7 @@
ERROR(invalid_signature);
}
}
- if (verbose > 2) {
+ if (dpx_conf.verbose_level > 2) {
unsigned i;
MESG("\n");
@@ -678,7 +670,7 @@
ERROR(invalid_signature);
}
dvi_info.comment[length] = '\0';
- if (verbose) {
+ if (dpx_conf.verbose_level > 0) {
MESG("DVI Comment: %s\n", dvi_info.comment);
}
}
@@ -792,7 +784,7 @@
mag = dvi_tell_mag();
if (spc_exec_special(p, size, x_user, y_user, mag) < 0) {
- if (verbose) {
+ if (dpx_conf.verbose_level > 0) {
dump(p, p + size);
}
}
@@ -815,7 +807,7 @@
int subfont_id = -1, font_id; /* VF or device font ID */
fontmap_rec *mrec;
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("<%s@%.2fpt", tfm_name, ptsize * dvi2pts);
need_more_fonts(1);
@@ -861,7 +853,7 @@
if (font_id >= 0) {
loaded_fonts[cur_id].type = VIRTUAL;
loaded_fonts[cur_id].font_id = font_id;
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("(VF)>");
return cur_id;
}
@@ -891,7 +883,7 @@
else {
loaded_fonts[cur_id].type = VIRTUAL;
loaded_fonts[cur_id].font_id = font_id;
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("(OVF)>");
return cur_id;
}
@@ -940,7 +932,7 @@
loaded_fonts[cur_id].type = PHYSICAL;
loaded_fonts[cur_id].font_id = font_id;
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG(">");
return cur_id;
@@ -966,7 +958,7 @@
struct tt_hhea_table *hhea;
int is_dfont = 0, is_type1 = 0;
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("<%s@%.2fpt", filename, ptsize * dvi2pts);
if ((path = dpx_find_dfont_file(filename)) != NULL &&
@@ -1069,7 +1061,7 @@
loaded_fonts[cur_id].slant = mrec->opt.slant;
loaded_fonts[cur_id].embolden = mrec->opt.bold;
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG(">");
return cur_id;
@@ -1312,7 +1304,7 @@
void
dvi_dirchg (unsigned char dir)
{
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
fprintf(stderr, " > dvi_dirchg %d\n", dir);
dvi_state.d = dir;
pdf_dev_set_dirmode(dvi_state.d); /* 0: horizontal, 1,3: vertical */
Modified: trunk/Build/source/texk/dvipdfm-x/dvi.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/dvi.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/dvi.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -34,8 +34,6 @@
extern double get_origin (int x);
-extern void dvi_set_verbose (void);
-
/* returns scale (dvi2pts) */
extern double dvi_init (char *dvi_filename, double mag); /* may append .dvi or .xdv to filename */
extern void dvi_close (void); /* Closes data structures created by dvi_open */
Modified: trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -63,9 +63,6 @@
#include "error.h"
-int is_xdv = 0;
-int translate_origin = 0;
-
#if defined(LIBDPX)
const char *my_name = "ApTeX";
#else
@@ -72,12 +69,8 @@
const char *my_name;
#endif /* LIBDPX */
-int compat_mode = 0; /* 0 = dvipdfmx, 1 = dvipdfm */
-
static int verbose = 0;
-static int mp_mode = 0;
-
static int opt_flags = 0;
#define OPT_TPIC_TRANSPARENT_FILL (1 << 1)
@@ -124,6 +117,8 @@
int always_embed = 0; /* always embed fonts, regardless of licensing flags */
+int translate_origin = 0;
+
char *dvi_filename = NULL, *pdf_filename = NULL;
static void
@@ -135,7 +130,7 @@
const char *dvi_base;
dvi_base = xbasename(dvi_filename);
- if (mp_mode &&
+ if (dpx_conf.compat_mode == dpx_mode_mpost_mode &&
strlen(dvi_base) > 4 &&
FILESTRCASEEQ(".mps", dvi_base + strlen(dvi_base) - 4)) {
pdf_filename = NEW(strlen(dvi_base)+1, char);
@@ -403,6 +398,59 @@
return;
}
+/* Ask passwords for encryption */
+#ifdef WIN32
+/* Broken on mintty? */
+#include <conio.h>
+#define getch _getch
+static char *
+getpass (const char *prompt)
+{
+ static char pwd_buf[128];
+ size_t i;
+
+ fputs(prompt, stderr);
+ fflush(stderr);
+ for (i = 0; i < sizeof(pwd_buf)-1; i++) {
+ pwd_buf[i] = getch();
+ if (pwd_buf[i] == '\r' || pwd_buf[i] == '\n')
+ break;
+ fputs("*", stderr);
+ fflush(stderr);
+ }
+ pwd_buf[i] = '\0';
+ fputs("\n", stderr);
+ return pwd_buf;
+}
+#else /* !WIN32 */
+#include <unistd.h>
+#endif /* WIN32 */
+
+static int
+get_enc_password (char *uplain, char *oplain)
+{
+ char *retry_passwd;
+
+ while (1) {
+ strncpy(uplain, getpass("Owner password: "), MAX_PWD_LEN);
+ retry_passwd = getpass("Re-enter owner password: ");
+ if (!strncmp(uplain, retry_passwd, MAX_PWD_LEN))
+ break;
+ fputs("Password is not identical.\nTry again.\n", stderr);
+ fflush(stderr);
+ }
+ while (1) {
+ strncpy(oplain, getpass("User password: "), MAX_PWD_LEN);
+ retry_passwd = getpass("Re-enter user password: ");
+ if (!strncmp(oplain, retry_passwd, MAX_PWD_LEN))
+ break;
+ fputs("Password is not identical.\nTry again.\n", stderr);
+ fflush(stderr);
+ }
+
+ return 0;
+}
+
static const char *optstrig = ":hD:r:m:g:x:y:o:s:p:clf:i:qtvV:z:d:I:K:P:O:MSC:Ee";
static struct option long_options[] = {
@@ -459,14 +507,7 @@
int i;
for (i = 0; i < verbose; i++) {
- dvi_set_verbose();
- pdf_dev_set_verbose();
- pdf_doc_set_verbose();
- pdf_enc_set_verbose();
- pdf_obj_set_verbose();
- pdf_fontmap_set_verbose();
- dpx_file_set_verbose();
- tt_aux_set_verbose();
+ dpx_conf.verbose_level++;
}
}
}
@@ -495,7 +536,7 @@
break;
case 132: /* --dvipdfm */
- compat_mode = 1;
+ dpx_conf.compat_mode = dpx_mode_compat_mode;
break;
case 133: /* --kpathsea-debug */
@@ -645,7 +686,7 @@
break;
case 'M':
- mp_mode = 1;
+ dpx_conf.compat_mode = dpx_mode_mpost_mode;
break;
case 'C':
@@ -665,7 +706,7 @@
break;
case 'e':
- if (compat_mode) {
+ if (dpx_conf.compat_mode == dpx_mode_compat_mode) {
WARN("dvipdfm \"-e\" option not supported.");
break;
} /* else fall through */
@@ -806,8 +847,12 @@
pdf_close_images(); /* delete temporary files */
pdf_error_cleanup();
if (pdf_filename) {
- remove(pdf_filename);
- fprintf(stderr, "\nOutput file removed.\n");
+ if (pdf_get_output_file()) {
+ remove(pdf_filename);
+ fprintf(stderr, "\nOutput file removed.\n");
+ } else {
+ fprintf(stderr, "\nNo output PDF file written.\n");
+ }
}
}
@@ -1021,11 +1066,11 @@
}
if (FILESTRCASEEQ (base, "ebb")) {
my_name = "ebb";
- compat_mode = 1;
+ dpx_conf.compat_mode = dpx_mode_compat_mode;
return extractbb (argc, argv);
}
if (FILESTRCASEEQ (base, "dvipdfm"))
- compat_mode = 1;
+ dpx_conf.compat_mode = dpx_mode_compat_mode;
if (FILESTRCASEEQ (base, "dvipdfmx"))
my_name = "dvipdfmx";
else
@@ -1073,13 +1118,15 @@
pdf_enc_compute_id_string(dvi_filename, pdf_filename);
if (do_encryption) {
+ char uplain[MAX_PWD_LEN], oplain[MAX_PWD_LEN];
if (key_bits > 40 && pdf_check_version(1, 4) < 0)
ERROR("Chosen key length requires at least PDF 1.4. "
"Use \"-V 4\" to change.");
- pdf_enc_set_passwd(key_bits, permission, NULL, NULL);
+ get_enc_password(uplain, oplain);
+ pdf_enc_set_passwd(key_bits, permission, uplain, oplain);
}
- if (mp_mode) {
+ if (dpx_conf.compat_mode == dpx_mode_mpost_mode) {
x_offset = 0.0;
y_offset = 0.0;
dvi2pts = 0.01; /* dvi2pts controls accuracy. */
@@ -1164,11 +1211,13 @@
/* Please move this to spc_init_specials(). */
if (opt_flags & OPT_TPIC_TRANSPARENT_FILL)
tpic_set_fill_mode(1);
+ if (translate_origin)
+ mps_set_translate_origin(1);
if (opt_flags & OPT_PDFOBJ_NO_PREDICTOR)
pdf_set_use_predictor(0); /* No prediction */
- if (mp_mode) {
+ if (dpx_conf.compat_mode == dpx_mode_mpost_mode) {
do_mps_pages();
} else {
do_dvi_pages();
@@ -1183,7 +1232,7 @@
pdf_close_fontmaps(); /* pdf_font may depend on fontmap. */
- if (!mp_mode)
+ if (dpx_conf.compat_mode != dpx_mode_mpost_mode)
dvi_close();
MESG("\n");
Modified: trunk/Build/source/texk/dvipdfm-x/dvipdfmx.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/dvipdfmx.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/dvipdfmx.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* DVIPDFMx, an eXtended version of DVIPDFM by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho, Matthias Franz, and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho, Matthias Franz, and Shunsaku Hirata,
the DVIPDFMx project team.
Copyright (c) 2006 SIL. (xdvipdfmx extensions for XeTeX support)
@@ -25,9 +25,6 @@
#ifndef _DVIPDFMX_H_
#define _DVIPDFMX_H_
-extern int compat_mode;
-extern int is_xdv;
-extern int translate_origin;
extern const char *my_name;
extern int extractbb(int argc, char *argv[]);
Modified: trunk/Build/source/texk/dvipdfm-x/epdf.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/epdf.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/epdf.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -50,279 +50,9 @@
#include "epdf.h"
-static int rect_equal (pdf_obj *rect1, pdf_obj *rect2);
-
-/*
- * From PDFReference15_v6.pdf (p.119 and p.834)
- *
- * MediaBox rectangle (Required; inheritable)
- *
- * The media box defines the boundaries of the physical medium on which the
- * page is to be printed. It may include any extended area surrounding the
- * finished page for bleed, printing marks, or other such purposes. It may
- * also include areas close to the edges of the medium that cannot be marked
- * because of physical limitations of the output device. Content falling
- * outside this boundary can safely be discarded without affecting the
- * meaning of the PDF file.
- *
- * CropBox rectangle (Optional; inheritable)
- *
- * The crop box defines the region to which the contents of the page are to be
- * clipped (cropped) when displayed or printed. Unlike the other boxes, the
- * crop box has no defined meaning in terms of physical page geometry or
- * intended use; it merely imposes clipping on the page contents. However,
- * in the absence of additional information (such as imposition instructions
- * specified in a JDF or PJTF job ticket), the crop box will determine how
- * the page's contents are to be positioned on the output medium. The default
- * value is the page's media box.
- *
- * BleedBox rectangle (Optional; PDF 1.3)
- *
- * The bleed box (PDF 1.3) defines the region to which the contents of the
- * page should be clipped when output in a production environment. This may
- * include any extra bleed area needed to accommodate the physical
- * limitations of cutting, folding, and trimming equipment. The actual printed
- * page may include printing marks that fall outside the bleed box.
- * The default value is the page's crop box.
- *
- * TrimBox rectangle (Optional; PDF 1.3)
- *
- * The trim box (PDF 1.3) defines the intended dimensions of the finished page
- * after trimming. It may be smaller than the media box, to allow for
- * production-related content such as printing instructions, cut marks, or
- * color bars. The default value is the page’s crop box.
- *
- * ArtBox rectangle (Optional; PDF 1.3)
- *
- * The art box (PDF 1.3) defines the extent of the page's meaningful content
- * (including potential white space) as intended by the page's creator.
- * The default value is the page's crop box.
- *
- * Rotate integer (Optional; inheritable)
- *
- * The number of degrees by which the page should be rotated clockwise when
- * displayed or printed. The value must be a multiple of 90. Default value: 0.
- */
-
-static int
-rect_equal (pdf_obj *rect1, pdf_obj *rect2)
-{
- int i;
-
- if (!rect1 || !rect2)
- return 0;
- for (i = 0; i < 4; i++) {
- if (pdf_number_value(pdf_get_array(rect1, i)) !=
- pdf_number_value(pdf_get_array(rect2, i)))
- return 0;
- }
-
- return 1;
-}
-
static pdf_obj*
-pdf_get_page_obj (pdf_file *pf, int page_no,
- pdf_obj **ret_bbox, pdf_obj **ret_resources)
+get_page_content (pdf_file *pf, pdf_obj* page)
{
- pdf_obj *page_tree;
- pdf_obj *bbox = NULL, *resources = NULL, *rotate = NULL;
- int page_idx;
-
- /*
- * Get Page Tree.
- */
- page_tree = NULL;
- {
- pdf_obj *trailer, *catalog;
- pdf_obj *markinfo, *tmp;
-
- trailer = pdf_file_get_trailer(pf);
-
- if (pdf_lookup_dict(trailer, "Encrypt")) {
- WARN("This PDF document is encrypted.");
- pdf_release_obj(trailer);
- return NULL;
- }
-
- catalog = pdf_deref_obj(pdf_lookup_dict(trailer, "Root"));
- if (!PDF_OBJ_DICTTYPE(catalog)) {
- WARN("Can't read document catalog.");
- pdf_release_obj(trailer);
- if (catalog)
- pdf_release_obj(catalog);
- return NULL;
- }
- pdf_release_obj(trailer);
-
- markinfo = pdf_deref_obj(pdf_lookup_dict(catalog, "MarkInfo"));
- if (markinfo) {
- tmp = pdf_lookup_dict(markinfo, "Marked");
- if (PDF_OBJ_BOOLEANTYPE(tmp) && pdf_boolean_value(tmp))
- WARN("PDF file is tagged... Ignoring tags.");
- pdf_release_obj(markinfo);
- }
-
- page_tree = pdf_deref_obj(pdf_lookup_dict(catalog, "Pages"));
- pdf_release_obj(catalog);
- }
- if (!page_tree) {
- WARN("Page tree not found.");
- return NULL;
- }
-
- /*
- * Negative page numbers are counted from the back.
- */
- {
- int count = pdf_number_value(pdf_lookup_dict(page_tree, "Count"));
- page_idx = page_no + (page_no >= 0 ? -1 : count);
- if (page_idx < 0 || page_idx >= count) {
- WARN("Page %ld does not exist.", page_no);
- pdf_release_obj(page_tree);
- return NULL;
- }
- page_no = page_idx+1;
- }
-
- /*
- * Seek correct page. Get Media/Crop Box.
- * Media box and resources can be inherited.
- */
- {
- pdf_obj *kids_ref, *kids;
- pdf_obj *crop_box = NULL;
- pdf_obj *tmp;
-
- tmp = pdf_lookup_dict(page_tree, "Resources");
- resources = tmp ? pdf_deref_obj(tmp) : pdf_new_dict();
-
- while (1) {
- int kids_length, i;
-
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "MediaBox")))) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "BleedBox")))) {
- if (!rect_equal(tmp, bbox)) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- } else {
- pdf_release_obj(tmp);
- }
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "TrimBox")))) {
- if (!rect_equal(tmp, bbox)) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- } else {
- pdf_release_obj(tmp);
- }
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "ArtBox")))) {
- if (!rect_equal(tmp, bbox)) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- } else {
- pdf_release_obj(tmp);
- }
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "CropBox")))) {
- if (crop_box)
- pdf_release_obj(crop_box);
- crop_box = tmp;
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "Rotate")))) {
- if (rotate)
- pdf_release_obj(rotate);
- rotate = tmp;
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "Resources")))) {
-#if 0
- pdf_merge_dict(tmp, resources);
-#endif
- if (resources)
- pdf_release_obj(resources);
- resources = tmp;
- }
-
- kids_ref = pdf_lookup_dict(page_tree, "Kids");
- if (!kids_ref)
- break;
- kids = pdf_deref_obj(kids_ref);
- kids_length = pdf_array_length(kids);
-
- for (i = 0; i < kids_length; i++) {
- int count;
-
- pdf_release_obj(page_tree);
- page_tree = pdf_deref_obj(pdf_get_array(kids, i));
-
- tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "Count"));
- if (tmp) {
- /* Pages object */
- count = pdf_number_value(tmp);
- pdf_release_obj(tmp);
- } else {
- /* Page object */
- count = 1;
- }
- if (page_idx < count)
- break;
-
- page_idx -= count;
- }
-
- pdf_release_obj(kids);
-
- if (i == kids_length) {
- WARN("Page %ld not found! Broken PDF file?", page_no);
- if (bbox)
- pdf_release_obj(bbox);
- if (crop_box)
- pdf_release_obj(crop_box);
- if (rotate)
- pdf_release_obj(rotate);
- pdf_release_obj(resources);
- pdf_release_obj(page_tree);
- return NULL;
- }
- }
- if (crop_box) {
- pdf_release_obj(bbox);
- bbox = crop_box;
- }
- }
-
- if (!bbox) {
- WARN("No BoundingBox information available.");
- pdf_release_obj(page_tree);
- pdf_release_obj(resources);
- if (rotate)
- pdf_release_obj(rotate);
- return NULL;
- }
-
- if (rotate) {
- pdf_release_obj(rotate);
- rotate = NULL;
- }
-
- if (ret_bbox != NULL)
- *ret_bbox = bbox;
- if (ret_resources != NULL)
- *ret_resources = resources;
-
- return page_tree;
-}
-
-static pdf_obj*
-pdf_get_page_content (pdf_obj* page)
-{
pdf_obj *contents, *content_new;
contents = pdf_deref_obj(pdf_lookup_dict(page, "Contents"));
@@ -329,7 +59,7 @@
if (!contents)
return NULL;
- if (pdf_obj_typeof(contents) == PDF_NULL) {
+ if (PDF_OBJ_NULLTYPE(contents)) {
/* empty page */
pdf_release_obj(contents);
/* TODO: better don't include anything if the page is empty */
@@ -339,29 +69,26 @@
* Concatenate all content streams.
*/
pdf_obj *content_seg;
- int idx = 0;
+ int i;
content_new = pdf_new_stream(STREAM_COMPRESS);
- for (;;) {
- content_seg = pdf_deref_obj(pdf_get_array(contents, idx));
- if (!content_seg)
- break;
- else if (PDF_OBJ_NULLTYPE(content_seg)) {
- /* Silently ignore. */
- } else if (!PDF_OBJ_STREAMTYPE(content_seg)) {
- WARN("Page content not a stream object. Broken PDF file?");
- pdf_release_obj(content_seg);
- pdf_release_obj(content_new);
+ for (i = 0; i < pdf_array_length(contents); i++) {
+ content_seg = pdf_deref_obj(pdf_get_array(contents, i));
+ if (!content_seg) {
+ WARN("Could not read page content stream.");
+ pdf_release_obj(content_new);
pdf_release_obj(contents);
- return NULL;
- } else if (pdf_concat_stream(content_new, content_seg) < 0) {
- WARN("Could not handle content stream with multiple segments.");
+ return NULL;
+ }
+ if (PDF_OBJ_STREAMTYPE(content_seg)) {
+ pdf_concat_stream(content_new, content_seg);
+ } else if (!PDF_OBJ_NULLTYPE(content_seg)) {
+ WARN("Page content not a stream object. Broken PDF file?");
pdf_release_obj(content_seg);
- pdf_release_obj(content_new);
+ pdf_release_obj(content_new);
pdf_release_obj(contents);
- return NULL;
+ return NULL;
}
pdf_release_obj(content_seg);
- idx++;
}
pdf_release_obj(contents);
contents = content_new;
@@ -373,12 +100,7 @@
}
/* Flate the contents if necessary. */
content_new = pdf_new_stream(STREAM_COMPRESS);
- if (pdf_concat_stream(content_new, contents) < 0) {
- WARN("Could not handle a content stream.");
- pdf_release_obj(contents);
- pdf_release_obj(content_new);
- return NULL;
- }
+ pdf_concat_stream(content_new, contents);
pdf_release_obj(contents);
contents = content_new;
}
@@ -420,7 +142,7 @@
pdf_release_obj(markinfo);
if (!PDF_OBJ_BOOLEANTYPE(tmp)) {
if (tmp)
- pdf_release_obj(tmp);
+ pdf_release_obj(tmp);
goto error;
} else if (pdf_boolean_value(tmp)) {
WARN("PDF file is tagged... Ignoring tags.");
@@ -428,53 +150,13 @@
pdf_release_obj(tmp);
}
- contents = pdf_deref_obj(pdf_lookup_dict(page, "Contents"));
- pdf_release_obj(page);
- page = NULL;
-
/*
* Handle page content stream.
*/
- {
- pdf_obj *content_new;
+ contents = get_page_content(pf, page);
+ pdf_release_obj(page);
+ page = NULL;
- if (!contents) {
- /*
- * Empty page
- */
- content_new = pdf_new_stream(0);
- /* TODO: better don't include anything if the page is empty */
- } else if (PDF_OBJ_STREAMTYPE(contents)) {
- /*
- * We must import the stream because its dictionary
- * may contain indirect references.
- */
- content_new = pdf_import_object(contents);
- } else if (PDF_OBJ_ARRAYTYPE(contents)) {
- /*
- * Concatenate all content streams.
- */
- int idx, len = pdf_array_length(contents);
- content_new = pdf_new_stream(STREAM_COMPRESS);
- for (idx = 0; idx < len; idx++) {
- pdf_obj *content_seg = pdf_deref_obj(pdf_get_array(contents, idx));
- if (!PDF_OBJ_STREAMTYPE(content_seg) ||
- pdf_concat_stream(content_new, content_seg) < 0) {
- pdf_release_obj(content_seg);
- pdf_release_obj(content_new);
- goto error;
- }
- pdf_release_obj(content_seg);
- }
- } else {
- goto error;
- }
-
- if (contents)
- pdf_release_obj(contents);
- contents = content_new;
- }
-
/*
* Add entries to contents stream dictionary.
*/
@@ -604,13 +286,15 @@
int
pdf_copy_clip (FILE *image_file, int pageNo, double x_user, double y_user)
{
- pdf_obj *page_tree, *contents;
- int depth = 0, top = -1;
- const char *clip_path, *end_path;
- char *save_path, *temp;
- pdf_tmatrix M;
- double stack[6];
- pdf_file *pf;
+ pdf_obj *page_tree, *contents;
+ int depth = 0, top = -1;
+ const char *clip_path, *end_path;
+ char *save_path, *temp;
+ pdf_tmatrix M;
+ double stack[6];
+ pdf_rect bbox;
+ pdf_tmatrix mtrx;
+ pdf_file *pf;
pf = pdf_open(NULL, image_file);
if (!pf)
@@ -619,13 +303,13 @@
pdf_dev_currentmatrix(&M);
pdf_invertmatrix(&M);
M.e += x_user; M.f += y_user;
- page_tree = pdf_get_page_obj (pf, pageNo, NULL, NULL);
+
+ page_tree = pdf_doc_get_page(pf, pageNo, 0, &bbox, &mtrx, NULL);
if (!page_tree) {
pdf_close(pf);
return -1;
}
-
- contents = pdf_get_page_content(page_tree);
+ contents = get_page_content(pf, page_tree);
pdf_release_obj(page_tree);
if (!contents) {
pdf_close(pf);
@@ -634,7 +318,7 @@
pdf_doc_add_page_content(" ", 1);
- save_path = malloc(pdf_stream_length(contents) + 1);
+ save_path = NEW(pdf_stream_length(contents) + 1, char);
strncpy(save_path, (const char *) pdf_stream_dataptr(contents), pdf_stream_length(contents));
clip_path = save_path;
end_path = clip_path + pdf_stream_length(contents);
@@ -839,7 +523,7 @@
}
}
}
- free(save_path);
+ RELEASE(save_path);
pdf_release_obj(contents);
pdf_close(pf);
Modified: trunk/Build/source/texk/dvipdfm-x/fontmap.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/fontmap.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/fontmap.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -28,6 +28,7 @@
#include "mem.h"
#include "error.h"
+#include "dpxconf.h"
#include "dpxfile.h"
#include "dpxutil.h"
@@ -38,15 +39,7 @@
/* CIDFont */
static char *strip_options (const char *map_name, fontmap_opt *opt);
-static int verbose = 0;
void
-pdf_fontmap_set_verbose (void)
-{
- verbose++;
-}
-
-
-void
pdf_init_fontmap_record (fontmap_rec *mrec)
{
ASSERT(mrec);
@@ -737,7 +730,7 @@
return -1;
}
- if (verbose > 3)
+ if (dpx_conf.verbose_level > 3)
MESG("fontmap>> append key=\"%s\"...", kp);
fnt_name = chop_sfd_name(kp, &sfd_name);
@@ -777,7 +770,7 @@
}
ht_insert_table(fontmap, kp, strlen(kp), mrec);
}
- if (verbose > 3)
+ if (dpx_conf.verbose_level > 3)
MESG("\n");
return 0;
@@ -791,7 +784,7 @@
if (!kp)
return -1;
- if (verbose > 3)
+ if (dpx_conf.verbose_level > 3)
MESG("fontmap>> remove key=\"%s\"...", kp);
fnt_name = chop_sfd_name(kp, &sfd_name);
@@ -802,13 +795,13 @@
subfont_ids = sfd_get_subfont_ids(sfd_name, &n);
if (!subfont_ids)
return -1;
- if (verbose > 3)
+ if (dpx_conf.verbose_level > 3)
MESG("\nfontmap>> Expand @%s@:", sfd_name);
while (n-- > 0) {
tfm_name = make_subfont_name(kp, sfd_name, subfont_ids[n]);
if (!tfm_name)
continue;
- if (verbose > 3)
+ if (dpx_conf.verbose_level > 3)
MESG(" %s", tfm_name);
ht_remove_table(fontmap, tfm_name, strlen(tfm_name));
RELEASE(tfm_name);
@@ -819,7 +812,7 @@
ht_remove_table(fontmap, kp, strlen(kp));
- if (verbose > 3)
+ if (dpx_conf.verbose_level > 3)
MESG("\n");
return 0;
@@ -836,7 +829,7 @@
return NULL;
}
- if (verbose > 3)
+ if (dpx_conf.verbose_level > 3)
MESG("fontmap>> insert key=\"%s\"...", kp);
fnt_name = chop_sfd_name(kp, &sfd_name);
@@ -851,13 +844,13 @@
WARN("Could not open SFD file: %s", sfd_name);
return NULL;
}
- if (verbose > 3)
+ if (dpx_conf.verbose_level > 3)
MESG("\nfontmap>> Expand @%s@:", sfd_name);
while (n-- > 0) {
tfm_name = make_subfont_name(kp, sfd_name, subfont_ids[n]);
if (!tfm_name)
continue;
- if (verbose > 3)
+ if (dpx_conf.verbose_level > 3)
MESG(" %s", tfm_name);
mrec = NEW(1, fontmap_rec);
pdf_init_fontmap_record(mrec);
@@ -879,7 +872,7 @@
}
ht_insert_table(fontmap, kp, strlen(kp), mrec);
- if (verbose > 3)
+ if (dpx_conf.verbose_level > 3)
MESG("\n");
return mrec;
@@ -980,7 +973,7 @@
ASSERT(filename);
ASSERT(fontmap) ;
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("<FONTMAP:");
fp = DPXFOPEN(filename, DPX_RES_TYPE_FONTMAP); /* outputs path if verbose */
if (!fp) {
@@ -1038,7 +1031,7 @@
}
DPXFCLOSE(fp);
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG(">");
return error;
@@ -1057,7 +1050,7 @@
fontmap_key = malloc(strlen(path) + 40); // CHECK
sprintf(fontmap_key, "%s/%d/%c/%d/%d/%d", path, index, layout_dir == 0 ? 'H' : 'V', extend, slant, embolden);
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("<NATIVE-FONTMAP:%s", fontmap_key);
mrec = NEW(1, fontmap_rec);
@@ -1081,7 +1074,7 @@
pdf_clear_fontmap_record(mrec);
RELEASE(mrec);
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG(">");
return ret;
Modified: trunk/Build/source/texk/dvipdfm-x/fontmap.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/fontmap.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/fontmap.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -71,8 +71,6 @@
fontmap_opt opt;
} fontmap_rec;
-extern void pdf_fontmap_set_verbose (void);
-
extern void pdf_init_fontmaps (void);
#if 0
extern void pdf_clear_fontmaps (void);
Modified: trunk/Build/source/texk/dvipdfm-x/jp2image.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/jp2image.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/jp2image.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -36,7 +36,7 @@
#include "error.h"
#include "mem.h"
-#include "dvipdfmx.h"
+#include "dpxconf.h"
#include "pdfobj.h"
@@ -146,7 +146,7 @@
HR_D = get_unsigned_pair(fp);
VR_E = get_unsigned_byte(fp);
HR_E = get_unsigned_byte(fp);
- if (compat_mode)
+ if (dpx_conf.compat_mode == dpx_mode_compat_mode)
info->xdensity = info->ydensity = 72.0 / 100.0;
else {
info->xdensity = 72.0/(((double) HR_N / HR_D) * pow(10.0, HR_E) * 0.0254);
Modified: trunk/Build/source/texk/dvipdfm-x/jpegimage.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/jpegimage.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/jpegimage.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -59,7 +59,7 @@
#include "mfileio.h"
#include "numbers.h"
-#include "dvipdfmx.h"
+#include "dpxconf.h"
#include "pdfobj.h"
@@ -363,7 +363,7 @@
static void
jpeg_get_density (struct JPEG_info *j_info, double *xdensity, double *ydensity)
{
- if (compat_mode) {
+ if (dpx_conf.compat_mode == dpx_mode_compat_mode) {
*xdensity = *ydensity = 72.0 / 100.0;
return;
}
Modified: trunk/Build/source/texk/dvipdfm-x/mpost.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/mpost.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/mpost.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2007-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -33,6 +33,7 @@
#include "error.h"
#include "mfileio.h"
#include "numbers.h"
+#include "dpxconf.h"
#include "tfm.h"
@@ -58,7 +59,13 @@
*/
static double Xorigin, Yorigin;
+static int translate_origin = 0;
+void
+mps_set_translate_origin (int v) {
+ translate_origin = v;
+}
+
/*
* In PDF, current path is not a part of graphics state parameter.
* Hence, current path is not saved by the "q" operator and is not
Modified: trunk/Build/source/texk/dvipdfm-x/mpost.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/mpost.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/mpost.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -27,6 +27,8 @@
#include "pdfximage.h"
#include "pdfdev.h"
+extern void mps_set_translate_origin (int boolean_value);
+
extern int mps_scan_bbox (const char **pp, const char *endptr, pdf_rect *bbox);
/* returns xobj_id */
Modified: trunk/Build/source/texk/dvipdfm-x/pdfcolor.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfcolor.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfcolor.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -31,6 +31,7 @@
#include "mem.h"
#include "error.h"
+#include "dpxconf.h"
#include "dpxfile.h"
#include "pdfdoc.h"
@@ -38,13 +39,6 @@
#include "pdfcolor.h"
-static int verbose = 0;
-void
-pdf_color_set_verbose (void)
-{
- verbose++;
-}
-
/* This function returns PDF_COLORSPACE_TYPE_GRAY,
* PDF_COLORSPACE_TYPE_RGB, PDF_COLORSPACE_TYPE_CMYK or
* PDF_COLORSPACE_TYPE_SPOT.
@@ -1182,12 +1176,12 @@
cspc_id = pdf_colorspace_findresource(ident,
PDF_COLORSPACE_TYPE_ICCBASED, cdata);
if (cspc_id >= 0) {
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("(ICCP:[id=%d])", cspc_id);
release_iccbased_cdata(cdata);
return cspc_id;
}
- if (verbose > 1) {
+ if (dpx_conf.verbose_level > 1) {
print_iccp_header(&icch, checksum);
}
@@ -1354,13 +1348,13 @@
cspc_id = pdf_colorspace_findresource(ident,
PDF_COLORSPACE_TYPE_ICCBASED, cdata);
if (cspc_id >= 0) {
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("(ICCP:[id=%d])", cspc_id);
release_iccbased_cdata(cdata);
pdf_release_obj(stream);
return cspc_id;
}
- if (verbose > 1) {
+ if (dpx_conf.verbose_level > 1) {
print_iccp_header(&icch, checksum);
}
@@ -1506,9 +1500,9 @@
colorspace->cdata = cdata;
colorspace->resource = resource;
- if (verbose) {
+ if (dpx_conf.verbose_level > 0) {
MESG("(ColorSpace:%s", ident);
- if (verbose > 1) {
+ if (dpx_conf.verbose_level > 1) {
switch (subtype) {
case PDF_COLORSPACE_TYPE_ICCBASED:
MESG("[ICCBased]");
Modified: trunk/Build/source/texk/dvipdfm-x/pdfcolor.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfcolor.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfcolor.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -49,8 +49,6 @@
double values[PDF_COLOR_COMPONENT_MAX];
} pdf_color;
-extern void pdf_color_set_verbose (void);
-
extern int pdf_color_rgbcolor (pdf_color *color,
double r, double g, double b);
extern int pdf_color_cmykcolor (pdf_color *color,
Modified: trunk/Build/source/texk/dvipdfm-x/pdfdev.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfdev.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfdev.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -31,6 +31,7 @@
#include "system.h"
#include "mem.h"
#include "error.h"
+#include "dpxconf.h"
#include "mfileio.h"
#include "numbers.h"
@@ -52,14 +53,6 @@
#include "pdfdev.h"
-static int verbose = 0;
-
-void
-pdf_dev_set_verbose (void)
-{
- verbose++;
-}
-
/* Not working yet... */
double
pdf_dev_scale (void)
@@ -1469,7 +1462,7 @@
/* New font */
mrec = pdf_lookup_fontmap_record(font_name);
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
print_fontmap(font_name, mrec);
font->font_id = pdf_font_findresource(font_name, ptsize * dev_unit.dvi2pts, mrec);
Modified: trunk/Build/source/texk/dvipdfm-x/pdfdev.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfdev.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfdev.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -71,9 +71,6 @@
#define INFO_DO_HIDE (1 << 4)
extern void transform_info_clear (transform_info *info);
-
-extern void pdf_dev_set_verbose (void);
-
/* Not in spt_t. */
extern int pdf_sprint_matrix (char *buf, const pdf_tmatrix *p);
extern int pdf_sprint_rect (char *buf, const pdf_rect *p);
Modified: trunk/Build/source/texk/dvipdfm-x/pdfdoc.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfdoc.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfdoc.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -35,6 +35,7 @@
#include "mem.h"
#include "error.h"
#include "mfileio.h"
+#include "dpxconf.h"
#include "numbers.h"
@@ -67,8 +68,6 @@
#define PDFDOC_ARTICLE_ALLOC_SIZE 16
#define PDFDOC_BEAD_ALLOC_SIZE 16
-static int verbose = 0;
-
static char manual_thumb_enabled = 0;
static char *thumb_basename = NULL;
@@ -113,14 +112,6 @@
return image_ref;
}
-void
-pdf_doc_set_verbose (void)
-{
- verbose++;
- pdf_font_set_verbose();
- pdf_color_set_verbose();
- pdf_ximage_set_verbose();
-}
typedef struct pdf_form
{
@@ -922,7 +913,7 @@
}
static int
-set_bounding_box (pdf_rect *bbox, int option,
+set_bounding_box (pdf_rect *bbox, enum pdf_page_boundary opt_bbox,
pdf_obj *media_box, pdf_obj *crop_box,
pdf_obj *art_box, pdf_obj *trim_box, pdf_obj *bleed_box)
{
@@ -942,7 +933,7 @@
VALIDATE_BOX(trim_box);
VALIDATE_BOX(bleed_box);
- if (option == 0) {
+ if (opt_bbox == pdf_page_boundary__auto) {
if (crop_box)
box = pdf_link_obj(crop_box);
else if (art_box)
@@ -968,20 +959,20 @@
bleed_box = pdf_link_obj(crop_box);
}
/* At this point all boxes must be defined. */
- switch (option) {
- case 1: /* crop box */
+ switch (opt_bbox) {
+ case pdf_page_boundary_cropbox:
box = pdf_link_obj(crop_box);
break;
- case 2: /* mdeia box */
+ case pdf_page_boundary_mediabox:
box = pdf_link_obj(media_box);
break;
- case 3: /* art box */
+ case pdf_page_boundary_artbox:
box = pdf_link_obj(art_box);
break;
- case 4: /* trim box */
+ case pdf_page_boundary_trimbox:
box = pdf_link_obj(trim_box);
break;
- case 5: /* bleen box */
+ case pdf_page_boundary_bleedbox:
box = pdf_link_obj(bleed_box);
break;
default:
@@ -1016,7 +1007,8 @@
}
/* New scheme only for XDV files */
- if (is_xdv || option) {
+ if (dpx_conf.compat_mode == dpx_mode_xdv_mode ||
+ opt_bbox != pdf_page_boundary__auto) {
for (i = 4; i--; ) {
double x;
pdf_obj *tmp = pdf_deref_obj(pdf_get_array(media_box, i));
@@ -1155,7 +1147,7 @@
*/
pdf_obj *
pdf_doc_get_page (pdf_file *pf,
- int page_no, int options, /* load options */
+ int page_no, enum pdf_page_boundary opt_bbox, /* load options */
pdf_rect *bbox, pdf_tmatrix *matrix, /* returned value */
pdf_obj **resources_p /* returned values */
) {
@@ -1279,7 +1271,7 @@
*resources_p = pdf_link_obj(resources);
/* Select page boundary box */
- error = set_bounding_box(bbox, options, media_box, crop_box, art_box, trim_box, bleed_box);
+ error = set_bounding_box(bbox, opt_bbox, media_box, crop_box, art_box, trim_box, bleed_box);
if (error)
goto error_exit;
/* Set transformation matrix */
@@ -1801,7 +1793,7 @@
else {
name_tree = pdf_names_create_tree(data, &count, &pdoc.gotos);
- if (verbose && count < data->count)
+ if (dpx_conf.verbose_level > 0 && count < data->count)
MESG("\nRemoved %ld unused PDF destinations\n", data->count-count);
if (count < pdoc.gotos.count)
Modified: trunk/Build/source/texk/dvipdfm-x/pdfdoc.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfdoc.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfdoc.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2007-2017 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -26,10 +26,17 @@
#include "pdfobj.h"
#include "pdfdev.h"
+enum pdf_page_boundary {
+ pdf_page_boundary__auto = 0,
+ pdf_page_boundary_mediabox,
+ pdf_page_boundary_cropbox,
+ pdf_page_boundary_artbox,
+ pdf_page_boundary_trimbox,
+ pdf_page_boundary_bleedbox
+};
+
#define PDF_DOC_GRABBING_NEST_MAX 4
-extern void pdf_doc_set_verbose (void);
-
extern void pdf_open_document (const char *filename,
int enable_encrypt,
int enable_objstm,
@@ -57,7 +64,7 @@
#define pdf_doc_this_page() pdf_doc_get_dictionary("@THISPAGE")
extern int pdf_doc_get_page_count (pdf_file *pf);
-extern pdf_obj *pdf_doc_get_page (pdf_file *pf, int page_no, int options,
+extern pdf_obj *pdf_doc_get_page (pdf_file *pf, int page_no, enum pdf_page_boundary opt_bbox,
pdf_rect *bbox, pdf_tmatrix *matrix, pdf_obj **resources_p);
extern int pdf_doc_current_page_number (void);
Modified: trunk/Build/source/texk/dvipdfm-x/pdfdraw.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfdraw.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfdraw.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2017 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -30,6 +30,7 @@
#include "error.h"
#include "mem.h"
#include "mfileio.h"
+#include "dpxconf.h"
#include "dpxutil.h"
#include "numbers.h"
Modified: trunk/Build/source/texk/dvipdfm-x/pdfencoding.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfencoding.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfencoding.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -29,6 +29,7 @@
#include "system.h"
#include "mem.h"
#include "error.h"
+#include "dpxconf.h"
#include "dpxutil.h"
#include "pdfparse.h"
@@ -42,8 +43,6 @@
static pdf_obj *make_encoding_differences (char **encoding, char **baseenc,
const char *is_used);
-static unsigned char verbose = 0;
-
static const char *MacRomanEncoding[256];
static const char *MacExpertEncoding[256];
static const char *WinAnsiEncoding[256];
@@ -52,12 +51,6 @@
static const char *ISOLatin1Encoding[256];
#endif
-void
-pdf_encoding_set_verbose (void)
-{
- verbose++;
-}
-
/*
* ident: File name, e.g., 8a.enc.
* name: Name of encoding, StandardEncoding, TeXBase1Encoding, ...
@@ -291,7 +284,7 @@
if (!filename)
return -1;
- if (verbose) {
+ if (dpx_conf.verbose_level > 0) {
MESG("(Encoding:%s", filename);
}
@@ -340,13 +333,13 @@
filename, enc_vec, NULL, 0);
if (enc_name) {
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
MESG("[%s]", pdf_name_value(enc_name));
pdf_release_obj(enc_name);
}
pdf_release_obj(encoding_array);
- if (verbose) MESG(")");
+ if (dpx_conf.verbose_level > 0) MESG(")");
return enc_id;
}
@@ -689,7 +682,7 @@
}
if (total_fail > 0) {
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
WARN("Glyphs with no Unicode mapping found. Removing ToUnicode CMap.");
}
stream = total_fail > 0 ? NULL : CMap_create_stream(cmap);
@@ -723,7 +716,7 @@
if (CMap_parse(cmap, fp) < 0) {
WARN("Reading CMap file \"%s\" failed.", ident);
} else {
- if (verbose) {
+ if (dpx_conf.verbose_level > 0) {
MESG("(CMap:%s)", ident);
}
stream = CMap_create_stream(cmap);
Modified: trunk/Build/source/texk/dvipdfm-x/pdfencoding.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfencoding.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfencoding.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2007-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -25,8 +25,6 @@
#include "pdfobj.h"
-extern void pdf_encoding_set_verbose (void);
-
extern void pdf_init_encodings (void);
extern void pdf_close_encodings (void);
Modified: trunk/Build/source/texk/dvipdfm-x/pdfencrypt.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfencrypt.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfencrypt.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -27,17 +27,11 @@
#include <string.h>
#include <time.h>
-#ifdef WIN32
-#include <conio.h>
-#define getch _getch
-#else /* !WIN32 */
-#include <unistd.h>
-#endif /* WIN32 */
-
#include "system.h"
#include "mem.h"
#include "numbers.h"
#include "error.h"
+#include "dpxconf.h"
#include "pdfobj.h"
#include "unicode.h"
#include "dpxcrypt.h"
@@ -88,13 +82,6 @@
0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a
};
-static unsigned char verbose = 0;
-
-void pdf_enc_set_verbose (void)
-{
- if (verbose < 255) verbose++;
-}
-
static void
pdf_enc_init (int use_aes, int encrypt_metadata)
{
@@ -439,29 +426,6 @@
RELEASE(UE);
}
-#ifdef WIN32
-/* Broken on mintty? */
-static char *
-getpass (const char *prompt)
-{
- static char pwd_buf[128];
- size_t i;
-
- fputs(prompt, stderr);
- fflush(stderr);
- for (i = 0; i < sizeof(pwd_buf)-1; i++) {
- pwd_buf[i] = getch();
- if (pwd_buf[i] == '\r' || pwd_buf[i] == '\n')
- break;
- fputs("*", stderr);
- fflush(stderr);
- }
- pwd_buf[i] = '\0';
- fputs("\n", stderr);
- return pwd_buf;
-}
-#endif
-
static void
check_version (struct pdf_sec *p, int version)
{
@@ -558,9 +522,9 @@
const char *oplain, const char *uplain)
{
struct pdf_sec *p = &sec_data;
- char input[128], opasswd[128], upasswd[128];
- char *retry_passwd;
+ char opasswd[128], upasswd[128];
int version;
+ char empty_passwd[1] = "\0";
version = pdf_get_version();
@@ -612,31 +576,13 @@
if (preproc_password(oplain, opasswd, p->V) < 0)
WARN("Invaid UTF-8 string for password.");
} else {
- while (1) {
- strncpy(input, getpass("Owner password: "), MAX_PWD_LEN);
- retry_passwd = getpass("Re-enter owner password: ");
- if (!strncmp(input, retry_passwd, MAX_PWD_LEN))
- break;
- fputs("Password is not identical.\nTry again.\n", stderr);
- fflush(stderr);
- }
- if (preproc_password(input, opasswd, p->V) < 0)
- WARN("Invaid UTF-8 string for password.");
+ preproc_password(empty_passwd, opasswd, p->V);
}
if (uplain) {
if (preproc_password(uplain, upasswd, p->V) < 0)
WARN("Invalid UTF-8 string for passowrd.");
} else {
- while (1) {
- strncpy(input, getpass("User password: "), MAX_PWD_LEN);
- retry_passwd = getpass("Re-enter user password: ");
- if (!strncmp(input, retry_passwd, MAX_PWD_LEN))
- break;
- fputs("Password is not identical.\nTry again.\n", stderr);
- fflush(stderr);
- }
- if (preproc_password(input, upasswd, p->V) < 0)
- WARN("Invaid UTF-8 string for password.");
+ preproc_password(empty_passwd, upasswd, p->V);
}
if (p->R >= 3)
Modified: trunk/Build/source/texk/dvipdfm-x/pdfencrypt.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfencrypt.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfencrypt.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -2,7 +2,7 @@
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2007-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
This program is free software; you can redistribute it and/or modify
@@ -27,7 +27,6 @@
#define MAX_PWD_LEN 127
-extern void pdf_enc_set_verbose (void);
extern pdf_obj *pdf_enc_id_array (void);
extern void pdf_enc_compute_id_string (char *dviname, char *pdfname);
extern void pdf_enc_set_label (unsigned label);
Modified: trunk/Build/source/texk/dvipdfm-x/pdffont.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdffont.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdffont.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -31,6 +31,7 @@
#include "error.h"
#include "mem.h"
+#include "dpxconf.h"
#include "dpxfile.h"
#include "dpxutil.h"
@@ -53,29 +54,9 @@
#include "pdffont.h"
-static int __verbose = 0;
-
#define MREC_HAS_TOUNICODE(m) ((m) && (m)->opt.tounicode)
void
-pdf_font_set_verbose (void)
-{
- __verbose++;
- CMap_set_verbose();
- Type0Font_set_verbose();
- CIDFont_set_verbose ();
- pdf_encoding_set_verbose();
- agl_set_verbose();
- otf_cmap_set_verbose ();
-}
-
-int
-pdf_font_get_verbose (void)
-{
- return __verbose;
-}
-
-void
pdf_font_set_dpi (int font_dpi)
{
PKFont_set_dpi(font_dpi);
@@ -469,7 +450,7 @@
pdf_add_dict(fontdict,
pdf_new_name("ToUnicode"),
pdf_ref_obj (tounicode)); /* _FIXME_ */
- if (__verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("pdf_font>> ToUnicode CMap \"%s\" attached to font id=\"%s\".\n",
cmap_name, font->map_name);
}
@@ -490,18 +471,18 @@
font = GET_FONT(font_id);
- if (__verbose) {
+ if (dpx_conf.verbose_level > 0) {
if (font->subtype != PDF_FONT_FONTTYPE_TYPE0) {
MESG("(%s", pdf_font_get_ident(font));
- if (__verbose > 2 &&
+ if (dpx_conf.verbose_level > 2 &&
!pdf_font_get_flag(font, PDF_FONT_FLAG_NOEMBED)) {
MESG("[%s+%s]",
pdf_font_get_uniqueTag(font),
pdf_font_get_fontname(font));
- } else if (__verbose > 1) {
+ } else if (dpx_conf.verbose_level > 1) {
MESG("[%s]", pdf_font_get_fontname(font));
}
- if (__verbose > 1) {
+ if (dpx_conf.verbose_level > 1) {
if (pdf_font_get_encoding(font) >= 0) {
MESG("[%s]", pdf_encoding_get_name(pdf_font_get_encoding(font)));
} else {
@@ -517,23 +498,23 @@
/* Type 0 is handled separately... */
switch (font->subtype) {
case PDF_FONT_FONTTYPE_TYPE1:
- if (__verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("[Type1]");
if (!pdf_font_get_flag(font, PDF_FONT_FLAG_BASEFONT))
pdf_font_load_type1(font);
break;
case PDF_FONT_FONTTYPE_TYPE1C:
- if (__verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("[Type1C]");
pdf_font_load_type1c(font);
break;
case PDF_FONT_FONTTYPE_TRUETYPE:
- if (__verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("[TrueType]");
pdf_font_load_truetype(font);
break;
case PDF_FONT_FONTTYPE_TYPE3:
- if (__verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("[Type3/PK]");
pdf_font_load_pkfont (font);
break;
@@ -547,7 +528,7 @@
if (font->encoding_id >= 0 && font->subtype != PDF_FONT_FONTTYPE_TYPE0)
pdf_encoding_add_usedchars(font->encoding_id, font->usedchars);
- if (__verbose) {
+ if (dpx_conf.verbose_level > 0) {
if (font->subtype != PDF_FONT_FONTTYPE_TYPE0)
MESG(")");
}
@@ -668,7 +649,7 @@
* Turn on map option.
*/
if (minbytes == 2 && mrec->opt.mapc < 0) {
- if (__verbose) {
+ if (dpx_conf.verbose_level > 0) {
MESG("\n");
MESG("pdf_font>> Input encoding \"%s\" requires at least 2 bytes.\n",
CMap_get_name(cmap));
@@ -713,7 +694,7 @@
font->font_id == type0_id &&
font->encoding_id == cmap_id) {
found = 1;
- if (__verbose) {
+ if (dpx_conf.verbose_level > 0) {
MESG("\npdf_font>> Type0 font \"%s\" (cmap_id=%d) found at font_id=%d.\n",
mrec->font_name, cmap_id, font_id);
}
@@ -736,7 +717,7 @@
font_cache.count++;
- if (__verbose) {
+ if (dpx_conf.verbose_level > 0) {
MESG("\npdf_font>> Type0 font \"%s\"", fontname);
MESG(" cmap_id=<%s,%d>", mrec->enc_name, font->encoding_id);
MESG(" opened at font_id=<%s,%d>.\n", tex_name, font_id);
@@ -787,7 +768,7 @@
}
if (found) {
- if (__verbose) {
+ if (dpx_conf.verbose_level > 0) {
MESG("\npdf_font>> Simple font \"%s\" (enc_id=%d) found at id=%d.\n",
fontname, encoding_id, font_id);
}
@@ -830,7 +811,7 @@
font_cache.count++;
- if (__verbose) {
+ if (dpx_conf.verbose_level > 0) {
MESG("\npdf_font>> Simple font \"%s\"", fontname);
MESG(" enc_id=<%s,%d>",
(mrec && mrec->enc_name) ? mrec->enc_name : "builtin", font->encoding_id);
Modified: trunk/Build/source/texk/dvipdfm-x/pdffont.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdffont.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdffont.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -34,9 +34,6 @@
#define PDF_FONT_FONTTYPE_TYPE0 4
-extern void pdf_font_set_verbose (void);
-extern int pdf_font_get_verbose (void);
-
extern void pdf_font_set_dpi (int font_dpi);
#define PDF_FONT_FLAG_NOEMBED (1 << 0)
Modified: trunk/Build/source/texk/dvipdfm-x/pdfobj.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfobj.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfobj.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -33,6 +33,7 @@
#include "mem.h"
#include "error.h"
#include "mfileio.h"
+#include "dpxconf.h"
#include "dpxutil.h"
#include "pdflimits.h"
#include "pdfencrypt.h"
@@ -250,7 +251,6 @@
static void write_stream (pdf_stream *stream, FILE *file);
static void release_stream (pdf_stream *stream);
-static int verbose = 0;
static char compression_level = 9;
static char compression_use_predictor = 1;
@@ -274,6 +274,12 @@
return;
}
+FILE *
+pdf_get_output_file (void)
+{
+ return pdf_output_file;
+}
+
void
pdf_set_use_predictor (int bval)
{
@@ -315,18 +321,6 @@
return (pdf_version >= major*10+minor) ? 0 : -1;
}
-int
-pdf_obj_get_verbose(void)
-{
- return verbose;
-}
-
-void
-pdf_obj_set_verbose(void)
-{
- verbose++;
-}
-
static pdf_obj *current_objstm = NULL;
static int do_objstm;
@@ -537,7 +531,7 @@
#if !defined(LIBDPX)
MESG("\n");
#endif /* !LIBDPX */
- if (verbose) {
+ if (dpx_conf.verbose_level > 0) {
if (compression_level > 0) {
MESG("Compression saved %ld bytes%s\n", compression_saved,
pdf_version < 15 ? ". Try \"-V 1.5\" for better compression" : "");
@@ -548,6 +542,7 @@
#endif /* !LIBDPX */
MFCLOSE(pdf_output_file);
+ pdf_output_file = NULL;
}
#if defined(PDFOBJ_DEBUG)
{
@@ -579,6 +574,7 @@
*/
if (pdf_output_file)
MFCLOSE(pdf_output_file);
+ pdf_output_file = NULL;
}
Modified: trunk/Build/source/texk/dvipdfm-x/pdfobj.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfobj.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfobj.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -51,11 +51,10 @@
typedef struct pdf_file pdf_file;
/* External interface to pdf routines */
-
-extern int pdf_obj_get_verbose (void);
-extern void pdf_obj_set_verbose (void);
extern void pdf_error_cleanup (void);
+extern FILE *pdf_get_output_file (void);
+
extern void pdf_out_init (const char *filename,
int enable_encrypt, int enable_objstm);
extern void pdf_out_flush (void);
Modified: trunk/Build/source/texk/dvipdfm-x/pdfximage.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfximage.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfximage.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -28,6 +28,7 @@
#include "error.h"
#include "mem.h"
+#include "dpxconf.h"
#include "dpxfile.h"
#include "dpxutil.h"
@@ -95,17 +96,13 @@
/* verbose, verbose, verbose... */
struct opt_
{
- int verbose;
char *cmdtmpl;
};
static struct opt_ _opts = {
- 0, NULL
+ NULL
};
-void pdf_ximage_set_verbose (void) { _opts.verbose++; }
-
-
struct ic_
{
int count, capacity;
@@ -193,7 +190,8 @@
* We also use this to convert a PS file only once if multiple
* pages are imported from that file.
*/
- if (_opts.verbose > 1 && keep_cache != 1)
+ if (dpx_conf.verbose_level > 1 &&
+ dpx_conf.file.keep_cache != 1)
MESG("pdf_image>> deleting temporary file \"%s\"\n", I->filename);
dpx_delete_temp_file(I->filename, false); /* temporary filename freed here */
I->filename = NULL;
@@ -282,7 +280,7 @@
switch (format) {
case IMAGE_TYPE_JPEG:
- if (_opts.verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("[JPEG]");
if (jpeg_include_image(I, fp) < 0)
goto error;
@@ -289,7 +287,7 @@
I->subtype = PDF_XOBJECT_TYPE_IMAGE;
break;
case IMAGE_TYPE_JP2:
- if (_opts.verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("[JP2]");
if (jp2_include_image(I, fp) < 0)
goto error;
@@ -297,7 +295,7 @@
break;
#ifdef HAVE_LIBPNG
case IMAGE_TYPE_PNG:
- if (_opts.verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("[PNG]");
if (png_include_image(I, fp) < 0)
goto error;
@@ -305,7 +303,7 @@
break;
#endif
case IMAGE_TYPE_BMP:
- if (_opts.verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("[BMP]");
if (bmp_include_image(I, fp) < 0)
goto error;
@@ -312,7 +310,7 @@
I->subtype = PDF_XOBJECT_TYPE_IMAGE;
break;
case IMAGE_TYPE_PDF:
- if (_opts.verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("[PDF]");
{
int result = pdf_include_page(I, fp, fullname, options);
@@ -322,7 +320,7 @@
if (result < 0)
goto error;
}
- if (_opts.verbose)
+ if (dpx_conf.verbose_level > 0)
MESG(",Page:%ld", I->attr.page_no);
I->subtype = PDF_XOBJECT_TYPE_FORM;
break;
@@ -330,11 +328,11 @@
case IMAGE_TYPE_EPS:
*/
default:
- if (_opts.verbose)
+ if (dpx_conf.verbose_level > 0)
MESG(format == IMAGE_TYPE_EPS ? "[PS]" : "[UNKNOWN]");
if (ps_include_page(I, fullname, options) < 0)
goto error;
- if (_opts.verbose)
+ if (dpx_conf.verbose_level > 0)
MESG(",Page:%ld", I->attr.page_no);
I->subtype = PDF_XOBJECT_TYPE_FORM;
}
@@ -409,9 +407,9 @@
RELEASE(fullname);
return -1;
}
- if (_opts.verbose) {
+ if (dpx_conf.verbose_level > 0) {
MESG("(Image:%s", ident);
- if (_opts.verbose > 1)
+ if (dpx_conf.verbose_level > 1)
MESG("[%s]", fullname);
}
@@ -418,7 +416,7 @@
format = source_image_type(fp);
switch (format) {
case IMAGE_TYPE_MPS:
- if (_opts.verbose)
+ if (dpx_conf.verbose_level > 0)
MESG("[MPS]");
id = mps_include_page(ident, fp);
if (id < 0) {
@@ -435,7 +433,7 @@
RELEASE(fullname);
- if (_opts.verbose)
+ if (dpx_conf.verbose_level > 0)
MESG(")");
if (id < 0)
@@ -947,14 +945,15 @@
}
#endif
- if (keep_cache != -1 && stat(temp, &stat_t)==0 && stat(filename, &stat_o)==0
- && stat_t.st_mtime > stat_o.st_mtime) {
+ if (dpx_conf.file.keep_cache != -1 &&
+ stat(temp, &stat_t)==0 && stat(filename, &stat_o)==0 &&
+ stat_t.st_mtime > stat_o.st_mtime) {
/* cache exist */
/*printf("\nLast file modification: %s", ctime(&stat_o.st_mtime));
printf("Last file modification: %s", ctime(&stat_t.st_mtime));*/
;
} else {
- if (_opts.verbose > 1) {
+ if (dpx_conf.verbose_level > 1) {
MESG("\n");
MESG("pdf_image>> Converting file \"%s\" --> \"%s\" via:\n", filename, temp);
MESG("pdf_image>> %s\n", distiller_template);
Modified: trunk/Build/source/texk/dvipdfm-x/pdfximage.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfximage.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pdfximage.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2007-2017 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -24,6 +24,7 @@
#define _PDFXIMAGE_H_
#include "pdfdev.h"
+#include "pdfdoc.h"
#define PDF_XOBJECT_TYPE_FORM 0
#define PDF_XOBJECT_TYPE_IMAGE 1
@@ -50,15 +51,13 @@
} xform_info;
typedef struct {
- int page_no;
- int bbox_type;
+ int page_no;
+ enum pdf_page_boundary bbox_type;
pdf_obj *dict;
} load_options;
typedef struct pdf_ximage_ pdf_ximage;
-extern void pdf_ximage_set_verbose (void);
-
extern void pdf_init_images (void);
extern void pdf_close_images (void);
Modified: trunk/Build/source/texk/dvipdfm-x/pngimage.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pngimage.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/pngimage.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -41,7 +41,7 @@
#include "error.h"
#include "mem.h"
-#include "dvipdfmx.h"
+#include "dpxconf.h"
#include "pdfcolor.h"
#include "pdfobj.h"
@@ -219,7 +219,7 @@
info.height = height;
info.bits_per_component = bpc;
- if (compat_mode)
+ if (dpx_conf.compat_mode == dpx_mode_compat_mode)
info.xdensity = info.ydensity = 72.0 / 100.0;
else
{
@@ -1120,7 +1120,7 @@
*width = png_get_image_width (png_ptr, png_info_ptr);
*height = png_get_image_height(png_ptr, png_info_ptr);
- if (compat_mode)
+ if (dpx_conf.compat_mode == dpx_mode_compat_mode)
*xdensity = *ydensity = 72.0 / 100.0;
else
{
Modified: trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -36,6 +36,7 @@
#include "fontmap.h"
#include "dpxfile.h"
#include "dpxutil.h"
+#include "dpxconf.h"
#include "unicode.h"
@@ -553,7 +554,7 @@
CMap *cmap = CMap_cache_get(cd->cmap_id);
if (needreencode(kp, vp, cd))
r = reencodestring(cmap, vp);
- } else if (is_xdv && cd && cd->taintkeys) {
+ } else if ((dpx_conf.compat_mode == dpx_mode_xdv_mode) && cd && cd->taintkeys) {
/* Please fix this... PDF string object is not always a text string.
* needreencode() is assumed to do a simple check if given string
* object is actually a text string.
@@ -581,7 +582,7 @@
pdf_obj *dict;
/* disable this test for XDV files, as we do UTF8 reencoding with no cmap */
- if (!is_xdv && cd->cmap_id < 0)
+ if ((dpx_conf.compat_mode != dpx_mode_xdv_mode) && cd->cmap_id < 0)
return parse_pdf_dict(pp, endptr, NULL);
/* :( */
@@ -1077,7 +1078,7 @@
pdf_dev_put_image(xobj_id, &ti, spe->x_user, spe->y_user);
if (ident) {
- if (compat_mode &&
+ if ((dpx_conf.compat_mode == dpx_mode_compat_mode) &&
pdf_ximage_get_subtype(xobj_id) == PDF_XOBJECT_TYPE_IMAGE)
pdf_ximage_set_attr(xobj_id, 1, 1, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0);
addresource(sd, ident, xobj_id);
@@ -1108,7 +1109,7 @@
}
#if 0
- if (is_xdv && maybe_reencode_utf8(name) < 0)
+ if ((dpx_conf.compat_mode == dpx_mode_xdv_mode) && maybe_reencode_utf8(name) < 0)
WARN("Failed to convert input string to UTF16...");
#endif
Modified: trunk/Build/source/texk/dvipdfm-x/spc_util.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/spc_util.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/spc_util.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2007-2017 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -29,6 +29,7 @@
#include "error.h"
#include "dpxutil.h"
+#include "pdfdoc.h"
#include "pdfdev.h"
#include "pdfparse.h"
#include "pdfcolor.h"
@@ -718,7 +719,8 @@
int
spc_util_read_blahblah (struct spc_env *spe,
- transform_info *p, int *page_no, int *bbox_type,
+ transform_info *p, int *page_no,
+ enum pdf_page_boundary *bbox_type,
struct spc_arg *ap)
{
int has_scale, has_xscale, has_yscale, has_rotate, has_matrix;
@@ -864,15 +866,15 @@
q = parse_c_ident (&ap->curptr, ap->endptr);
if (q) {
if (bbox_type) {
- if (strcasecmp(q, "cropbox") == 0) *bbox_type = 1;
- else if (strcasecmp(q, "mediabox") == 0) *bbox_type = 2;
- else if (strcasecmp(q, "artbox") == 0) *bbox_type = 3;
- else if (strcasecmp(q, "trimbox") == 0) *bbox_type = 4;
- else if (strcasecmp(q, "bleedbox") == 0) *bbox_type = 5;
+ if (strcasecmp(q, "cropbox") == 0) *bbox_type = pdf_page_boundary_cropbox;
+ else if (strcasecmp(q, "mediabox") == 0) *bbox_type = pdf_page_boundary_mediabox;
+ else if (strcasecmp(q, "artbox") == 0) *bbox_type = pdf_page_boundary_artbox;
+ else if (strcasecmp(q, "trimbox") == 0) *bbox_type = pdf_page_boundary_trimbox;
+ else if (strcasecmp(q, "bleedbox") == 0) *bbox_type = pdf_page_boundary_bleedbox;
}
RELEASE(q);
} else if (bbox_type) {
- *bbox_type = 0;
+ *bbox_type = pdf_page_boundary__auto;
}
}
break;
Modified: trunk/Build/source/texk/dvipdfm-x/spc_util.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/spc_util.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/spc_util.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -25,6 +25,7 @@
#include "pdfcolor.h"
#include "pdfdev.h"
+#include "pdfdoc.h"
#include "specials.h"
@@ -41,9 +42,9 @@
struct spc_arg *args, int syntax);
extern int spc_util_read_blahblah (struct spc_env *spe,
- transform_info *dimtrns,
- int *page_no,
- int *bbox_type,
+ transform_info *dimtrns,
+ int *page_no,
+ enum pdf_page_boundary *bbox_type,
struct spc_arg *args);
Modified: trunk/Build/source/texk/dvipdfm-x/specials.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/specials.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/specials.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -30,6 +30,7 @@
#include "mem.h"
#include "error.h"
#include "numbers.h"
+#include "dpxconf.h"
#include "dvi.h"
@@ -52,15 +53,7 @@
#include "specials.h"
-static int verbose = 0;
void
-spc_set_verbose (void)
-{
- verbose++;
-}
-
-
-void
spc_warn (struct spc_env *spe, const char *fmt, ...)
{
va_list ap;
@@ -571,7 +564,8 @@
struct spc_arg args;
struct spc_handler special;
- if (verbose > 3) {
+ if (dpx_conf.verbose_level > 3) {
+ MESG("Executing special command: ");
dump(buffer, buffer + size);
}
Modified: trunk/Build/source/texk/dvipdfm-x/specials.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/specials.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/specials.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2007-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -44,8 +44,6 @@
spc_handler_fn_ptr exec;
};
-/* This should not use pdf_. */
-extern void spc_set_verbose (void);
#include <stdarg.h>
extern void spc_warn (struct spc_env *spe, const char *fmt, ...);
Modified: trunk/Build/source/texk/dvipdfm-x/subfont.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/subfont.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/subfont.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
This program is free software; you can redistribute it and/or modify
@@ -27,17 +27,11 @@
#include "system.h"
#include "mem.h"
#include "error.h"
+#include "dpxconf.h"
#include "dpxfile.h"
#include "subfont.h"
-static int verbose = 0;
-void
-subfont_set_verbose (void)
-{
- verbose++;
-}
-
/* Don't forget fontmap reading now requires information
* from SFD files. You must initialize at least sfd_file_
* cache before starting loading of fontmaps.
@@ -249,7 +243,7 @@
ASSERT( sfd && fp );
- if (verbose > 3) {
+ if (dpx_conf.verbose_level > 3) {
MESG("\nsubfont>> Scanning SFD file \"%s\"...\n", sfd->ident);
}
@@ -270,7 +264,7 @@
sfd->sub_id = RENEW(sfd->sub_id, sfd->max_subfonts, char *);
}
- if (verbose > 3) {
+ if (dpx_conf.verbose_level > 3) {
MESG("subfont>> id=\"%s\" at line=\"%d\"\n", id, lpos);
}
sfd->sub_id[sfd->num_subfonts] = id;
@@ -282,7 +276,7 @@
sfd->rec_id[n] = -1; /* Not loaded yet. We do lazy loading of map definitions. */
}
- if (verbose > 3) {
+ if (dpx_conf.verbose_level > 3) {
MESG("subfont>> %d entries found in SFD file \"%s\".\n", sfd->num_subfonts, sfd->ident);
}
@@ -386,7 +380,7 @@
return sfd->rec_id[i];
}
- if (verbose > 3) {
+ if (dpx_conf.verbose_level > 3) {
MESG("\nsubfont>> Loading SFD mapping table for <%s,%s>...",
sfd->ident, subfont_id);
}
@@ -429,7 +423,7 @@
sfd->rec_id[i] = rec_id;
DPXFCLOSE(fp);
- if (verbose > 3) {
+ if (dpx_conf.verbose_level > 3) {
int __i;
if (rec_id >= 0) {
MESG(" at id=\"%d\"", rec_id);
@@ -515,7 +509,7 @@
#ifdef HAVE_ICONV
r = iconv(cd, &p, &inbufleft, &q, &outbufleft);
if (r == -1) {
- if (verbose) {
+ if (dpx_conf.verbose_level > 0) {
WARN("Conversion to Unicode failed for subfont-id=\"%s\" code=\"0x%02x\"",
sub_name, i);
WARN(">> with: %s", strerror(errno));
Modified: trunk/Build/source/texk/dvipdfm-x/subfont.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/subfont.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/subfont.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
This program is free software; you can redistribute it and/or modify
@@ -21,8 +21,6 @@
#ifndef _SUBFONT_H_
#define _SUBFONT_H_
-extern void subfont_set_verbose (void);
-
extern void release_sfd_record (void);
extern unsigned short lookup_sfd_record(int rec_id, unsigned char code);
Modified: trunk/Build/source/texk/dvipdfm-x/t1_char.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/t1_char.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/t1_char.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -885,7 +885,7 @@
* (See, Adobe Technical Note #5177, Appendix C)
*/
if (!(cd->flags & T1_CS_FLAG_USE_HINTMASK)) {
- if (__verbose > 1)
+ if (dpx_conf.verbose_level > 1)
WARN("Obsolete Type 1 charstring operator \"dotsection\" not supported.");
}
#endif
Modified: trunk/Build/source/texk/dvipdfm-x/tfm.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/tfm.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/tfm.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -32,6 +32,7 @@
#include "error.h"
#include "numbers.h"
+#include "dpxconf.h"
#include "dpxutil.h"
#include "tfm.h"
@@ -41,9 +42,6 @@
#define FWBASE ((double) (1<<20))
-static int verbose = 0;
-
-
#ifndef WITHOUT_ASCII_PTEX
/*
* ID is 9 for vertical JFM file.
@@ -328,13 +326,6 @@
}
}
-void
-tfm_set_verbose (void)
-{
- verbose++;
-}
-
-
static int
fread_fwords (fixword *words, int32_t nmemb, FILE *fp)
{
@@ -921,12 +912,12 @@
ERROR("Could not open specified TFM/OFM file \"%s\".", tfm_name);
}
- if (verbose) {
+ if (dpx_conf.verbose_level > 0) {
if (format == TFM_FORMAT)
MESG("(TFM:%s", tfm_name);
else if (format == OFM_FORMAT)
MESG("(OFM:%s", tfm_name);
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
MESG("[%s]", file_name);
}
@@ -956,7 +947,7 @@
fms[numfms].tex_name = NEW(strlen(tfm_name)+1, char);
strcpy(fms[numfms].tex_name, tfm_name);
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
MESG(")");
return numfms++;
Modified: trunk/Build/source/texk/dvipdfm-x/tfm.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/tfm.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/tfm.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -25,8 +25,6 @@
#include "numbers.h"
-extern void tfm_set_verbose (void);
-
extern int tfm_open (const char * tex_name, int must_exist);
extern void tfm_close_all (void);
Modified: trunk/Build/source/texk/dvipdfm-x/truetype.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/truetype.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/truetype.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2007-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
This program is free software; you can redistribute it and/or modify
@@ -28,6 +28,7 @@
#include "error.h"
#include "mem.h"
+#include "dpxconf.h"
#include "dpxfile.h"
#include "dpxutil.h"
@@ -273,8 +274,6 @@
return;
}
-static int verbose = 0;
-
#define PDFUNIT(v) ((double) (ROUND(1000.0*(v)/(glyphs->emsize), 1)))
/*
@@ -314,7 +313,7 @@
glyphs = tt_build_init();
- if (verbose > 2)
+ if (dpx_conf.verbose_level > 2)
MESG("[glyphs:/.notdef");
count = 1; /* .notdef */
@@ -322,7 +321,7 @@
if (!usedchars[code])
continue;
- if (verbose > 2)
+ if (dpx_conf.verbose_level > 2)
MESG("/.c0x%02x", code);
gid = tt_cmap_lookup(ttcm, code);
@@ -340,7 +339,7 @@
}
tt_cmap_release(ttcm);
- if (verbose > 2)
+ if (dpx_conf.verbose_level > 2)
MESG("]");
if (tt_build_tables(sfont, glyphs) < 0) {
@@ -360,7 +359,7 @@
}
do_widths(font, widths);
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
MESG("[%d glyphs]", glyphs->num_glyphs);
tt_build_finish(glyphs);
@@ -424,7 +423,7 @@
if (idx >= 0)
return 0;
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
MESG("\ntrutype>> Try loading OTL GSUB for \"*.*.%s\"...", feat);
error = otl_gsub_add_feat(gm->gsub, "*", "*", feat, gm->sfont);
if (!error) {
@@ -564,7 +563,7 @@
*gid = tt_lookup_post_table(gm->nametogid, glyph_name);
#if 0
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
{
if (*gid > 0)
MESG("%s =post=> 0x%04X\n", glyph_name, *gid);
@@ -648,11 +647,11 @@
if (agln->n_components == 1)
idx = tt_cmap_lookup(gm->codetogid, agln->unicodes[0]);
else if (agln->n_components > 1) {
- if (verbose >= 0) /* give warning */
+ if (dpx_conf.verbose_level >= 0) /* give warning */
WARN("Glyph \"%s\" looks like a composite glyph...",
agln->name);
error = composeuchar(agln->unicodes, agln->n_components, NULL, gm, &idx);
- if (verbose >= 0) {
+ if (dpx_conf.verbose_level >= 0) {
if (error)
WARN("Not found...");
else {
@@ -829,7 +828,7 @@
WARN("Glyph \"%s\" not available in font \"%s\".",
encoding[code], pdf_font_get_ident(font));
} else {
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
MESG("truetype>> Glyph glyph-name=\"%s\" found at glyph-id=\"%u\".\n", encoding[code], gid);
}
idx = tt_find_glyph(glyphs, gid);
@@ -859,7 +858,7 @@
}
do_widths(font, widths);
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
MESG("[%d glyphs]", glyphs->num_glyphs);
tt_build_finish(glyphs);
@@ -889,8 +888,6 @@
if (!pdf_font_is_in_use(font))
return 0;
- verbose = pdf_font_get_verbose();
-
fp = DPXFOPEN(ident, DPX_RES_TYPE_TTFONT);
if (!fp) {
fp = DPXFOPEN(ident, DPX_RES_TYPE_DFONT);
@@ -986,7 +983,7 @@
if (fp)
DPXFCLOSE(fp);
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
MESG("[%ld bytes]", pdf_stream_length(fontfile));
pdf_add_dict(descriptor,
Modified: trunk/Build/source/texk/dvipdfm-x/tt_aux.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/tt_aux.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/tt_aux.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
This program is free software; you can redistribute it and/or modify
@@ -26,6 +26,7 @@
#include "mem.h"
#include "error.h"
#include "numbers.h"
+#include "dpxconf.h"
#include "pdfobj.h"
@@ -34,13 +35,6 @@
#include "tt_post.h"
#include "tt_aux.h"
-static int verbose = 0;
-
-void tt_aux_set_verbose(void)
-{
- ++verbose;
-}
-
ULONG ttc_read_offset (sfnt *sfont, int ttc_idx)
{
ULONG offset = 0, num_dirs = 0;
@@ -181,17 +175,17 @@
/* the least restrictive license granted takes precedence. */
*embed = 1;
} else if (os2->fsType & 0x0004) {
- if (verbose > 0)
+ if (dpx_conf.verbose_level > 0)
WARN("Font \"%s\" permits \"Preview & Print\" embedding only **\n", fontname);
*embed = 1;
} else {
if (always_embed) {
- if (verbose > 0)
+ if (dpx_conf.verbose_level > 0)
WARN("Font \"%s\" may be subject to embedding restrictions **\n", fontname);
*embed = 1;
}
else {
- if (verbose > 0)
+ if (dpx_conf.verbose_level > 0)
WARN("Embedding of font \"%s\" disabled due to license restrictions", fontname);
*embed = 0;
}
Modified: trunk/Build/source/texk/dvipdfm-x/tt_aux.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/tt_aux.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/tt_aux.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
This program is free software; you can redistribute it and/or modify
@@ -26,8 +26,6 @@
extern int always_embed; /* flag declared in dvipdfmx.c */
-extern void tt_aux_set_verbose(void);
-
/* TTC (TrueType Collection) */
extern ULONG ttc_read_offset (sfnt *sfont, int ttc_idx);
Modified: trunk/Build/source/texk/dvipdfm-x/tt_cmap.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/tt_cmap.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/tt_cmap.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -29,6 +29,7 @@
#include "system.h"
#include "mem.h"
#include "error.h"
+#include "dpxconf.h"
#include "sfnt.h"
@@ -54,13 +55,6 @@
#include "tt_cmap.h"
#define VERBOSE_LEVEL_MIN 0
-static int verbose = 0;
-void
-otf_cmap_set_verbose (void)
-{
- otl_gsub_set_verbose();
- verbose++;
-}
/* format 0: byte encoding table */
struct cmap0
@@ -927,7 +921,7 @@
}
#undef MAX_UNICODES
if (unicode_count == -1) {
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
if (name)
MESG("No Unicode mapping available: GID=%u, name=%s\n", gid, name);
else
@@ -964,7 +958,7 @@
CMap_add_bfchar(cmap, wbuf, 2, wbuf + 2, len);
count++;
- if (verbose > VERBOSE_LEVEL_MIN) {
+ if (dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
int _i;
MESG("otf_cmap>> Additional ToUnicode mapping: <%04X> <", gid);
@@ -1183,12 +1177,11 @@
CMap *cmap_add;
int cmap_add_id;
tt_cmap *ttcmap;
- char *normalized_font_name;
char *cmap_name, *cmap_add_name;
FILE *fp = NULL;
sfnt *sfont;
ULONG offset = 0;
- int i, cmap_type;
+ int i;
cmap_name = NEW(strlen(basefont)+strlen("-UTF16")+1, char);
sprintf(cmap_name, "%s-UTF16", basefont);
@@ -1200,7 +1193,7 @@
return cmap_ref;
}
- if (verbose > VERBOSE_LEVEL_MIN) {
+ if (dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("\n");
MESG("otf_cmap>> Creating ToUnicode CMap for \"%s\"...\n", font_name);
}
@@ -1261,7 +1254,7 @@
}
}
#if defined(LIBDPX)
- if (cmap_obj == NULL && verbose > VERBOSE_LEVEL_MIN)
+ if (cmap_obj == NULL && dpx_conf.verbose_level > VERBOSE_LEVEL_MIN)
#else
if (cmap_obj == NULL)
#endif /* LIBDPX */
@@ -1364,7 +1357,7 @@
sprintf(cmap_name, "%s,%03d-UCS4-H", map_name, ttc_index);
}
}
- if (verbose > VERBOSE_LEVEL_MIN) {
+ if (dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("\n");
MESG("otf_cmap>> Unicode charmap for font=\"%s\" layout=\"%s\"\n",
map_name, (otl_tags ? otl_tags : "none"));
@@ -1372,7 +1365,7 @@
cmap_id = CMap_cache_find(cmap_name);
if (cmap_id >= 0) {
RELEASE(cmap_name);
- if (verbose > VERBOSE_LEVEL_MIN)
+ if (dpx_conf.verbose_level > VERBOSE_LEVEL_MIN)
MESG("otf_cmap>> Found at cmap_id=%d.\n", cmap_id);
return cmap_id;
@@ -1455,7 +1448,7 @@
if (!ttcmap) {
ttcmap = tt_cmap_read(sfont, 0, 3); /* Unicode 2.0 or later */
#if defined(LIBDPX)
- if (!ttcmap && verbose > VERBOSE_LEVEL_MIN) {
+ if (!ttcmap && dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
#else
if (!ttcmap) {
#endif /* LIBDPX */
@@ -1542,7 +1535,7 @@
cmap_id = CMap_cache_find(cmap_name);
if (cmap_id >= 0) {
RELEASE(cmap_name);
- if (verbose > VERBOSE_LEVEL_MIN)
+ if (dpx_conf.verbose_level > VERBOSE_LEVEL_MIN)
MESG("otf_cmap>> GID-to-CID mapping found at cmap_id=%d.\n", cmap_id);
return cmap_id;
@@ -1600,12 +1593,13 @@
if (GIDToCIDMap) {
CMap *cmap;
int32_t gid;
+ const unsigned char csrange[4] = {0x00, 0x00, 0xff, 0xff};
cmap = CMap_new();
CMap_set_name (cmap, cmap_name);
CMap_set_type (cmap, CMAP_TYPE_CODE_TO_CID);
CMap_set_wmode(cmap, wmode);
- CMap_add_codespacerange(cmap, "\x00\x00", "\xff\xff", 2);
+ CMap_add_codespacerange(cmap, &csrange[0], &csrange[2], 2);
CMap_set_CIDSysInfo(cmap, &csi);
for (gid = 0; gid < 65536; gid++) {
@@ -1615,7 +1609,7 @@
CMap_add_bfchar(cmap, src, 2, &GIDToCIDMap[gid*2], 2);
}
cmap_id = CMap_cache_add(cmap);
- if (verbose > VERBOSE_LEVEL_MIN) {
+ if (dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("\n");
MESG("otf_cmap>> Creating GID-to-CID mapping for font=\"%s\"\n", map_name);
}
Modified: trunk/Build/source/texk/dvipdfm-x/tt_cmap.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/tt_cmap.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/tt_cmap.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -23,8 +23,6 @@
#include "sfnt.h"
-extern void otf_cmap_set_verbose (void);
-
/* TrueType cmap table */
typedef struct
{
Modified: trunk/Build/source/texk/dvipdfm-x/tt_gsub.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/tt_gsub.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/tt_gsub.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2017 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
This program is free software; you can redistribute it and/or modify
@@ -31,6 +31,7 @@
#include "error.h"
#include "mem.h"
#include "mfileio.h"
+#include "dpxconf.h"
#include "sfnt.h"
@@ -37,13 +38,7 @@
#include "otl_opt.h"
#include "tt_gsub.h"
-#define VERBOSE_LEVEL_MIN 0
-static int verbose = 0;
-void
-otl_gsub_set_verbose (void)
-{
- verbose++;
-}
+#define VERBOSE_LEVEL_MIN 2
typedef USHORT Offset;
typedef USHORT GlyphID;
@@ -888,7 +883,7 @@
script_tab.DefaultLangSys != 0) {
struct clt_langsys_table langsys_tab;
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("otl_gsub>> OTL script-language enabled: %c%c%c%c.dflt\n",
script_list.record[script_idx].tag[0],
script_list.record[script_idx].tag[1],
@@ -918,7 +913,7 @@
if (otl_match_optrule(language, langsys_rec->tag)) {
struct clt_langsys_table langsys_tab;
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("otl_gsub>> OTL script-language enabled: %c%c%c%c.%c%c%c%c\n",
script_list.record[script_idx].tag[0],
script_list.record[script_idx].tag[1],
@@ -956,7 +951,7 @@
sfnt_seek_set(sfont, offset);
clt_read_number_list(&lookup_list, sfont);
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("otl_gsub>> Reading OTL feature(s):");
}
@@ -968,7 +963,7 @@
struct clt_feature_table feature_table;
int i;
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG(" %c%c%c%c",
feature_list.record[feat_idx].tag[0],
feature_list.record[feat_idx].tag[1],
@@ -1004,7 +999,7 @@
lookup_table.LookupType != OTL_GSUB_TYPE_ALTERNATE &&
lookup_table.LookupType != OTL_GSUB_TYPE_LIGATURE &&
lookup_table.LookupType != OTL_GSUB_TYPE_ESUBST) {
- if (verbose > VERBOSE_LEVEL_MIN)
+ if (dpx_conf.verbose_level > VERBOSE_LEVEL_MIN)
WARN("Skipping unsupported GSUB subtable: LookupType=%d", lookup_table.LookupType);
continue;
}
@@ -1028,7 +1023,7 @@
if (r <= 0)
WARN("Reading GSUB subtable (single) failed...");
else {
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("(single)");
}
n_st++;
@@ -1041,7 +1036,7 @@
if (r <= 0)
WARN("Reading GSUB subtable (alternate) failed...");
else {
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("(alternate)");
}
n_st++;
@@ -1054,7 +1049,7 @@
if (r <= 0)
WARN("Reading GSUB subtable (ligature) failed...");
else {
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("(ligature)");
}
n_st++;
@@ -1081,7 +1076,7 @@
if (r <= 0)
WARN("Reading GSUB subtable (ext:single) failed...");
else {
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("(ext:single)");
}
n_st++;
@@ -1094,7 +1089,7 @@
if (r <= 0)
WARN("Reading GSUB subtable (alternate) failed...");
else {
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("(alternate)");
}
n_st++;
@@ -1107,7 +1102,7 @@
if (r <= 0)
WARN("Reading GSUB subtable (ext:ligature) failed...");
else {
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("(ext:ligature)");
}
n_st++;
@@ -1129,7 +1124,7 @@
}
}
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("\n");
MESG("otl_gsub>> %ld subtable(s) read.\n", num_subtabs);
}
@@ -1338,7 +1333,7 @@
gsub->feature = NEW(strlen(feature) +1, char);
strcpy(gsub->feature, feature);
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("\n");
MESG("otl_gsub>> Reading \"%s.%s.%s\"...\n", script, language, feature);
}
@@ -1348,7 +1343,7 @@
gsub_list->select = i;
gsub_list->num_gsubs++;
} else {
- if(verbose > VERBOSE_LEVEL_MIN) {
+ if(dpx_conf.verbose_level > VERBOSE_LEVEL_MIN) {
MESG("otl_gsub>> Failed\n");
}
RELEASE(gsub->script);
Modified: trunk/Build/source/texk/dvipdfm-x/tt_gsub.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/tt_gsub.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/tt_gsub.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2017 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
This program is free software; you can redistribute it and/or modify
@@ -24,8 +24,6 @@
#include "sfnt.h"
#include "otl_opt.h"
-extern void otl_gsub_set_verbose (void);
-
typedef struct otl_gsub otl_gsub;
/* LookupType for GSUB */
Modified: trunk/Build/source/texk/dvipdfm-x/type0.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/type0.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/type0.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -35,6 +35,7 @@
#include "system.h"
#include "mem.h"
#include "error.h"
+#include "dpxconf.h"
#include "dpxfile.h"
#include "pdfobj.h"
@@ -49,16 +50,8 @@
#define TYPE0FONT_DEBUG_STR "Type0"
#define TYPE0FONT_DEBUG 3
-static int __verbose = 0;
-
static pdf_obj *pdf_read_ToUnicode_file (const char *cmap_name);
-void
-Type0Font_set_verbose(void)
-{
- __verbose++;
-}
-
/*
* used_chars:
*
@@ -149,15 +142,6 @@
/* PLEASE FIX THIS */
#include "tt_cmap.h"
-static pdf_obj *
-Type0Font_create_ToUnicode_stream(Type0Font *font) {
- CIDFont *cidfont = font->descendant;
- return otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont),
- CIDFont_get_opt_index(cidfont),
- CIDFont_get_fontname(cidfont),
- Type0Font_get_usedchars(font));
-}
-
/* Try to load ToUnicode CMap from file system first, if not found fallback to
* font CMap reverse lookup.
* CHANGED: CMap here is not always Unicode to CID mapping. Don't use reverse lookup.
@@ -164,9 +148,10 @@
*/
static pdf_obj *
Type0Font_try_load_ToUnicode_stream(Type0Font *font, char *cmap_base) {
- char *cmap_name = NEW(strlen(cmap_base) + strlen("-UTF-16"), char);
pdf_obj *tounicode;
+ char *cmap_name;
+ cmap_name = NEW(strlen(cmap_base)+strlen("-UTF16")+1, char);
sprintf(cmap_name, "%s-UTF16", cmap_base);
tounicode = pdf_read_ToUnicode_file(cmap_name);
if (!tounicode) {
@@ -173,17 +158,21 @@
sprintf(cmap_name, "%s-UCS2", cmap_base);
tounicode = pdf_read_ToUnicode_file(cmap_name);
}
-
RELEASE(cmap_name);
- if (!tounicode)
- tounicode = Type0Font_create_ToUnicode_stream(font);
+ if (!tounicode) {
+ CIDFont *cidfont = font->descendant;
+ tounicode = otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont),
+ CIDFont_get_opt_index(cidfont),
+ CIDFont_get_fontname(cidfont),
+ Type0Font_get_usedchars(font));
+ }
return tounicode;
}
static void
-add_ToUnicode (Type0Font *font)
+Type0Font_attach_ToUnicode_stream (Type0Font *font)
{
pdf_obj *tounicode;
CIDFont *cidfont;
@@ -224,21 +213,32 @@
csi = CIDFont_get_CIDSysInfo(cidfont);
fontname = CIDFont_get_fontname(cidfont);
if (CIDFont_get_embedding(cidfont)) {
- fontname += 7; /* FIXME */
+ fontname += 7; /* FIXME: Skip pseudo unique tag... */
}
- if (!strcmp(csi->registry, "Adobe") &&
- !strcmp(csi->ordering, "Identity")) {
+ if (!strcmp(csi->registry, "Adobe") && !strcmp(csi->ordering, "Identity")) {
switch (CIDFont_get_subtype(cidfont)) {
case CIDFONT_TYPE2:
- /* PLEASE FIX THIS */
- tounicode = Type0Font_create_ToUnicode_stream(font);
+ /* PLEASE FIX THIS */
+ {
+ CIDFont *cidfont = font->descendant;
+ tounicode = otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont),
+ CIDFont_get_opt_index(cidfont),
+ CIDFont_get_fontname(cidfont),
+ Type0Font_get_usedchars(font));
+ }
break;
default:
- if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1C)) { /* FIXME */
- tounicode = Type0Font_create_ToUnicode_stream(font);
- } else if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1)) { /* FIXME */
- /* Font loader will create ToUnicode and set. */
+ if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1C)) {
+ CIDFont *cidfont = font->descendant;
+ tounicode = otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont),
+ CIDFont_get_opt_index(cidfont),
+ CIDFont_get_fontname(cidfont),
+ Type0Font_get_usedchars(font));
+ } else if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1)) {
+ /* FIXME: handled on very different timing.
+ * Font loader will create ToUnicode and set.
+ */
return;
} else {
tounicode = Type0Font_try_load_ToUnicode_stream(font, fontname);
@@ -257,7 +257,7 @@
pdf_new_name("ToUnicode"), tounicode);
} else {
#if defined(LIBDPX)
- if (__verbose)
+ if (dpx_conf.verbose_level > 0)
WARN("Failed to load ToUnicode CMap for font \"%s\"", fontname);
#else
WARN("Failed to load ToUnicode CMap for font \"%s\"", fontname);
@@ -282,8 +282,9 @@
if (!font || !font->indirect)
return;
- if (!pdf_lookup_dict(font->fontdict, "ToUnicode")) { /* FIXME */
- add_ToUnicode(font);
+ /* FIXME: Should move to pdffont.c */
+ if (!pdf_lookup_dict(font->fontdict, "ToUnicode")) {
+ Type0Font_attach_ToUnicode_stream(font);
}
}
@@ -485,7 +486,7 @@
*/
fontname = CIDFont_get_fontname(cidfont);
- if (__verbose) {
+ if (dpx_conf.verbose_level > 0) {
if (CIDFont_get_embedding(cidfont) && strlen(fontname) > 7)
MESG("(CID:%s)", fontname+7); /* skip XXXXXX+ */
else
Modified: trunk/Build/source/texk/dvipdfm-x/type0.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/type0.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/type0.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
This program is free software; you can redistribute it and/or modify
@@ -28,8 +28,6 @@
typedef struct Type0Font Type0Font;
-extern void Type0Font_set_verbose (void);
-
extern int Type0Font_get_wmode (Type0Font *font);
#if 0
extern char *Type0Font_get_encoding (Type0Font *font);
Modified: trunk/Build/source/texk/dvipdfm-x/type1.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/type1.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/type1.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -30,7 +30,7 @@
#include "system.h"
#include "mem.h"
#include "error.h"
-
+#include "dpxconf.h"
#include "dpxfile.h"
#include "numbers.h"
@@ -524,7 +524,7 @@
card16 *GIDMap, num_glyphs = 0;
FILE *fp;
int offset;
- int code, verbose;
+ int code;
ASSERT(font);
@@ -532,8 +532,6 @@
return 0;
}
- verbose = pdf_font_get_verbose();
-
encoding_id = pdf_font_get_encoding (font);
fontdict = pdf_font_get_resource (font);
@@ -639,7 +637,7 @@
if (gid < 0)
ERROR("Type 1 font with no \".notdef\" glyph???");
GIDMap[0] = (card16) gid;
- if (verbose > 2)
+ if (dpx_conf.verbose_level > 2)
MESG("[glyphs:/.notdef");
num_glyphs = 1;
for (prev = -2, code = 0; code <= 0xff; code++) {
@@ -686,7 +684,7 @@
prev = code;
num_glyphs++;
- if (verbose > 2) {
+ if (dpx_conf.verbose_level > 2) {
MESG("/%s", glyph);
}
#if !defined(LIBDPX)
@@ -775,7 +773,7 @@
break;
}
if (i == num_glyphs) {
- if (verbose > 2)
+ if (dpx_conf.verbose_level > 2)
MESG("/%s", achar_name);
GIDMap[num_glyphs++] = achar_gid;
charset->data.glyphs[charset->num_entries] = cff_get_seac_sid(cffont, achar_name);
@@ -794,7 +792,7 @@
break;
}
if (i == num_glyphs) {
- if (verbose > 2)
+ if (dpx_conf.verbose_level > 2)
MESG("/%s", bchar_name);
GIDMap[num_glyphs++] = bchar_gid;
charset->data.glyphs[charset->num_entries] = cff_get_seac_sid(cffont, bchar_name);
@@ -823,7 +821,7 @@
cff_release_charsets(cffont->charsets);
cffont->charsets = charset;
}
- if (verbose > 2)
+ if (dpx_conf.verbose_level > 2)
MESG("]");
/* Now we can update the String Index */
@@ -838,7 +836,7 @@
#else
offset = write_fontfile(font, cffont, pdfcharset);
#endif /* LIBDPX */
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
MESG("[%u glyphs][%ld bytes]", num_glyphs, offset);
#if !defined(LIBDPX)
Modified: trunk/Build/source/texk/dvipdfm-x/type1c.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/type1c.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/type1c.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2008-2016 by Jin-Hwan Cho, Matthias Franz, and Shunsaku Hirata,
+ Copyright (C) 2008-2018 by Jin-Hwan Cho, Matthias Franz, and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -41,7 +41,7 @@
#include "system.h"
#include "mem.h"
#include "error.h"
-
+#include "dpxconf.h"
#include "dpxfile.h"
#include "pdfobj.h"
@@ -258,12 +258,9 @@
cs_ginfo ginfo;
double nominal_width, default_width, notdef_width;
double widths[256];
- int verbose;
ASSERT(font);
- verbose = pdf_font_get_verbose();
-
if (!pdf_font_is_in_use(font)) {
return 0;
}
@@ -437,7 +434,7 @@
/* First we add .notdef glyph.
* All Type 1 font requires .notdef glyph to be present.
*/
- if (verbose > 2) {
+ if (dpx_conf.verbose_level > 2) {
MESG("[glyphs:/.notdef");
}
size = cs_idx->offset[1] - cs_idx->offset[0];
@@ -511,7 +508,7 @@
pdf_add_stream(pdfcharset, "/", 1);
pdf_add_stream(pdfcharset, enc_vec[code], strlen(enc_vec[code]));
- if (verbose > 2) {
+ if (dpx_conf.verbose_level > 2) {
MESG("/%s", enc_vec[code]);
}
@@ -537,7 +534,7 @@
charset->num_entries += 1;
num_glyphs++;
}
- if (verbose > 2) {
+ if (dpx_conf.verbose_level > 2) {
MESG("]");
}
RELEASE(data);
@@ -725,7 +722,7 @@
if (fp)
DPXFCLOSE(fp);
- if (verbose > 1) {
+ if (dpx_conf.verbose_level > 1) {
MESG("[%u/%u glyphs][%ld bytes]", num_glyphs, cs_count, offset);
}
Modified: trunk/Build/source/texk/dvipdfm-x/vf.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/vf.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/vf.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2007-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -28,7 +28,7 @@
#include "numbers.h"
#include "error.h"
#include "mem.h"
-
+#include "dpxconf.h"
#include "dpxfile.h"
/* pdfdev... */
#include "pdfdev.h"
@@ -47,13 +47,6 @@
#define TEXPT2PT (72.0/72.27)
#define FW2PT (TEXPT2PT/((double)(FIX_WORD_BASE)))
-static unsigned char verbose = 0;
-
-void vf_set_verbose(void)
-{
- if (verbose < 255) verbose++;
-}
-
struct font_def {
int32_t font_id /* id used internally in vf file */;
uint32_t checksum, size, design_size;
@@ -269,9 +262,9 @@
}
if (full_vf_file_name &&
(vf_file = MFOPEN (full_vf_file_name, FOPEN_RBIN_MODE)) != NULL) {
- if (verbose == 1)
+ if (dpx_conf.verbose_level == 1)
fprintf (stderr, "(VF:%s", tex_name);
- if (verbose > 1)
+ if (dpx_conf.verbose_level > 1)
fprintf (stderr, "(VF:%s", full_vf_file_name);
if (num_vf_fonts >= max_vf_fonts) {
resize_vf_fonts (max_vf_fonts + VF_ALLOC_SIZE);
@@ -287,7 +280,7 @@
}
read_header(vf_file, thisfont);
process_vf_file (vf_file, thisfont);
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
fprintf (stderr, ")");
MFCLOSE (vf_file);
}
@@ -391,7 +384,7 @@
* Warning message from virtual font.
*/
if (!memcmp((char *)p, "Warning:", 8)) {
- if (verbose)
+ if (dpx_conf.verbose_level > 0)
WARN("VF:%s", p+8);
} else {
dvi_do_special(buffer, len);
Modified: trunk/Build/source/texk/dvipdfm-x/vf.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/vf.h 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/vf.h 2018-09-14 03:34:50 UTC (rev 48663)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -25,7 +25,6 @@
#include "pdfdev.h"
-extern void vf_set_verbose (void);
extern int vf_locate_font (const char *tex_name, spt_t ptsize);
extern void vf_set_char (int32_t ch, int vf_font);
extern void vf_close_all_fonts(void);
Modified: trunk/Build/source/texk/dvipdfm-x/xbb.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/xbb.c 2018-09-14 00:18:57 UTC (rev 48662)
+++ trunk/Build/source/texk/dvipdfm-x/xbb.c 2018-09-14 03:34:50 UTC (rev 48663)
@@ -24,6 +24,7 @@
#include <time.h>
#include <string.h>
+#include "dpxconf.h"
#include "dpxutil.h"
#include "numbers.h"
@@ -44,15 +45,7 @@
#include "dvipdfmx.h"
#include "pdflimits.h"
-static int PageBox = 0;
-/*
- PageBox=0 :default
- PageBox=1 :cropbox
- PageBox=2 :mediabox
- PageBox=3 :artbox
- PageBox=4 :trimbox
- PageBox=5 :bleedbox
-*/
+static enum pdf_page_boundary PageBox = pdf_page_boundary__auto;
static int Include_Page = 1;
@@ -90,8 +83,6 @@
exit(1);
}
-static char verbose = 0;
-
static void do_time(FILE *file)
{
time_t current_time;
@@ -133,7 +124,7 @@
strncpy(result, name, strlen(name)-strlen(extensions[i]));
result[strlen(name)-strlen(extensions[i])] = 0;
}
- strcat(result, (compat_mode ? ".bb" : ".xbb"));
+ strcat(result, ((dpx_conf.compat_mode == dpx_mode_compat_mode) ? ".bb" : ".xbb"));
return result;
}
@@ -160,7 +151,7 @@
#endif
}
- if (verbose) {
+ if (dpx_conf.verbose_level > 0) {
MESG("Writing to %s: ", xbb_to_file ? outname : "stdout");
MESG("Bounding box: %d %d %d %d\n", bbllx, bblly, bburx, bbury);
}
@@ -169,7 +160,7 @@
fprintf(fp, "%%%%Creator: extractbb %s\n", VERSION);
fprintf(fp, "%%%%BoundingBox: %d %d %d %d\n", bbllx, bblly, bburx, bbury);
- if (!compat_mode) {
+ if (dpx_conf.compat_mode != dpx_mode_compat_mode) {
/* Note:
* According to Adobe Technical Note #5644, the arguments to
* "%%HiResBoundingBox:" must be of type real. And according
@@ -326,11 +317,11 @@
exit(0);
case 'B':
- if (strcasecmp (optarg, "cropbox") == 0) PageBox = 1;
- else if (strcasecmp (optarg, "mediabox") == 0) PageBox = 2;
- else if (strcasecmp (optarg, "artbox") == 0) PageBox = 3;
- else if (strcasecmp (optarg, "trimbox") == 0) PageBox = 4;
- else if (strcasecmp (optarg, "bleedbox") == 0) PageBox = 5;
+ if (strcasecmp (optarg, "cropbox") == 0) PageBox = pdf_page_boundary_cropbox;
+ else if (strcasecmp (optarg, "mediabox") == 0) PageBox = pdf_page_boundary_mediabox;
+ else if (strcasecmp (optarg, "artbox") == 0) PageBox = pdf_page_boundary_artbox;
+ else if (strcasecmp (optarg, "trimbox") == 0) PageBox = pdf_page_boundary_trimbox;
+ else if (strcasecmp (optarg, "bleedbox") == 0) PageBox = pdf_page_boundary_bleedbox;
else {
fprintf(stderr, "%s: Invalid argument \"-B %s\"", my_name, optarg);
usage();
@@ -343,9 +334,12 @@
Include_Page = 1;
break;
- case 'q': case 'v':
- verbose = c == 'v';
+ case 'q':
+ dpx_conf.verbose_level = 0;
break;
+ case 'v':
+ dpx_conf.verbose_level++;
+ break;
case 'O':
xbb_to_file = 0;
@@ -352,9 +346,12 @@
case 'b': /* Ignored for backward compatibility */
break;
- case 'm': case 'x':
- compat_mode = c == 'm';
+ case 'm':
+ dpx_conf.compat_mode = dpx_mode_compat_mode;
break;
+ case 'x':
+ dpx_conf.compat_mode = dpx_mode_normal_mode;
+ break;
default:
fprintf(stderr, "%s: %s \"-%c\"", my_name,
More information about the tex-live-commits
mailing list