summaryrefslogtreecommitdiffstats
path: root/print/tex-xdvik/files/patch-texk-xdvik-font-open.c
blob: fc0186d0d54847f558540118b43069e05cbefcf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
--- texk/xdvik/font-open.c.orig	2014-09-02 18:41:34.000000000 +0900
+++ texk/xdvik/font-open.c	2015-01-31 21:02:18.000000000 +0900
@@ -27,6 +27,9 @@
 #include "xdvi-config.h"
 #include "xdvi.h"
 #include "dvi-draw.h"
+#ifdef PTEX
+#include "ptexmap.h"
+#endif
 #include "util.h"
 #include "events.h"
 #include "dvi-init.h"
@@ -213,6 +216,38 @@
 		p_node->value = xmemdup(p, len + 1);
 		*p_tail = p_node;
 		p_tail = &p_node->next;
+	    } else if (*p == 'x') {
+		char *name;
+
+		name = NULL;
+		do ++p;
+		while (*p == ' ' || *p == '\t');
+
+		if (*p == '+')
+		    do ++p;
+		    while (*p == ' ' || *p == '\t');
+
+		name = strtok(p, " \t");
+		if (name == NULL) {
+		    XDVI_WARNING((stderr, "Syntax error in entry \"%s\" "
+			"(ignored)", ffline));
+		    continue;
+		}
+		read_ptexmap_file(name);
+	    } else if (*p == 'r') {
+		char *name, *ptr;
+
+		name = ptr = NULL;
+		do ++p;
+		while (*p == ' ' || *p == '\t');
+		name = strtok(p, " \t");
+		if ((name == NULL) ||
+		    (ptr  = strtok(NULL, " \t")) == NULL) {
+		    XDVI_WARNING((stderr, "Syntax error in entry \"%s\" "
+			"(ignored)", ffline));
+		    continue;
+		}
+		add_replace_dictionary(name, ptr);
 	    }
 	}
 
@@ -446,13 +481,38 @@
 		TRACE_FT((stderr, "Encoding[%d]: '%s' = '%s' -> '%s'",
 		  i, enc, name, ptr));
 #  endif
+#ifdef PTEX
+	    }
+	    else if (strcmp(keyword, "ptexmap") == 0) {
+		if ((ptr = strtok(NULL, delim)) == NULL) {
+		    XDVI_WARNING((stderr,
+			    "Syntax error in entry \"%s\" (skipping line)",
+			    ffline));
+		    continue;
+		}
+		read_ptexmap_file(ptr);
+	    }
+	    else if (strcmp(keyword, "replace") == 0) {
+		if ((name = strtok(NULL, delim)) == NULL ||
+		    (ptr  = strtok(NULL, delim)) == NULL) {
+		    XDVI_WARNING((stderr,
+			    "Syntax error in entry \"%s\" (skipping line)",
+			    ffline));
+		    continue;
+		}
+		add_replace_dictionary(name, ptr);
+#endif
 	    } else {
 		/* again, nag them with a popup so that they'll do something
 		   about this ... */
 		popup_message(globals.widgets.top_level,
 			  MSG_ERR,
 			  "Please check the syntax of your config file.  "
+#ifdef PTEX
+			  "Valid keywords are: \"enc\", \"dvipsmap\", \"ptexmap\" and \"replace\".",
+#else
 			  "Valid keywords are: \"enc\" and \"dvipsmap\".",
+#endif
 			  "Skipping unknown keyword \"%s\" in config file %s.",
 			  keyword, filename);
 	    }
@@ -1103,7 +1163,7 @@
 	    if (ttype == GS_EOF || ttype == GS_ERR)
 		break;
 	    if (ttype == LPAREN) {
-		Boolean	quiet = False;
+	        Boolean quiet = False;
 		FILE	*f1;
 
 		ttype = get_gs_token(&gsf, pos1, &pos2, "Fontmap");
@@ -1692,7 +1752,7 @@
 	  const char **font_ret,
 	  int *dpi_ret)
 {
-    char *name;
+    char *name = NULL;
     kpse_glyph_file_type file_ret;
 #if DELAYED_MKTEXPK
     Boolean message_done = False;
@@ -1706,6 +1766,12 @@
     fontp->filename = NULL;
     *dpi_ret = fontp->fsize;
 
+#ifdef PTEX
+     /* for kanji, first try jfm's, then 8-bit vf's (not 16bit ovf's). */
+    if (iskanjifont(fontp->fontname))
+	name = kpse_find_tfm(fontp->fontname);
+    else
+#endif /* PTEX */
     if (resource.omega) { /* for omega, first try 16-bit ovf's, then 8-bit vf's. */
 	name = kpse_find_ovf(fontp->fontname);
 	if (name == NULL)
OpenPOWER on IntegriCloud