shithub: neatpost

Download patch

ref: 0df35af1c2bbe3ebf58e9fa93abf3a609b4da6ee
parent: 50e2d0333a13835c9f80c3c65d645eb256869dbb
author: Ali Gholami Rudi <ali@rudi.ir>
date: Wed Apr 23 14:50:05 EDT 2014

dev: do not search special fonts for characters

This seems unnecessary, since neatroff always switches to the font
containing each character before its output.

--- a/dev.c
+++ b/dev.c
@@ -4,12 +4,12 @@
 #include <string.h>
 #include "post.h"
 
-char dev_dir[PATHLEN];	/* device directory */
-char dev_dev[PATHLEN];	/* output device name */
-int dev_res;		/* device resolution */
-int dev_uwid;		/* device unitwidth */
-int dev_hor;		/* minimum horizontal movement */
-int dev_ver;		/* minimum vertical movement */
+static char dev_dir[PATHLEN];	/* device directory */
+static char dev_dev[PATHLEN];	/* output device name */
+int dev_res;			/* device resolution */
+int dev_uwid;			/* device unitwidth */
+int dev_hor;			/* minimum horizontal movement */
+int dev_ver;			/* minimum vertical movement */
 
 /* mounted fonts */
 static char fn_name[NFONTS][FNLEN];	/* font names */
@@ -106,28 +106,11 @@
 	}
 }
 
-static struct glyph *dev_glyph_byid(char *id, int fn)
-{
-	return font_glyph(fn_font[fn], id);
-}
-
 struct glyph *dev_glyph(char *c, int fn)
 {
-	struct glyph *g;
-	int i;
-	g = font_find(fn_font[fn], c);
-	if (g)
-		return g;
-	for (i = 0; i < NFONTS; i++)
-		if (fn_font[i] && fn_font[i]->special)
-			if ((g = font_find(fn_font[i], c)))
-				return g;
-	return !strncmp("GID=", c, 4) ? dev_glyph_byid(c + 4, fn) : NULL;
-}
-
-int dev_kernpair(char *c1, char *c2)
-{
-	return 0;
+	if (!strncmp("GID=", c, 4))
+		return font_glyph(fn_font[fn], c + 4);
+	return font_find(fn_font[fn], c);
 }
 
 /* return the font struct at pos */