ref: daa212b472395ed52524c2d54ffb46749cec774f
parent: 037f40d88f7f3f0c8ac5645cd2a4979f8ef98778
author: Ali Gholami Rudi <ali@rudi.ir>
date: Fri Nov 15 09:56:29 EST 2013
tr: map font name to font position earlier for .ochar
--- a/tr.c
+++ b/tr.c
@@ -556,7 +556,7 @@
/* character definition (.char) */
static char cdef_src[NCDEFS][GNLEN]; /* source character */
static char *cdef_dst[NCDEFS]; /* character definition */
-static char cdef_fn[NCDEFS][FNLEN]; /* owning font */
+static int cdef_fn[NCDEFS]; /* owning font */
static int cdef_n; /* number of defined characters */
static int cdef_expanding; /* inside cdef_expand() call */
@@ -564,8 +564,7 @@
{
int i;
for (i = 0; i < cdef_n; i++)
- if (!strcmp(cdef_src[i], c) &&
- (!cdef_fn[i][0] || dev_pos(cdef_fn[i]) == fn))
+ if (!strcmp(cdef_src[i], c) && (!cdef_fn[i] || cdef_fn[i] == fn))
return i;
return -1;
}
@@ -601,7 +600,7 @@
strncpy(cdef_src[i], c, sizeof(cdef_src[i]) - 1);
cdef_dst[i] = malloc(strlen(def) + 1);
strcpy(cdef_dst[i], def);
- strcpy(cdef_fn[i], fn ? fn : "");
+ cdef_fn[i] = fn ? dev_pos(fn) : 0;
}
}
@@ -616,7 +615,6 @@
free(cdef_dst[i]);
cdef_dst[i] = NULL;
cdef_src[i][0] = '\0';
- cdef_fn[i][0] = '\0';
}
}
}