summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c
blob: 88757af288c7f30a684eb41e75f49e370fcbd81a (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256

/* some dummy functions and variables so that a few ff source files can be ignored */

#include "uiinterface.h"
#include "fontforgevw.h"
#include "splinefont.h"
#include <stdarg.h>
#include <stdio.h>
#include <basics.h>
#include <ustring.h>


char **gww_errors = NULL;
int gww_error_count = 0;

void gwwv_errors_free (void) { 
  int i;
  if (gww_error_count>0) {
	for (i=0;i<gww_error_count;i++) {
	  free(gww_errors[i]);
	}
	free(gww_errors);
	gww_error_count = 0;
	gww_errors = NULL;
  }
}


static void LUAUI_IError(const char *format,...) {
    va_list ap;
    va_start(ap,format);
    fprintf(stderr, "Internal Error: " );
    vfprintf(stderr,format,ap);
    va_end(ap);
}

static void LUAUI__LogError(const char *format,va_list ap) {
    char buffer[400], *str;
    vsnprintf(buffer,sizeof(buffer),format,ap);
    str = utf82def_copy(buffer);
    gww_errors = realloc(gww_errors, (gww_error_count+2)*sizeof(char *));
    if (gww_errors==NULL) {
	  perror("memory allocation failed");
      exit(EXIT_FAILURE);
    }
    gww_errors[gww_error_count ] = str ;
    gww_error_count ++;
    gww_errors[gww_error_count ] = NULL;
}

/* this is not static because it is used by gwwiconv.c */

void LUAUI_LogError(const char *format,...) {
    va_list ap;
    va_start(ap,format);
    LUAUI__LogError(format,ap);
    va_end(ap);
}

static void LUAUI_post_notice(const char *title,const char *statement,...) {
    va_list ap;
    (void)title;
    va_start(ap,statement);
    LUAUI__LogError(statement,ap);
    va_end(ap);
}

static void LUAUI_post_error(const char *title,const char *statement,...) {
    va_list ap;
    (void)title;
    va_start(ap,statement);
    LUAUI__LogError(statement,ap);
    va_end(ap);
}

static int LUAUI_ask(const char *title, const char **answers,
	int def, int cancel,const char *question,...) {
  (void)title;
  (void)answers;
  (void)cancel;
  (void)question;
return( def );
}

static int LUAUI_choose(const char *title, const char **choices,int cnt, int def,
	const char *question,...) {
  (void)title;
  (void)choices;
  (void)cnt;
  (void)question;
return( def );
}

static int LUAUI_choose_multiple(char *title, const char **choices,char *sel,
	int cnt, char *buts[2], const char *question,...) {
  (void)title;
  (void)choices;
  (void)sel;
  (void)cnt;
  (void)buts;
  (void)question;
return( -1 );
}

static char *LUAUI_ask_string(const char *title, const char *def,
	const char *question,...) {
  (void)title;
  (void)def;
  (void)question;
return( (char *) def );
}

static char *LUAUI_open_file(const char *title, const char *defaultfile,
	const char *initial_filter) {
  (void)title;
  (void)initial_filter;
  (void)defaultfile;
return( NULL );
}

static char *LUAUI_saveas_file(const char *title, const char *defaultfile,
	const char *initial_filter) {
  (void)title;
  (void)initial_filter;
return( copy(defaultfile) );
}

static void LUAUI_progress_start(int delay, const char *title, const char *line1,
	const char *line2, int tot, int stages) {
  (void)delay;
  (void)title;
  (void)line1;
  (void)line2;
  (void)tot;
  (void)stages;
}

static void LUAUI_void_void_noop(void) {
}

static void LUAUI_void_int_noop(int useless) {
  (void)useless;
}

static int LUAUI_int_int_noop(int useless) {
  (void)useless;
return( true );
}

static void LUAUI_void_str_noop(const char * useless) {
  (void)useless;
}

static int LUAUI_alwaystrue(void) {
return( true );
}

static int LUAUI_DefaultStrokeFlags(void) {
return( sf_correctdir );
}

struct ui_interface luaui_interface = {
    LUAUI_IError,
    LUAUI_post_error,
    LUAUI_LogError,
    LUAUI_post_notice,
    LUAUI_ask,
    LUAUI_choose,
    LUAUI_choose_multiple,
    LUAUI_ask_string,
    LUAUI_ask_string,			/* password */
    LUAUI_open_file,
    LUAUI_saveas_file,

    LUAUI_progress_start,
    LUAUI_void_void_noop,
    LUAUI_void_void_noop,
    LUAUI_void_int_noop,
    LUAUI_alwaystrue,
    LUAUI_alwaystrue,
    LUAUI_int_int_noop,
    LUAUI_void_str_noop,
    LUAUI_void_str_noop,
    LUAUI_void_void_noop,
    LUAUI_void_void_noop,
    LUAUI_void_int_noop,
    LUAUI_void_int_noop,
    LUAUI_alwaystrue,

    LUAUI_void_void_noop,

    NOUI_TTFNameIds,
    NOUI_MSLangString,

    LUAUI_DefaultStrokeFlags
};

/* some bits and pieces */

int URLFromFile(char *url,FILE *from) { 
  (void)url;
  (void)from;
  return false; 
}

/* print.c */
int pagewidth = 0, pageheight=0;	/* In points */
char *printlazyprinter=NULL;
char *printcommand=NULL;
int printtype = 0;

void ScriptPrint(FontViewBase *fv,int type,int32 *pointsizes,char *samplefile,
	unichar_t *sample, char *outputfile) {
  (void)fv;
  (void)type;
  (void)pointsizes;
  (void)samplefile;
  (void)sample;
  (void)outputfile;
}

int PdfDumpGlyphResources(void *pi, SplineChar *sc) {
  (void)pi;
  (void)sc;
  return 0;
}

/* autotrace.c */
int autotrace_ask=0, mf_ask=0, mf_clearbackgrounds=0, mf_showerrors=0;
char *mf_args = NULL;
int preferpotrace=0;

void *GetAutoTraceArgs(void) {
return NULL;
}

void SetAutoTraceArgs(void *a) {
  (void)a;
}

void FVAutoTrace(FontViewBase *fv,int ask) {
  (void)fv; (void)ask;
}

SplineFont *SFFromMF(char *filename) {
  (void)filename;
return NULL;
}

/* http.c */

FILE *URLToTempFile(char *url,void *_lock) {
  (void)_lock; (void)url;
   ff_post_error(_("Could not parse URL"),_("FontForge only handles ftp and http URLs at the moment"));
return( NULL );
}