Code Monkey home page Code Monkey logo

neatroff_make's People

Contributors

aabacchus avatar aligrudi avatar gavinok avatar konstantin8105 avatar mccgit avatar mtbakerguy avatar pjfichet avatar readmemyrights avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neatroff_make's Issues

Consider migrating `repo.or.cz/troff` fork to GitHub

This repository's sources are all hosted on GitHub, save one — a fork of Plan9's pic and tbl ports for Linux hosted at repo.or.cz/troff.git. This is problematic because repo.or.cz's uptime is rather… volatile.

Several times I've attempted to git clone a repository hosted there, only to be met with connection failure. These periods of downtime can last between a few hours or several days, with the last crash prompting me to make a fork in order to have a stable source from which to install neatpic and neattbl. I'd strongly prefer to use a canonical source instead.

Which brings me “neatly” along to my second point: a few months ago, I finished work on a Homebrew formula for installing Neatroff on macOS (via the alhadis/troff tap). It includes a subroutine for checking each of neatroff_make's constituents for updates, something which was non-trivial to implement. Much of the complexity stemmed from having to support an obscure host in addition to GitHub.com, the latter can efficiently query multiple APIs in a single payload.

@aligrudi, would you be willing to move your fork over to GitHub? This would make everybody's lives much easier. 😀 Thank you!

failed to mount CMEX CMSY

Hello,
I follow instructions in README .
When I try "make" in demo directory,neatroff report :

Generating test.ps
Generating test.pdf
Generating neatroff.ps
Generating neatroff.pdf
Generating neateqn.ps
neatroff: failed to mount <CMEX>
neatroff: failed to mount <CMSY>
neatroff: failed to mount <CMEX>
neatroff: failed to mount <CMSY>
Generating neateqn.pdf
Generating neatstart.ps
Generating neatstart.pdf
Generating neatcc.ps
Generating neatcc.pdf
rm neateqn.ps test.ps neatstart.ps neatcc.ps neatroff.ps

comment other make target and remain only neateqn.pdf, then neatroff report:

Generating neateqn.ps
neatroff: failed to mount <CMEX>
neatroff: failed to mount <CMSY>
neatroff: failed to mount <CMEX>
neatroff: failed to mount <CMSY>
Generating neateqn.pdf
rm neateqn.ps

I check CMEX\CMSY font in fonts directory:

ls fonts/CMEX10.* -lshta
12K -rw-rw-r-- 1 abc abc 9.8K Aug 14 17:08 ../fonts/CMEX10.afm
32K -rw-rw-r-- 1 abc abc 30K Jul 15 2009 ../fonts/CMEX10.pfb

and also found CMSY:

ls fonts/CMSY10.* -lshta
12K -rw-rw-r-- 1 abc abc 8.8K Aug 14 17:08 ../fonts/CMSY10.afm
32K -rw-rw-r-- 1 abc abc 32K Jul 15 2009 ../fonts/CMSY10.pfb

If I comment follow lines, neatroff won't report "failed to mount":

.fp - CMEX Pxex
.fp - CMSY Pxsy

.fp - CMEX txex
.fp - CMSY txsy

post.url is unsafe for long strings

post.url cannot handle links that span across multiple lines as it assumes that the link text fits into a plain rectangle.
For instance:

\*[post.url 1 "sdfklsdflksdfjsdfkljsdflk dfgkgkldfgjdflgjdflkgjdfglkjdfglkjsaf sdfsdfkljsdfklg sdfsdfjksdfj sdfsdfhjsdhfjsdf sdfsdfsdfhjsdfhj"]

Build with:

roff -mpost -ms url-bug.ms | pdf >url-bug.pdf

That's enough to reproduce the "bug". Effectively, links are only safe on single non-breakable words or at the beginning of a line.

Is there a way to fix that? I see that ms .BX macro behaves similarly.

Missing examples in the demo directory

It's not clear how (if?) you can do the following:

  • insert a unicode character (e.g. \spade) into the output.
  • color the text that represents a link: *[post.url http://litcave.rudi.ir/ \m[green]boohoo\m[]]
  • combine the two *[post.url http://litcave.rudi.ir \m[green]\spade\m[]]
  • using the above three -- put them in as a table cell
  • have multiple word text: *[post.url http://litcave.rudi.ir "hello world"]

If these are possible, adding something to the demo directory or as a FAQ section in the documentation would be helpful.

Cannot make due to issues with `pic`

Hi! I'm on Mac OS X 10.13. When I try to make the tools, I get an error when it's trying to compile picy.c. I'm afraid I don't know enough C to understand what is going on, but it looks might be a conflict of some sort with the OS version of sprintf? (I've included the output below, as well as the version of the compiler.) Please let me know if I can help fix this?

Thanks,
Ricky

$ git clone https://github.com/aligrudi/neatroff_make.git
...
$ cd neatroff_make
$ make init
...
$ make neat
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" roff.c
roff.c:34:18: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
        fprintf(stderr, msg);
                        ^~~
roff.c:34:18: note: treat the string as an argument to avoid this
        fprintf(stderr, msg);
                        ^
                        "%s",
1 warning generated.
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" dev.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" font.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" in.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" cp.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" tr.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" ren.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" out.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" reg.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" sbuf.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" fmt.c
fmt.c:454:15: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int'
      which may cause truncation of value [-Wabsolute-value]
        long ratio = abs((llen - lwid) * 100l / (swid ? swid : 1));
                     ^
fmt.c:454:15: note: use function 'labs' instead
        long ratio = abs((llen - lwid) * 100l / (swid ? swid : 1));
                     ^~~
                     labs
1 warning generated.
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" eval.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" draw.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" wb.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" hyph.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" map.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" clr.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" char.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" dict.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" iset.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" dir.c
cc -o roff roff.o dev.o font.o in.o cp.o tr.o ren.o out.o reg.o sbuf.o fmt.o eval.o draw.o wb.o hyph.o map.o clr.o char.o dict.o iset.o dir.o
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" post.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" ps.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" font.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" dev.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" clr.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" dict.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" iset.c
cc -o post post.o ps.o font.o dev.o clr.o dict.o iset.o
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" pdf.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" pdfext.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" sbuf.c
cc -o pdf post.o pdf.o pdfext.o font.o dev.o clr.o dict.o iset.o sbuf.o
cc -c -Wall -O2 eqn.c
eqn.c:530:18: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
        fprintf(stderr, msg);
                        ^~~
eqn.c:530:18: note: treat the string as an argument to avoid this
        fprintf(stderr, msg);
                        ^
                        "%s",
1 warning generated.
cc -c -Wall -O2 tok.c
cc -c -Wall -O2 src.c
cc -c -Wall -O2 def.c
cc -c -Wall -O2 box.c
cc -c -Wall -O2 reg.c
cc -c -Wall -O2 sbuf.c
cc -o eqn eqn.o tok.o src.o def.o box.o reg.o sbuf.o
cc -c -O2 -Wall mkfn.c
cc -c -O2 -Wall trfn.c
cc -c -O2 -Wall sbuf.c
cc -c -O2 -Wall tab.c
cc -c -O2 -Wall afm.c
cc -c -O2 -Wall otf.c
cc -o mkfn mkfn.o trfn.o sbuf.o tab.o afm.o otf.o
cc -c -Wall -O2 refer.c
cc -o refer refer.o
cc -c -Wall -O2 picy.c
picy.c:795:3: error: unterminated function-like macro invocation
{ ERROR "syntax error" WARNING; } break;
  ^
./pic.h:13:15: note: expanded from macro 'ERROR'
#define ERROR   sprintf(errbuf,
                ^
/usr/include/secure/_stdio.h:46:9: note: macro 'sprintf' defined here
#define sprintf(str, ...) \
        ^
picy.c:1094:2: error: expected '}'
}
 ^
picy.c:795:1: note: to match this '{'
{ ERROR "syntax error" WARNING; } break;
^
picy.c:1094:2: error: expected '}'
}
 ^
picy.c:792:14: note: to match this '{'
        switch(yym) {
                    ^
picy.c:1094:2: error: expected '}'
}
 ^
picy.c:641:1: note: to match this '{'
{
^
picy.c:662:9: warning: array index -1 is before the beginning of the array [-Warray-bounds]
        yyp = &yys[-1];
               ^   ~~
picy.c:642:2: note: array 'yys' declared here
        struct
        ^
1 warning and 4 errors generated.
make[1]: *** [picy.o] Error 1
make: *** [neat] Error 2
$
$ cc --version
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Bug in tbl's vertical spanning

The following document illustrates the problem (^ and t behave differently in an unexpected way; it looks like t sometimes skips the call into wide in t6.c):

`Vertical span with ^:
.TS
center, box;
lB0 | cB0 s0 s0
l | cB0 | cB0 | cB0
^ | cB0 | cB0 | cB0.
Date Region
_
A B C
2 2 4
_
.TE

Vertical span with t:
.TS
center, box;
lB0 | cB0 s0 s0
l | cB0 | cB0 | cB0
t | cB0 | cB0 | cB0.
Date Region
_
A B C
2 2 4
_
.TE
`

pdf/post crash with long glyph names

FontAwesome version 5 contains glyph names which are longer than GNLEN (32). This causes a strcpy buffer overflow in font_glyphput.

Fix for the immediate problem is to increase GNLEN, but perhaps checking the length and skipping the offending glyph with a warning would be nice here?

Odd kerning with Minion Pro

I'm trying to figure out a kerning issue with the Adobe Minion Pro Opentype font and neatroff built from latest git: Vi and Vj appear too close together, but look correct in other programs. This appears to affect the whole Minion family, while the comparably-complex Adobe Garamond Premier Pro (also Opentype) doesn't seem to have problems.

Here is roff | pdf output:
minion-kern-neatroff

from this file:

.fp - M MinionPro-Regular
.fp - MM MinionPro-Medium
.fp - G Garamond-Premier-Pro
.ft R
R: Vimperator Vjol
.sp
.ft M
Minion Pro: Vimperator Vjol
.br
.ft MM
Minion Pro Medium: Vimperator Vjol
.sp
.ft G
Garamond Premier Pro: Vimperator Vjol

The metrics file generated by mkfn has gpos kern:latn 2 V:+0+0-5+0 i and gpos kern:latn 2 V:+0+0-5+0 j. The Garamond has no V-i or V-j kern pairs, while R has -2 for V-i.

This is what the text looks like in Fontforge (apps such as Krita result in comparable layout):
minion-kern-ff2

Any ideas what might be happening here? I can send you the font if needed.

tbl - fix some gcc warnings

diff -urN tbl.orig/t3.c tbl/t3.c
--- tbl.orig/t3.c	Tue May  7 19:43:35 2019
+++ tbl/t3.c	Tue May  7 19:15:33 2019
@@ -6,27 +6,27 @@
 	char	*optnam; 
 	int	*optadd;
 } options [] = {
-	"expand", &expflg,
-	"EXPAND", &expflg,
-	"center", &ctrflg,
-	"CENTER", &ctrflg,
-	"box", &boxflg,
-	"BOX", &boxflg,
-	"allbox", &allflg,
-	"ALLBOX", &allflg,
-	"doublebox", &dboxflg,
-	"DOUBLEBOX", &dboxflg,
-	"frame", &boxflg,
-	"FRAME", &boxflg,
-	"doubleframe", &dboxflg,
-	"DOUBLEFRAME", &dboxflg,
-	"tab", &tab,
-	"TAB", &tab,
-	"linesize", &linsize,
-	"LINESIZE", &linsize,
-	"delim", &delim1,
-	"DELIM", &delim1,
-	0, 0
+	{ "expand",		&expflg  },
+	{ "EXPAND",		&expflg  },
+	{ "center", 		&ctrflg  },
+	{ "CENTER",		&ctrflg  },
+	{ "box",		&boxflg  },
+	{ "BOX",		&boxflg  },
+	{ "allbox",		&allflg  },
+	{ "ALLBOX",		&allflg  },
+	{ "doublebox",		&dboxflg },
+	{ "DOUBLEBOX",		&dboxflg },
+	{ "frame",		&boxflg  },
+	{ "FRAME",		&boxflg  },
+	{ "doubleframe",	&dboxflg },
+	{ "DOUBLEFRAME",	&dboxflg },
+	{ "tab",		&tab     },
+	{ "TAB",		&tab     },
+	{ "linesize",		&linsize },
+	{ "LINESIZE",		&linsize },
+	{ "delim",		&delim1  },
+	{ "DELIM",		&delim1  },
+	{ 0, 			0	 }
 };
 
 void
diff -urN tbl.orig/t4.c tbl/t4.c
--- tbl.orig/t4.c	Tue May  7 19:43:35 2019
+++ tbl/t4.c	Tue May  7 19:20:14 2019
@@ -43,7 +43,7 @@
 	char	sn[10], *snp, *temp;
 
 	sawchar = icol = 0;
-	while (c = get1char()) {
+	while ((c = get1char())) {
 		switch (c) {
 		default:
 			if (c != tab) {
@@ -182,7 +182,7 @@
 			if (icol <= 0) 
 				continue;
 			temp = snp = csize[icol-1][nclin];
-			while (c = get1char()) {
+			while ((c = get1char())) {
 				if (c == ' ' || c == tab || c == '\n') 
 					break;
 				if (c == '-' || c == '+')
@@ -207,7 +207,7 @@
 			if (icol <= 0) 
 				continue;
 			temp = snp = vsize[icol-1][nclin];
-			while (c = get1char()) {
+			while ((c = get1char())) {
 				if (c == ' ' || c == tab || c == '\n') 
 					break;
 				if (c == '-' || c == '+')
@@ -229,7 +229,7 @@
 		case 'W':
 			snp = cll [icol-1];
 			stopc = 0;
-			while (c = get1char()) {
+			while ((c = get1char())) {
 				if (snp == cll[icol-1] && c == '(') {
 					stopc = ')';
 					continue;
@@ -305,7 +305,7 @@
 		;
 	if (c != '\n')
 		un1getc(c);
-	for (s = line; *s = c = get1char(); s++) {
+	for (s = line; (*s = c = get1char()); s++) {
 		if (c == ')') 
 			inpar = 0;
 		if (inpar) 
diff -urN tbl.orig/t5.c tbl/t5.c
--- tbl.orig/t5.c	Tue May  7 19:43:35 2019
+++ tbl/t5.c	Tue May  7 19:17:58 2019
@@ -31,7 +31,7 @@
 		} else 
 			instead[nlin] = 0;
 		if (nodata(nlin)) {
-			if (ch = oneh(nlin))
+			if ((ch = oneh(nlin)))
 				fullbot[nlin] = ch;
 			table[nlin] = (struct colstr *) alocv((ncol + 2) * sizeof(table[0][0]));
 			for (icol = 0; icol < ncol; icol++) {
diff -urN tbl.orig/t6.c tbl/t6.c
--- tbl.orig/t6.c	Tue May  7 19:43:35 2019
+++ tbl/t6.c	Tue May  7 19:18:26 2019
@@ -102,7 +102,7 @@
 			    reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP);
 		}
 		for (ilin = 0; ilin < nlin; ilin++)
-			if (k = lspan(ilin, icol)) {
+			if ((k = lspan(ilin, icol))) {
 				ss = table[ilin][icol-k].col;
 				if (!real(ss) || barent(ss) || vspen(ss) ) 
 					continue;
diff -urN tbl.orig/t8.c tbl/t8.c
--- tbl.orig/t8.c	Tue May  7 19:43:35 2019
+++ tbl/t8.c	Tue May  7 19:22:34 2019
@@ -227,11 +227,11 @@
 			fprintf(tabout, "%c", F1);
 		}
 		ip = prev(nl);
-		if (ip >= 0)
+		if (ip >= 0) {
 			if (vspen(table[ip][c].col)) {
 				exvspen = (c + 1 < ncol) && vspen(table[ip][c+1].col) && 
 				    (topat[c] == topat[c+1]) && 
-				    (cmidx == (flags[c+1] [stynum[nl]] & (CTOP | CDOWN) == 0))
+				    (cmidx == ((flags[c+1] [stynum[nl]] & (CTOP | CDOWN)) == 0))
 				     && (left(i, c + 1, &lwid) < 0);
 				if (exvspen == 0) {
 					fprintf(tabout, "\\v'(\\n(\\*(#du-\\n(^%cu", c + 'a');
@@ -245,6 +245,7 @@
 			}
 			else
 				exvspen = 0;
+		}
 		/* if lines need to be split for gcos here is the place for a backslash */
 		if (vct > 7 && c < ncol) {
 			fprintf(tabout, "\n.sp-1\n\\&");
diff -urN tbl.orig/t9.c tbl/t9.c
--- tbl.orig/t9.c	Tue May  7 19:43:35 2019
+++ tbl/t9.c	Tue May  7 19:25:21 2019
@@ -1,6 +1,6 @@
 /* t9.c: write lines for tables over 200 lines */
 # include "t.h"
-static useln;
+static int useln;
 
 void
 yetmore(void)
diff -urN tbl.orig/te.c tbl/te.c
--- tbl.orig/te.c	Tue May  7 19:43:35 2019
+++ tbl/te.c	Tue May  7 14:35:28 2019
@@ -1,5 +1,6 @@
 /* te.c: error message control, input line count */
 #include <string.h>
+#include <stdlib.h>
 #include "t.h"
 
 void error(char *s)
diff -urN tbl.orig/tm.c tbl/tm.c
--- tbl.orig/tm.c	Tue May  7 19:43:35 2019
+++ tbl/tm.c	Tue May  7 19:06:35 2019
@@ -37,7 +37,7 @@
 		exlim = exstore + MAXCHS;
 	}
 	q = exstore;
-	while (*exstore++ = *str++)
+	while ((*exstore++ = *str++))
 		;
 	*p = 0;
 	return(q);
@@ -50,7 +50,7 @@
 				/* true if s is in a eqn within p */
 	int	ineq = 0, c;
 
-	while (c = *p) {
+	while ((c = *p)) {
 		if (s == p)
 			return(ineq);
 		p++;
diff -urN tbl.orig/ts.c tbl/ts.c
--- tbl.orig/ts.c	Tue May  7 19:43:35 2019
+++ tbl/ts.c	Tue May  7 19:05:35 2019
@@ -64,7 +64,7 @@
 void
 tcopy (char *s, char *t)
 {
-	while (*s++ = *t++)
+	while ((*s++ = *t++))
 		;
 }
 
diff -urN tbl.orig/tt.c tbl/tt.c
--- tbl.orig/tt.c	Tue May  7 19:43:35 2019
+++ tbl/tt.c	Tue May  7 19:17:15 2019
@@ -119,7 +119,7 @@
 		return(1);
 	if (vspen(s)) 
 		return(1);
-	if (t = barent( s))
+	if ((t = barent( s)))
 		return(t);
 	return(0);
 }

Better CJK support

.fp - CN SourceHanSansCN-Regular
.fp - JP SourceHanSansJP-Regular
.fp - KR SourceHanSansKR-Regular
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
.ft CN
天地玄黄,宇宙洪荒。日月盈昃,辰宿列张。寒来暑往,秋收冬藏。闰余成岁,律召调阳。云腾致雨,露结为霜。金生丽水,玉出昆冈。剑号巨阙,珠称夜光。果珍李柰,菜重芥姜。海咸河淡,鳞潜羽翔。龙师火帝,鸟官人皇。始制文字,乃服衣裳。推位让国,有虞陶唐。吊民伐罪,周发殷汤。坐朝问道,垂拱平章。爱育黎首,臣伏戎羌。遐迩一体,率宾归王。鸣凤在树,白驹食场。化被草木,赖及万方。盖此身发,四大五常。恭惟鞠养,岂敢毁伤。女慕贞絜,男效才良。知过必改,得能莫忘。罔谈彼短,靡恃己长。信使可覆,器欲难量。墨悲丝染,诗赞羔羊。景行维贤,克念作圣。德建名立,形端表正。空谷传声,虚堂习听。祸因恶积,福缘善庆。尺璧非宝,寸阴是竞。资父事君,曰严与敬。孝当竭力,忠则尽命。临深履薄,夙兴温凊。似兰斯馨,如松之盛。川流不息,渊澄取映。容止若思,言辞安定。笃初诚美,慎终宜令。荣业所基,藉甚无竟。学优登仕,摄职从政。存以甘棠,去而益咏。乐殊贵贱,礼别尊卑。上和下睦,夫唱妇随。外受傅训,入奉母仪。诸姑伯叔,犹子比儿。孔怀兄弟,同气连枝。交友投分,切磨箴规。仁慈隐恻,造次弗离。节义廉退,颠沛匪亏。性静情逸,心动神疲。守真志满,逐物意移。坚持雅操,好爵自縻。都邑华夏,东西二京。背邙面洛,浮渭据泾。宫殿盘郁,楼观飞惊。图写禽兽,画彩仙灵。丙舍傍启,甲帐对楹。肆筵设席,鼓瑟吹笙。升阶纳陛,弁转疑星。右通广内,左达承明。既集坟典,亦聚群英。杜稿锺隶,漆书壁经。府罗将相,路侠槐卿。户封八县,家给千兵。高冠陪辇,驱毂振缨。世禄侈富,车驾肥轻。策功茂实,勒碑刻铭。磻溪伊尹,佐时阿衡。奄宅曲阜,微旦孰营。桓公匡合,济弱扶倾。绮回汉惠,说感武丁。俊乂密勿,多士寔宁。晋楚更霸,赵魏困横。假途灭虢,践土会盟。何遵约法,韩弊烦刑。起翦颇牧,用军最精。宣威沙漠,驰誉丹青。九州禹迹,百郡秦并。岳宗恒岱,禅主云亭。雁门紫塞,鸡田赤城。昆池碣石,钜野洞庭。旷远绵邈,岩岫杳冥。治本于农,务兹稼穑。俶载南亩,我艺黍稷。税熟贡新,劝赏黜陟。孟轲敦素,史鱼秉直。庶几中庸,劳谦谨敕。聆音察理,鉴貌辨色。贻厥嘉猷,勉其祗植。省躬讥诫,宠增抗极。殆辱近耻,林皋幸即。两疏见机,解组谁逼。索居闲处,沉默寂寥。求古寻论,散虑逍遥。欣奏累遣,戚谢欢招。渠荷的历,园莽抽条。枇杷晚翠,梧桐早凋。陈根委翳,落叶飘飖。游鹍独运,凌摩绛霄。耽读玩市,寓目囊箱。易𬨎攸畏,属耳垣墙。具膳餐饭,适口充肠。饱饫烹宰,饥厌糟糠。亲戚故旧,老少异粮。妾御绩纺,侍巾帷房。纨扇圆洁,银烛炜煌。昼眠夕寐,蓝笋象床。弦歌酒宴,接杯举觞。矫手顿足,悦豫且康。嫡后嗣续,祭祀烝尝。稽颡再拜,悚惧恐惶。笺牒简要,顾答审详。骸垢想浴,执热愿凉。驴骡犊特,骇跃超骧。诛斩贼盗,捕获叛亡。布射僚丸,嵇琴阮啸。恬笔伦纸,钧巧任钓。释纷利俗,并皆佳妙。毛施淑姿,工颦妍笑。年矢每催,曦晖朗曜。璿玑悬斡,晦魄环照。指薪修祜,永绥吉劭。矩步引领,俯仰廊庙。束带矜庄,徘徊瞻眺。孤陋寡闻,愚蒙等诮。谓语助者,焉哉乎也。
.ft JP
しかし私は、喜びを非難して苦痛を賞賛するという誤ったこの考えがすべてどのようにして誕生したかをあなたに説明しなければならないから、私はあなたにその体系を完璧に説明し、真実を求める偉大な探究家、人間の喜びを築く建築家の実践的な教えを詳しく説明しよう。だれも喜びそのものを、それが喜びであるという理由で拒んだり、嫌ったり、避けたりはしない。しかし、どのようにして喜びを理性的に追求するかを知らない人たちは非常に苦痛な結末に直面する。同様に、苦痛そのものを、それが苦痛であるという理由で愛したり、探したり、手に入れることを望んだりする者もいない。しかし、ときには苦労や苦痛がその人に大いなる喜びをいくらかもたらす状況がおこることがある。些末な例を挙げると、私たちのうちのだれが、そこから何か有益なものを得られないのに、骨の折れる肉体**を引き受けるだろうか?しかしだれに、いらだたしい結末のない喜びを享受することを選ぶ人や、その結果としての喜びを生み出さないような痛みを避ける人にある、落ち度を見つける権利はあるのだろうか?
.ft KR
역시 마찬가지로, 단순히 고통이라는 이유 때문에 고통 그 자체를 사랑하거나 추구하거나 소유하려는 자는 없다. 다만 노역과 고통이 아주 큰 즐거움을 선사하는 상황이 때로는 발생하기 때문에 고통을 찾는 사람이 있는 것이다. 간단한 예를 들자면, 모종의 이익을 얻을 수도 없는데 힘든 육체적 노력을 기꺼이 할 사람이 우리들 중에 과연 있겠는가? 하지만 귀찮은 일이 뒤따르지 않는 즐거움을 누리는 것을 선택한 사람, 혹은 아무런 즐거움도 생기지 않는 고통을 회피하는 사람을 누가 탓할 수 있겠는가?

With roff test.ms | pdf -pa4 >test.pdf, the above document produces:
img

The problems are:

  • Chinese and Japanese text run off the page
  • Missing Chinese characters

The fonts are avilable at https://github.com/adobe-fonts/source-han-sans/tree/release/SubsetOTF.
Font description files are generated with mkfn -o -f /path/to/font.otf -b </path/to/font.otf >/path/to/devutf/font.

Escapes in character definitions not expanded correctly

See for instance this test case implementing "smart quotes" (adopted from Groff/MOM macros):

.nr #OPEN_CLOSE 0
.ds $QUOTE0 \(Fo
.ds $QUOTE1 \(Fc
.char " \\*[$QUOTE\\n[#OPEN_CLOSE]]\R'#OPEN_CLOSE (1-\\n[#OPEN_CLOSE])'
.
Hello "world"

You can also try the easier definition .char " \\*[$QUOTE0] for testing purposes.
cdef_expand() is responsible as far as I understand.
Is this even supposed to be supported by Neatroff?

Change Lucent License to MIT. Lucent is Non-Free.

The Lucent license is considered a non-free software license [1].
I assume part of the troff stuff is licensed under the Lucent 1.02 license is because you used code from Plan9.
Nokia bought Bell labs, and gave the copyright of Plan9 to the Plan9 Foundation [2][3].
The Plan9 foundation relicensed all the code to the MIT license [3].
What this means, is that the plan9 code here is eligible to be used under the MIT License.
If I am understanding correctly, your contributions are also under the Lucent license.
README says this stuff is ISC Licensed, so I assume you will have no issue with relicensing the parts of troff that you wrote, as the other parts of troff are now eligible under both Lucent or MIT.
You should remove the Lucent bullcrap!

[theo@thinkpad ~/.local/src/neatroff_make]$ cat troff/NOTICE 
Copyright (C) 2003, Lucent Technologies Inc. and others. All Rights Reserved.
Copyright (C) 2011-2012, Ali Gholami Rudi

The original code as distributed by Lucent and the second copyright holder's
contributions are under Lucent Public License, Version 1.02.

Should be changed to, Copyright whatever, but under the MIT License.

References:

  1. https://www.gnu.org/philosophy/plan-nine.html
  2. https://www.bell-labs.com/institute/blog/plan-9-bell-labs-cyberspace/
  3. https://p9f.org/about.html

Text cannot be copied/extracted from neatpdf-generated files with OpenType fonts

PDF files generated by neatpdf look fine in a PDF viewer, but the text in them cannot be copied to the clipboard nor extracted with pdftotext when (some?) OpenType fonts are used. For example the following input file:

.fp - M Minion-Pro-Regular
.fp - G Garamond-Premier-Pro
.ft R
R: “Vimperator Vjol” fi
.sp
.ft M
Minion Pro: “Vimperator Vjol” fi
.sp
.ft G
Garamond Premier Pro: “Vimperator Vjol” fi

converted to PDF which is then run through pdftotext results in the following output:

R: “Vimperator Vjol” fi
.JOJPO 1SP7JNQFSBUPS 7KPMw ĕ
(BSBNPOE 1SFNJFS 1SP7JNQFSBUPS 7KPMu ઔ

So text which uses a Postscript font (the default R) comes through fine, text that uses the two Adobe OpenType fonts is garbled. I didn't test with a traditional TrueType font yet.

It is possible to work around this by using neatpdf and ps2pdf, but do you think this could be fixed in metapdf?

Use case: I'm updating my CV and it looks great, but unfortunately some companies process applications with automated systems and a non-machine-readable PDF may be a problem.

tbl command segfault

If you have a table with 37 columns, you will consistently crash tbl as the reg function will overrun the nregs array and SEGFAULT:

.sp 1 .ce 1 .ps +10 Deployments .sp 1 .ps -10 .ce 0 .TS center, box, tab(;); cB s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s l | c1 | c1 | c1 | c1| c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1 | c1. Area _ .TE

While handling an arbitrary number of columns would be nice, it shouldn't crash at a minimum.

Can't set PREFIX to different directory

I want to install to /usr/local/src/neatroff so that I can use GNU
Stow to symlink binaries to /usr/local. Here is what I tried:

sudo make init CC='gcc -march=native' PREFIX=/usr/local/src/neatroff
sudo make neat CC='gcc -march=native' PREFIX=/usr/local/src/neatroff

The second command fails with

./gen.sh: Font </usr/local/src/neatroff/fonts/NimbusRoman-Regular.afm> not found!

Also, curious about one thing: do I have to run both commands as sudo if
I want to install into a root-owned directory? Usually programs will
allow you to run make as unprivileged and only require root for
make install. I don't think there is an easy way to install, the
'neat' target simply builds but doesn't install.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.