ref: 9c922c6d20518ad8485f3d21b12a9a0e1c8f9426
parent: 80d889ac641f0c0793c8b8f3335ab68cb6e85c94
author: Ali Gholami Rudi <ali@rudi.ir>
date: Sat Apr 26 15:42:41 EDT 2014
trfn: add more glyphlist exceptions
--- a/trfn.c
+++ b/trfn.c
@@ -251,9 +251,12 @@
*s = '\0';
if (agl_map(ch)) {strcpy(d, agl_map(ch));
- for (i = 0; i < LEN(agl_exceptions); i++)
- if (!strcmp(agl_exceptions[i][0], d))
+ for (i = 0; i < LEN(agl_exceptions); i++) {+ if (!strcmp(agl_exceptions[i][0], d)) {strcpy(d, agl_exceptions[i][1]);
+ break;
+ }
+ }
d = strchr(d, '\0');
} else if (ch[0] == 'u' && ch[1] == 'n' && ch[2] == 'i') {for (i = 0; strlen(ch + 3 + 4 * i) >= 4; i++)
@@ -273,13 +276,17 @@
static void trfn_lig(char *c)
{int i;
+ for (i = 0; i < LEN(ligs_exceptions); i++)
+ if (!strcmp(ligs_exceptions[i], c))
+ return;
if (c[0] && c[1] && strlen(c) > utf8len((unsigned char) c[0])) {sprintf(strchr(trfn_ligs, '\0'), "%s ", c);
- return;
+ } else {+ for (i = 0; i < LEN(ligs_utf8); i++)
+ if (!strcmp(ligs_utf8[i][0], c))
+ sprintf(strchr(trfn_ligs, '\0'),
+ "%s ", ligs_utf8[i][1]);
}
- for (i = 0; i < LEN(ligs); i++)
- if (!strcmp(ligs[i], c))
- sprintf(strchr(trfn_ligs, '\0'), "%s ", c);
}
static int trfn_type(char *s, int lly, int ury)
--- a/trfn_ch.h
+++ b/trfn_ch.h
@@ -1,10 +1,5 @@
-/* ligatures */
-static char *ligs[] = {- "fh", "fi", "fj", "fk", "fl", "ff", "ffi", "ffj", "ffl", "fft", "ft", "Th"
-};
-
-/* AGL exceptions; expanding ligatures */
-static char *agl_exceptions[][2] = {+/* ligatures with unicode aliases */
+static char *ligs_utf8[][2] = { {"ff", "ff"}, {"fi", "fi"}, {"fl", "fl"},@@ -12,12 +7,33 @@
{"ffl", "ffl"}, {"st", "st"},};
+/* these are not ligatures */
+static char *ligs_exceptions[] = {+ "ga", "aq", "ti", "ha",
+};
+/* AGL exceptions */
+static char *agl_exceptions[][2] = {+ {"∆", "Δ"}, /* Delta -> Delatagreek */+ {"Ω", "Ω"}, /* Omega -> Omegagreek */+ {"‘", "`"}, /* quoteleft */+ {"`", "ga"}, /* grave */+ {"’", "'"}, /* quoteright */+ {"'", "aq"}, /* quotesingle */+ {"~", "ti"}, /* asciitilde; using tilde for ~ */+ {"^", "ha"}, /* asciicircum; using circumflex for ^ */+};
+
/* troff aliases */
static char *alts[][8] = { {"\\", "bs", "rs"},- {"`", "ga"},- {"¡", "!!"},+ {"`", "oq"},+ {"'", "cq"},+ {"ga", "\\`"},+ {"aq"},+ {"‚", "bq"},+ {"¡", "!!", "r!"},+ {"\"", "dq"}, {"¢", "c|", "ct"}, {"£", "L-", "ps"}, {"¤", "xo", "cr"},@@ -27,15 +43,16 @@
{"¨", "\"\"", ":a"}, {"©", "co"}, {"ª", "a_"},- {"«", "<<"},+ {"«", "<<", "Fo"},+ {"‹", "fo"}, {"¬", "-,", "no"}, {"-", "hy"}, {"®", "ro", "rg"},- {"¯", "a^", "-a"},+ {"¯", "-a"}, {"°", "0^"}, {"²", "2^"}, {"³", "3^"},- {"´", "\\'", "aa"},+ {"´", "aa", "\\'"}, {"µ", "/u"}, {"¶", "P!", "pg"}, {"·", ".^"},@@ -42,11 +59,14 @@
{"¸", ",,", ",a"}, {"¹", "1^"}, {"º", "o_"},- {"»", ">>"},+ {"»", ">>", "Fc"},+ {"›", "fc"}, {"¼", "14"}, {"½", "12"}, {"¾", "34"},- {"¿", "??"},+ {"¿", "??", "r?"},+ {"ˆ", "^", "^a"},+ {"˜", "~"}, {"À", "A`"}, {"Á", "A'"}, {"Â", "A^"},@@ -59,11 +79,11 @@
{"È", "E`"}, {"É", "E'"}, {"Ê", "E^"},- {"Ë", "E:", "E\""},+ {"Ë", "E:"}, {"Ì", "I`"}, {"Í", "I'"}, {"Î", "I^"},- {"Ï", "I:", "I\""},+ {"Ï", "I:"}, {"Ð", "D-"}, {"Ď", "D<"}, {"Ñ", "N~"},@@ -83,9 +103,9 @@
{"Û", "U^"}, {"Ü", "U:"}, {"Ű", "U\""},- {"Ů", "U0"},+ {"Ů", "U*"}, {"Ý", "Y'"},- {"Ÿ", "Y:", "Y\""},+ {"Ÿ", "Y:"}, {"Ž", "Z<"}, {"Þ", "TH"}, {"ß", "ss"},@@ -93,7 +113,7 @@
{"á", "a'"}, {"â", "a^"}, {"ã", "a~"},- {"ä", "a:", "a\""},+ {"ä", "a:"}, {"å", "a*"}, {"æ", "ae"}, {"ç", "c,"},@@ -102,12 +122,12 @@
{"è", "e`"}, {"é", "e'"}, {"ê", "e^"},- {"ë", "e:", "e\""},+ {"ë", "e:"}, {"ě", "e<"}, {"ì", "i`"}, {"í", "i'"}, {"î", "i^"},- {"ï", "i\""},+ {"ï", "i:"}, {"ð", "d-"}, {"ñ", "n~"}, {"ň", "n<"},@@ -127,11 +147,11 @@
{"û", "u^"}, {"ü", "u:"}, {"ű", "u\""},- {"ů", "u0"},+ {"ů", "u*"}, {"ý", "y'"}, {"ž", "z<"}, {"þ", "th"},- {"ÿ", "y:", "y\""},+ {"ÿ", "y:"}, {"˘", "Ua"}, {"˙", ".a"}, {"˚", "oa"},@@ -224,6 +244,7 @@
{"≡", "=="}, {"≈", "~~"}, {"…", "el"},+ {"‰", "%0"}, {"", "av"}, {"", "ah"}, {"↵", "CR"},@@ -281,8 +302,8 @@
{"", "rk"}, {"", "rb"}, {"_", "ru", "ul"},- {"”", "''"},- {"“", "``"},+ {"”", "''", "rq"},+ {"“", "``", "lq"}, {"⟨", "la"}, {"⟩", "ra"}, {"†", "dg"},@@ -289,12 +310,12 @@
{"‡", "dd"}, {"–", "en", "\\-"}, {"—", "em", "--"},- {"ff", "ff"},- {"fi", "fi"},- {"fl", "fl"},- {"ffi", "ffi"},- {"ffl", "ffl"},- {"st", "st"},+ {"ff", "ff"},+ {"fi", "fi"},+ {"fl", "fl"},+ {"ffi", "ffi", "Fi"},+ {"ffl", "ffl", "Fl"},+ {"st", "st"},};
/* different shapes of arabic and farsi characters */
--
⑨