groff-commit
[Top][All Lists]
Advanced

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

[Groff-commit] groff ./ChangeLog src/include/printer.h src/dev...


From: Werner LEMBERG
Subject: [Groff-commit] groff ./ChangeLog src/include/printer.h src/dev...
Date: Thu, 07 Oct 2004 07:57:03 -0400

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

Modified files:
        .              : ChangeLog 
        src/include    : printer.h 
        src/devices/grodvi: dvi.cpp 
        src/devices/grolbp: lbp.cpp 
        src/devices/grolj4: lj4.cpp 
        src/devices/grops: ps.cpp 
        src/devices/grotty: tty.cpp 
        src/devices/grohtml: post-html.cpp 

Log message:
        * src/include/printer.h (printer): New virtual method `round_width'.
        
        * src/devices/grodvi/dvi.cpp, src/devices/grolbp/lbp.cpp,
        src/devices/grolj4/lj4.cpp, src/devices/grops/ps.cpp,
        src/devices/grotty/tty.cpp (printer::round_width): New function
        member.
        
        * src/devices/grohtml/post-html.cpp (printer::round_width): New
        function member.
        (html_printer::set_numbered_char): Use it.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/ChangeLog.diff?tr1=1.743&tr2=1.744&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/include/printer.h.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/grodvi/dvi.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/grolbp/lbp.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/grolj4/lj4.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/grops/ps.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/grotty/tty.cpp.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/grohtml/post-html.cpp.diff?tr1=1.8&tr2=1.9&r1=text&r2=text

Patches:
Index: groff/ChangeLog
diff -u groff/ChangeLog:1.743 groff/ChangeLog:1.744
--- groff/ChangeLog:1.743       Thu Oct  7 10:59:34 2004
+++ groff/ChangeLog     Thu Oct  7 11:50:16 2004
@@ -1,3 +1,16 @@
+2004-10-04  Gaius Mulley  <address@hidden>
+
+       * src/include/printer.h (printer): New virtual method `round_width'.
+
+       * src/devices/grodvi/dvi.cpp, src/devices/grolbp/lbp.cpp,
+       src/devices/grolj4/lj4.cpp, src/devices/grops/ps.cpp,
+       src/devices/grotty/tty.cpp (printer::round_width): New function
+       member.
+
+       * src/devices/grohtml/post-html.cpp (printer::round_width): New
+       function member.
+       (html_printer::set_numbered_char): Use it.
+
 2004-10-03  Gaius Mulley  <address@hidden>
 
        * aclocal.m4 (GROFF_GHOSTSCRIPT_PATH): New macro.
Index: groff/src/devices/grodvi/dvi.cpp
diff -u groff/src/devices/grodvi/dvi.cpp:1.4 
groff/src/devices/grodvi/dvi.cpp:1.5
--- groff/src/devices/grodvi/dvi.cpp:1.4        Thu Apr  8 20:43:20 2004
+++ groff/src/devices/grodvi/dvi.cpp    Thu Oct  7 11:50:17 2004
@@ -112,6 +112,11 @@
   output_font() : f(0) { }
 };
 
+int printer::round_width(int x)
+{
+  return x;
+}
+
 class dvi_printer : public printer {
   FILE *fp;
   int max_drift;
Index: groff/src/devices/grohtml/post-html.cpp
diff -u groff/src/devices/grohtml/post-html.cpp:1.8 
groff/src/devices/grohtml/post-html.cpp:1.9
--- groff/src/devices/grohtml/post-html.cpp:1.8 Mon Apr 19 06:17:41 2004
+++ groff/src/devices/grohtml/post-html.cpp     Thu Oct  7 11:50:17 2004
@@ -3681,6 +3681,7 @@
     w = nbsp_width;
   else
     w = f->get_width(i, env->size);
+  w = round_width(w);
   if (widthp)
     *widthp = w;
   set_char(i, f, env, w, 0);
@@ -3980,6 +3981,25 @@
   }
 }
 
+/*
+ *  taken from number.cpp in src/roff/troff, [hunits::hunits(units x)]
+ */
+
+int printer::round_width(int x)
+{
+  int r = font::hor;
+  int n;
+
+  // don't depend on the rounding direction for division of negative integers
+  if (r == 1)
+    n = x;
+  else
+    n = (x < 0
+        ? -((-x + r/2 - 1)/r)
+        : (x + r/2 - 1)/r);
+  return n * r;
+}
+
 int main(int argc, char **argv)
 {
   program_name = argv[0];
Index: groff/src/devices/grolbp/lbp.cpp
diff -u groff/src/devices/grolbp/lbp.cpp:1.4 
groff/src/devices/grolbp/lbp.cpp:1.5
--- groff/src/devices/grolbp/lbp.cpp:1.4        Mon Apr 19 06:17:42 2004
+++ groff/src/devices/grolbp/lbp.cpp    Thu Oct  7 11:50:17 2004
@@ -59,6 +59,11 @@
   lbp_font(const char *);
 };
 
+int printer::round_width(int x)
+{
+  return x;
+}
+
 class lbp_printer : public printer {
 public:
   lbp_printer(int, double, double);
Index: groff/src/devices/grolj4/lj4.cpp
diff -u groff/src/devices/grolj4/lj4.cpp:1.4 
groff/src/devices/grolj4/lj4.cpp:1.5
--- groff/src/devices/grolj4/lj4.cpp:1.4        Thu Apr  8 20:43:21 2004
+++ groff/src/devices/grolj4/lj4.cpp    Thu Oct  7 11:50:17 2004
@@ -159,6 +159,11 @@
   }
 }
 
+int printer::round_width(int x)
+{
+  return x;
+}
+
 class lj4_printer : public printer {
 public:
   lj4_printer(int);
Index: groff/src/devices/grops/ps.cpp
diff -u groff/src/devices/grops/ps.cpp:1.5 groff/src/devices/grops/ps.cpp:1.6
--- groff/src/devices/grops/ps.cpp:1.5  Mon Apr 19 06:17:43 2004
+++ groff/src/devices/grops/ps.cpp      Thu Oct  7 11:50:17 2004
@@ -1778,6 +1778,11 @@
     --invis_count;
 }
 
+int printer::round_width(int x)
+{
+  return x;
+}
+
 printer *make_printer()
 {
   return new ps_printer(user_paper_length);
Index: groff/src/devices/grotty/tty.cpp
diff -u groff/src/devices/grotty/tty.cpp:1.8 
groff/src/devices/grotty/tty.cpp:1.9
--- groff/src/devices/grotty/tty.cpp:1.8        Mon Apr 19 06:17:43 2004
+++ groff/src/devices/grotty/tty.cpp    Thu Oct  7 11:50:17 2004
@@ -192,6 +192,11 @@
   }
 }
 
+int printer::round_width(int x)
+{
+  return x;
+}
+
 class tty_printer : public printer {
   int is_utf8;
   glyph **lines;
Index: groff/src/include/printer.h
diff -u groff/src/include/printer.h:1.10 groff/src/include/printer.h:1.11
--- groff/src/include/printer.h:1.10    Sat Apr 17 06:41:48 2004
+++ groff/src/include/printer.h Thu Oct  7 11:50:16 2004
@@ -83,6 +83,8 @@
   virtual void end_of_line();
   virtual void special(char *arg, const environment *env,
                       char type = 'p');
+  virtual int round_width(int);
+
 protected:
   font_pointer_list *font_list;
   font **font_table;




reply via email to

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