shithub: neatroff

Download patch

ref: f18f6453e6a1392810ee834c9468abc799447dae
parent: d108830148da4b473a9bc2690fa29f8a0359149b
author: Ali Gholami Rudi <ali@rudi.ir>
date: Wed Jul 10 15:33:05 EDT 2013

ren: add \N for selecting glyphs based on their device-dependent name

--- a/font.c
+++ b/font.c
@@ -48,8 +48,8 @@
 		}
 		fscanf(fin, "%s", tok);
 		glyph = prev;
-+		if (!strcmp("---", name))
-+			sprintf(name, "c%04d", fn->n);
+		if (!strcmp("---", name))
+			sprintf(name, "c%04d", fn->n);
 		if (strcmp("\"", tok)) {
 			wid = atoi(tok);
 			fscanf(fin, "%d %s", &type, id);
--- a/ren.c
+++ b/ren.c
@@ -635,6 +635,7 @@
 {
 	char c[GNLEN * 4];
 	char arg[ILNLEN];
+	struct glyph *g;
 	char *s;
 	int w, n, l;
 	nextchar(c, next);
@@ -684,8 +685,13 @@
 				ren_transparent(arg);
 			}
 			return;
-		} else if (strchr(" bCcDdfhkLlmoprsuvXxz0^|{}&", c[1])) {
+		} else if (strchr(" bCcDdfhkLlmNoprsuvXxz0^|{}&", c[1])) {
 			escarg_ren(arg, c[1], next, back);
+			if (c[1] == 'N') {
+				g = dev_glyph_byid(arg, n_f);
+				c[1] = 'C';
+				strcpy(arg, g ? g->name : "cnull");
+			}
 			if (c[1] != 'C') {
 				ren_cmd(wb, c[1], arg);
 				return;