shithub: neatpost

Download patch

ref: 1c3135b842d4715d7458c8118d9a95ecb79112ff
parent: 7a81319b8ffbca4661af25814661e3d183d1bfac
author: Ali Gholami Rudi <ali@rudi.ir>
date: Thu Nov 19 06:13:57 EST 2015

post: draw all glyphs with glyphshow with -n option

--- a/out.c
+++ b/out.c
@@ -10,6 +10,7 @@
 static int o_qtype;		/* queued character type */
 static int o_qv, o_qh, o_qend;	/* queued character position */
 static int o_rh, o_rv, o_rdeg;	/* previous rotation position and degree */
+static int o_gname;		/* use glyphshow for all glyphs */
 
 char o_fonts[FNLEN * NFONTS] = " ";
 
@@ -35,6 +36,11 @@
 	o_qtype = 0;
 }
 
+void outgname(int g)
+{
+	o_gname = g;
+}
+
 void outpage(void)
 {
 	o_flush();
@@ -48,7 +54,7 @@
 
 static void o_queue(struct glyph *g)
 {
-	int type = 1 + (g->pos <= 0);
+	int type = 1 + (g->pos <= 0 || o_gname);
 	if (o_qtype != type || o_qend != o_h || o_qv != o_v) {
 		o_flush();
 		o_qh = o_h;
--- a/post.c
+++ b/post.c
@@ -1,7 +1,7 @@
 /*
  * neatpost troff postscript postprocessor
  *
- * Copyright (C) 2013-2014 Ali Gholami Rudi <ali at rudi dot ir>
+ * Copyright (C) 2013-2015 Ali Gholami Rudi <ali at rudi dot ir>
  *
  * This program is released under the Modified BSD license.
  */
@@ -412,7 +412,8 @@
 	"Options:\n"
 	"  -F dir  \tset font directory (" TROFFFDIR ")\n"
 	"  -p size \tset paper size (letter); e.g., a4, 2100x2970\n"
-	"  -w lwid \tdrawing line thickness in thousandths of an em (40)\n";
+	"  -w lwid \tdrawing line thickness in thousandths of an em (40)\n"
+	"  -n      \talways draw glyphs by name (ps glyphshow)\n";
 
 int main(int argc, char *argv[])
 {
@@ -424,6 +425,8 @@
 			setpagesize(argv[i][2] ? argv[i] + 2 : argv[++i]);
 		} else if (argv[i][0] == '-' && argv[i][1] == 'w') {
 			ps_linewidth = atoi(argv[i][2] ? argv[i] + 2 : argv[++i]);
+		} else if (argv[i][0] == '-' && argv[i][1] == 'n') {
+			outgname(1);
 		} else {
 			printf("%s", usage);
 			return 0;
--- a/post.h
+++ b/post.h
@@ -55,6 +55,7 @@
 void outeps(char *eps);
 void outpage(void);
 void outmnt(int f);
+void outgname(int g);
 extern char o_fonts[];
 
 void drawbeg(void);