[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dvipdfm



Atsuhito Kohda <kohda@pm.tokushima-u.ac.jp> wrote:

> Of course we will contact you when we release tetex including
> dvipdfm but, if possible, please upload dummy dvipdfm package
> at that time.

Can you upload the dummy package as well?  Putting together a dummy
package is trivial, and if you do it, there will be no delays getting it
into the Debian archive at the same time the new tetex packages enter
the archive.

> BTW, do you modify dvipdfm aside from Japanese support?
> I guess it supports libpaper, right?

It supports libpaper.  I also have modified it to read a "fontmaps" file
after the "config" file.  I've added a couple of man pages that were
missing (you can grab them from the dvipdfm source).  If I recall
correctly, all other patches I made were bugfixes that I forward to the
author and have been incorporated upstream.

> If possible, please send a patch if any.

The patches for libpaper support and the config file modifications have
been included below:

--- dvipdfm-0.13.2c.orig/Makefile.in
+++ dvipdfm-0.13.2c/Makefile.in
@@ -3,7 +3,7 @@
 LDFLAGS=@LDFLAGS@
 CPPFLAGS=@CPPFLAGS@ -I.
 INSTALL=@INSTALL@
-LIBS=@LIBS@ -lm 
+LIBS=@LIBS@ -lm -lpaper
 srcdir=@srcdir@
 prefix=@prefix@
 exec_prefix=@exec_prefix@
--- dvipdfm-0.13.2c.orig/dvipdfm.1
+++ dvipdfm-0.13.2c/dvipdfm.1
@@ -127,7 +127,8 @@
 .TP 5
 .B \-\^p " paper"
 Select the papersize by name (e.g.,
-.BR letter ", " legal ", " ledger ", " tabloid ", " a3 ", " a4 ", or " a5
+.BR letter ", " legal ", " ledger ", " tabloid ", " a3 ", " a4 ", "
+.BR a5 ", " a6 ", " b3 ", " b4 ", " b5 ", " b6 ", or " b5var
 )
 
 .TP 5
--- dvipdfm-0.13.2c.orig/dvipdfm.c
+++ dvipdfm-0.13.2c/dvipdfm.c
@@ -27,6 +27,7 @@
 #include <string.h>
 #include <limits.h>
 #include <ctype.h>
+#include <paper.h>
 #include "config.h"
 #include "system.h"
 #include "mem.h"
@@ -62,23 +64,35 @@
   {"legal" , { 612.0, 1008.0}},
   {"ledger" , { 1224.0, 792.0}},
   {"tabloid" , { 792.0, 1224.0}},
+  {"a6" , { 297.64, 420.91}},
   {"a5" , { 420.91, 595.27}},
   {"a4" , { 595.27, 841.82}},
-  {"a3" , { 841.82, 1190.16}}};
+  {"a3" , { 841.82, 1190.16}},
+  {"b6" , { 364.25, 515.91}},
+  {"b5" , { 515.91, 728.50}},
+  {"b4" , { 728.50, 1031.81}},
+  {"b3" , { 1031.81, 1457.00}},
+  {"b5var" , { 515.91, 651.97}}};
 
-static rect get_paper_size (char *string)
+static rect get_paper_size (char *string, int error_flag)
 {
+  rect nullpaper = { 0.0, 0.0 };
   int i;
+  if (string == NULL || string[0] == '\0')
+    return nullpaper;
   for (i=0; i<sizeof(paper_sizes)/sizeof(paper_sizes[0]); i++) {
     if (!strcmp (string, paper_sizes[i].s))
       break;
   }
   if (i == sizeof(paper_sizes)/sizeof(paper_sizes[0]))
+  { if (!error_flag)
+    return nullpaper;
+  else
     ERROR ("Paper size is invalid");
+  }
   return paper_sizes[i].data;
 }
 
-
 char *dvi_filename = NULL, *pdf_filename = NULL;
 static void set_default_pdf_filename(void)
 {
@@ -113,7 +127,8 @@
    fprintf (stdout, "-l \t\tLandscape mode\n");
    fprintf (stdout, "-m number\tSet additional magnification\n");
    fprintf (stdout, "-p papersize\tSet papersize (letter, legal,\n");
-   fprintf (stdout, "            \tledger, tabloid, a4, or a3) [letter]\n");
+   fprintf (stdout, "            \tledger, tabloid, a6, a5, a4, a3,\n");
+   fprintf (stdout, "            \tb6, b5, b4, b3, or b5var) [letter]\n");
    fprintf (stdout, "-r resolution\tSet resolution (in DPI) for raster fonts [600]\n");
    fprintf (stdout, "-s pages\tSelect page ranges (-)\n");
    fprintf (stdout, "-t      \tEmbed thumbnail images\n");
@@ -367,7 +382,7 @@
 	  struct rect paper_size;
 	  if (argc < 2)
 	    ERROR ("Missing paper size");
-	  paper_size = get_paper_size (argv[1]);
+	  paper_size = get_paper_size (argv[1], 1);
 	  paper_width = paper_size.width;
 	  paper_height = paper_size.height;
 	  pop_arg();
@@ -507,8 +523,7 @@
   psimage_close();
 }
 
-static char *config_file_name = "config";
-static void read_config_file (void)
+static void read_config_file (char *config_file_name)
 {
   char *full_config_name, *start, *end;
   char *argv[2], *option;
@@ -578,8 +593,16 @@
   argv+=1;
   argc-=1;
 
+  {
+    rect paper_size = get_paper_size (systempapername (), 0);
+    if (paper_size.width != 0) {
+      paper_width = paper_size.width;
+      paper_height = paper_size.height;
+    }
+  }
   /* Process config file, if any */
-  read_config_file();
+  read_config_file("config");
+  read_config_file("fontmaps");
 
   do_args (argc, argv);
 



Reply to: