groff-commit
[Top][All Lists]
Advanced

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

[Groff-commit] groff ./ChangeLog src/include/font.h src/libs/l...


From: Werner LEMBERG
Subject: [Groff-commit] groff ./ChangeLog src/include/font.h src/libs/l...
Date: Fri, 08 Oct 2004 03:14:57 -0400

CVSROOT:        /cvsroot/groff
Module name:    groff
Branch:         
Changes by:     Werner LEMBERG <address@hidden> 04/10/08 07:08:08

Modified files:
        .              : ChangeLog 
        src/include    : font.h 
        src/libs/libgroff: font.cpp fontfile.cpp 
        font/devhtml   : DESC.proto Makefile.sub 
        man            : groff_font.man 
        src/preproc/html: pre-html.cpp 

Log message:
        * src/include/font.h (font): New member function
        `get_image_generator'.
        New variables `unscaled_charwidths' and `image_generator'.
        
        * src/libs/libgroff/font.cpp (font::get_width): Always return the
        character's unscaled width if `font::unscaled_charwidths' is set.
        (font::get_image_generator): New function.
        (font::load_desc): Check the `unscaled_charwidths' and
        `image_generator' keywords.
        
        * src/libs/libgroff/fontfile.cpp: Initialize
        `font::unscaled_charwidths' and `font::image_generator'.
        
        * font/devhtml/DESC.proto: s/html/unscaled_charwidths/.
        
        * font/devhtml/Makefile.sub (DESC): Set `image_generator' keyword.
        
        * man/groff_font.man: Document `unscaled_charwidths' and
        `image_generator'.
        
        * src/preproc/html/pre-html.cpp: Include `device.h'.
        (image_gen): New global variable.
        (imageList::createPage): Use `image_gen'.
        (main): Use `image_generator' keyword.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/ChangeLog.diff?tr1=1.745&tr2=1.746&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/include/font.h.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/libs/libgroff/font.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/libs/libgroff/fontfile.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/font/devhtml/DESC.proto.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/font/devhtml/Makefile.sub.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/man/groff_font.man.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/preproc/html/pre-html.cpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text

Patches:
Index: groff/ChangeLog
diff -u groff/ChangeLog:1.745 groff/ChangeLog:1.746
--- groff/ChangeLog:1.745       Thu Oct  7 11:56:32 2004
+++ groff/ChangeLog     Fri Oct  8 07:08:07 2004
@@ -1,3 +1,30 @@
+2004-10-05  Gaius Mulley  <address@hidden>
+
+       * src/include/font.h (font): New member function
+       `get_image_generator'.
+       New variables `unscaled_charwidths' and `image_generator'.
+
+       * src/libs/libgroff/font.cpp (font::get_width): Always return the
+       character's unscaled width if `font::unscaled_charwidths' is set.
+       (font::get_image_generator): New function.
+       (font::load_desc): Check the `unscaled_charwidths' and
+       `image_generator' keywords.
+
+       * src/libs/libgroff/fontfile.cpp: Initialize
+       `font::unscaled_charwidths' and `font::image_generator'.
+
+       * font/devhtml/DESC.proto: s/html/unscaled_charwidths/.
+
+       * font/devhtml/Makefile.sub (DESC): Set `image_generator' keyword.
+
+       * man/groff_font.man: Document `unscaled_charwidths' and
+       `image_generator'.
+
+       * src/preproc/html/pre-html.cpp: Include `device.h'.
+       (image_gen): New global variable.
+       (imageList::createPage): Use `image_gen'.
+       (main): Use `image_generator' keyword.
+
 2004-10-04  Gaius Mulley  <address@hidden>
 
        * tmac/html.tmac: Handle \[sqrtex].
Index: groff/font/devhtml/DESC.proto
diff -u groff/font/devhtml/DESC.proto:1.3 groff/font/devhtml/DESC.proto:1.4
--- groff/font/devhtml/DESC.proto:1.3   Mon Mar 31 14:31:18 2003
+++ groff/font/devhtml/DESC.proto       Fri Oct  8 07:08:08 2004
@@ -5,7 +5,7 @@
 sizes 1-1000 0
 fonts 9 R I B BI CR CI CB CBI S
 tcommand
-html
+unscaled_charwidths
 postpro post-grohtml
 prepro  pre-grohtml
 use_charnames_in_special
Index: groff/font/devhtml/Makefile.sub
diff -u groff/font/devhtml/Makefile.sub:1.4 groff/font/devhtml/Makefile.sub:1.5
--- groff/font/devhtml/Makefile.sub:1.4 Wed Aug  7 15:01:32 2002
+++ groff/font/devhtml/Makefile.sub     Fri Oct  8 07:08:08 2004
@@ -31,4 +31,4 @@
            -e "s/^vert .*$$/vert `expr $(RES) / $(LPI)`/" \
            -e "s/^fonts .*$$/fonts `set $(FONTS); echo $$#` $(FONTS)/" \
            $(srcdir)/DESC.proto >$@
-
+       @echo "image_generator $(GHOSTSCRIPT)" >> $@
Index: groff/man/groff_font.man
diff -u groff/man/groff_font.man:1.22 groff/man/groff_font.man:1.23
--- groff/man/groff_font.man:1.22       Sat Jul  3 12:46:58 2004
+++ groff/man/groff_font.man    Fri Oct  8 07:08:08 2004
@@ -48,7 +48,8 @@
 The font files for device
 .I name
 are stored in a directory
-.BI dev name.
+.BI dev name\c
+\&.
 .
 There are two types of file: a
 device description file called
@@ -103,6 +104,17 @@
 machine units.
 .
 .TP
+.BI image_generator\  string
+Needed for
+.B grohtml
+only.
+It specifies the program to generate PNG images from
+PostScript input.
+Under GNU/Linux this is usually
+.I gs
+but under other systems (notably cygwin) it might be set to another name.
+.
+.TP
 .BI paperlength\  n
 The physical vertical dimension of the output medium in machine units.
 .
@@ -276,6 +288,13 @@
 scaled points.
 .
 .TP
+.B unscaled_charwidths
+Make the font handling module always return unscaled character widths.
+Needed for the
+.B grohtml
+device.
+.
+.TP
 .B use_charnames_in_special
 This command indicates that troff should encode named characters inside
 special commands.
Index: groff/src/include/font.h
diff -u groff/src/include/font.h:1.5 groff/src/include/font.h:1.6
--- groff/src/include/font.h:1.5        Wed Jun 30 11:35:28 2004
+++ groff/src/include/font.h    Fri Oct  8 07:08:08 2004
@@ -54,6 +54,7 @@
   const char *get_special_device_encoding(int index);
   const char *get_name();
   const char *get_internal_name();
+  const char *get_image_generator();
 
   static int scan_papersize(const char *, const char **, double *, double *);
 
@@ -77,8 +78,10 @@
   static int spare2;
   static int sizescale;
   static int tcommand;
+  static int unscaled_charwidths;
   static int pass_filenames;
   static int use_charnames_in_special;
+  static const char *image_generator;
 
   static const char **font_name_table;
   static const char **style_table;
Index: groff/src/libs/libgroff/font.cpp
diff -u groff/src/libs/libgroff/font.cpp:1.4 
groff/src/libs/libgroff/font.cpp:1.5
--- groff/src/libs/libgroff/font.cpp:1.4        Wed Jun 30 11:35:28 2004
+++ groff/src/libs/libgroff/font.cpp    Fri Oct  8 07:08:08 2004
@@ -274,7 +274,7 @@
   int i = ch_index[c];
   assert(i >= 0);
 
-  if (point_size == unitwidth)
+  if (point_size == unitwidth || font::unscaled_charwidths)
     return ch[i].width;
 
   if (!widths_cache)
@@ -396,7 +396,12 @@
 const char *font::get_special_device_encoding(int c)
 {
   assert(c >= 0 && c < nindices && ch_index[c] >= 0);
-  return( ch[ch_index[c]].special_device_coding );
+  return ch[ch_index[c]].special_device_coding;
+}
+
+const char *font::get_image_generator()
+{
+  return image_generator;
 }
 
 void font::alloc_ch_index(int idx)
