I've attached a proposed patch that works for me. I added the command line
flag -ppc. Though, it might be more appropriate to add this as an option. I
figure this might be useful to someone else.
Thanks for w3m, it does a great job.
-FR.
--- Alex Lyons AEA Technology Winfrith <alex.lyons@aeat.co.uk> wrote:
> ---f_rosencrantz@yahoo.com wrote:
> > Is there a way to make w3m think that 78 columns is wide enough
> > to handle a table of WIDTH 638.
> >
> > I'd prefer not to have to edit either the input or the output to
> > do this sort of conversion. I sort of wish it was pilot error. ;)
>
> w3m assumes a fixed character width of 8 pixels (defined as
> PIXEL_PER_CHAR in fm.h). On this basis, Word's insistence on
> generating fixed-width tables of 638 pixels converts to 79.75
> character columns, so your required 78-column width is just
> slightly too small.
>
> Your options would appear to be:
> 1. Let w3m render the text in 80 columns rather than 78;
> 2. Edit the generated HTML to remove all the WIDTH attributes;
> 3. Slightly shrink your column or page width in Word before
> generating the HTML so that the fixed table width comes out
> smaller (not sure whether this will work!);
> 4. Edit fm.h to change PIXEL_PER_CHAR to 9 and recompile w3m
> (this is now getting slightly silly!).
>
> It would be nice if w3m could detect the character width from the
> font being used in the xterm (or whatever) window, and/or if there
> was an option to change value from the default 8, either as a settable
> option or as a command line argument. Perhaps our Esteemed Developer
> could add this to a wishlist?
>
> Keep up the good work,
>
> Alex Lyons.
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
--- ,main.c Mon Jun 5 22:56:48 2000
+++ main.c Thu Sep 21 22:05:49 2000
@@ -98,6 +98,7 @@
fprintf(stderr, " -F automatically render frame\n");
fprintf(stderr, " -dump dump formatted page into stdout\n");
fprintf(stderr, " -cols width specify column width (used with -dump)\n");
+ fprintf(stderr, " -ppc count specify the number of pixels per character\n");
fprintf(stderr, " -dump_source dump page source into stdout\n");
fprintf(stderr, " -dump_head dump response of HEAD request into stdout\n");
fprintf(stderr, " +<num> goto <num> line\n");
@@ -327,6 +328,11 @@
if (++i >= argc)
usage();
COLS = atoi(argv[i]);
+ }
+ else if (!strcmp("-ppc",argv[i])) {
+ if (++i >= argc)
+ usage();
+ PIXEL_PER_CHAR=atof(argv[i]);
}
else if (!strcmp("-num", argv[i]))
showLineNum = TRUE;
--- ,fm.h Mon Jun 5 22:54:35 2000
+++ fm.h Fri Sep 8 12:02:12 2000
@@ -59,7 +59,8 @@
#define PAGER_MAX_LINE 10000 /* Maximum line kept as pager */
#define FNLEN 80
-#define PIXEL_PER_CHAR 8 /* arbitrary */
+#define DEFAULT_PIXEL_PER_CHAR 8.0 /* arbitrary */
+extern float PIXEL_PER_CHAR;
#ifdef FALSE
#undef FALSE
--- ,file.c Thu Sep 21 22:08:09 2000
+++ file.c Fri Sep 8 12:02:03 2000
@@ -26,6 +26,7 @@
extern Hist *SaveHist;
+float PIXEL_PER_CHAR = DEFAULT_PIXEL_PER_CHAR;
static FILE *gunzip_stream(FILE * infp, int compressor);
static FILE *lessopen_stream(char *path);
static void close_textarea(struct html_feed_environ *h_env);
--- doc/,w3m.1 Mon Jan 3 21:46:50 2000
+++ doc/w3m.1 Thu Sep 21 22:04:51 2000
@@ -83,6 +83,10 @@
.B -cols width
specify column width (used with -dump)
.TP
+.B -ppc count
+specify the number of pixels per character (default 8.0)
+Larger values will make tables narrower.
+.TP
.B -dump_source
dump page source into stdout
.TP
This archive was generated by hypermail 2b29 : Fri Sep 22 2000 - 01:23:23 CDT