shithub: neatpost

Download patch

ref: 26105a71b358d6f32fab17fcab865dbacf0205ec
parent: defe8978301dc27c9aabc302d325f113ac80b9ea
author: Ali Gholami Rudi <ali@rudi.ir>
date: Tue Apr 22 12:23:59 EDT 2014

dev: introduce \[GID=xyz] as an alias for \N'xyz'

--- a/dev.c
+++ b/dev.c
@@ -106,6 +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;
@@ -117,12 +122,7 @@
 		if (fn_font[i] && fn_font[i]->special)
 			if ((g = font_find(fn_font[i], c)))
 				return g;
-	return NULL;
-}
-
-struct glyph *dev_glyph_byid(char *id, int fn)
-{
-	return font_glyph(fn_font[fn], id);
+	return !strncmp("GID=", c, 4) ? dev_glyph_byid(c + 4, fn) : NULL;
 }
 
 int dev_kernpair(char *c1, char *c2)
--- a/post.h
+++ b/post.h
@@ -54,7 +54,6 @@
 int dev_fontid(struct font *fn);
 int charwid(int wid, int sz);
 struct glyph *dev_glyph(char *c, int fn);
-struct glyph *dev_glyph_byid(char *id, int fn);
 
 /* font-related functions */
 struct font *font_open(char *path);