@@ -815,7 +820,7 @@
   { "spare1", &font::biggestfont },
   { "biggestfont", &font::biggestfont },
   { "spare2", &font::spare2 },
-  { "sizescale", &font::sizescale }
+  { "sizescale", &font::sizescale },
   };
 
 int font::load_desc()
@@ -910,6 +915,8 @@
        return 0;
       }
     }
+    else if (strcmp("unscaled_charwidths", p) == 0)
+      unscaled_charwidths = 1;
     else if (strcmp("pass_filenames", p) == 0)
       pass_filenames = 1;
     else if (strcmp("sizes", p) == 0) {
@@ -986,6 +993,14 @@
       tcommand = 1;
     else if (strcmp("use_charnames_in_special", p) == 0)
       use_charnames_in_special = 1;
+    else if (strcmp("image_generator", p) == 0) {
+      p = strtok(0, WS);
+      if (!p) {
+       t.error("image_generator command requires an argument");
+       return 0;
+      }
+      image_generator = strdup(p);
+    }
     else if (strcmp("charset", p) == 0)
       break;
     else if (unknown_desc_command_handler) {
Index: groff/src/libs/libgroff/fontfile.cpp
diff -u groff/src/libs/libgroff/fontfile.cpp:1.2 
groff/src/libs/libgroff/fontfile.cpp:1.3
--- groff/src/libs/libgroff/fontfile.cpp:1.2    Thu Apr  8 20:43:22 2004
+++ groff/src/libs/libgroff/fontfile.cpp        Fri Oct  8 07:08:08 2004
@@ -45,7 +45,9 @@
 int font::sizescale = 1;
 int font::tcommand = 0;
 int font::pass_filenames = 0;
+int font::unscaled_charwidths = 0;
 int font::use_charnames_in_special = 0;
+const char *font::image_generator = NULL;
 const char **font::font_name_table = 0;
 int *font::sizes = 0;
 const char *font::family = 0;
Index: groff/src/preproc/html/pre-html.cpp
diff -u groff/src/preproc/html/pre-html.cpp:1.10 
groff/src/preproc/html/pre-html.cpp:1.11
--- groff/src/preproc/html/pre-html.cpp:1.10    Sun May  9 15:17:49 2004
+++ groff/src/preproc/html/pre-html.cpp Fri Oct  8 07:08:08 2004
@@ -34,6 +34,7 @@
 #include "defs.h"
 #include "searchpath.h"
 #include "paper.h"
+#include "device.h"
 #include "font.h"
 
 #include <errno.h>
@@ -210,6 +211,7 @@
 
 static char *linebuf = NULL;           // for scanning devps/DESC
 static int linebufsize = 0;
+static const char *image_gen = NULL;    // the `gs' program
 
 const char *const FONT_ENV_VAR = "GROFF_FONT_PATH";
 static search_path font_path(FONT_ENV_VAR, FONTPATH, 0, 0);
@@ -926,11 +928,12 @@
   html_system(s, 1);
 
   s = make_message("echo showpage | "
-                  "gs%s -q -dBATCH -dSAFER "
+                  "%s%s -q -dBATCH -dSAFER "
                   "-dDEVICEHEIGHTPOINTS=792 "
                   "-dDEVICEWIDTHPOINTS=%d -dFIXEDMEDIA=true "
                   "-sDEVICE=%s -r%d %s "
                   "-sOutputFile=%s %s -\n",
+                  image_gen,
                   EXE_EXT,
                   (getMaxX(pageno) * image_res) / postscriptRes,
                   image_device,
@@ -1701,6 +1704,12 @@
   }
   exit(1);
 #endif /* CAPTURE_MODE */
+  device = "html";
+  if (!font::load_desc())
+    fatal("cannot find devhtml/DESC exiting");
+  image_gen = font::image_generator;
+  if (image_gen == NULL || (strcmp(image_gen, "") == 0))
+    fatal("devhtml/DESC must set the image_generator field, exiting");
   postscriptRes = get_resolution();
   i = scanArguments(argc, argv);
   setupAntiAlias();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]