w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

writet1.c
Go to the documentation of this file.
1 #ifdef pdfTeX /* writet1 used with pdfTeX */
2 #include "ptexlib.h"
3 #define t1_log(s) tex_printf(s)
4 #define t1_open() \
5  open_input(&t1_file, kpse_type1_format, FOPEN_RBIN_MODE)
6 #define enc_open() \
7  open_input(&enc_file, kpse_tex_ps_header_format, FOPEN_RBIN_MODE)
8 #define external_enc() enc_tab[fm_cur->encoding].glyph_names
9 #define full_file_name() nameoffile + 1
10 #define get_length1() t1_length1 = pdfoffset() - pdfsaveoffset
11 #define get_length2() t1_length2 = pdfoffset() - pdfsaveoffset
12 #define get_length3() t1_length3 = pdfoffset() - pdfsaveoffset
13 #define is_used_char(c) pdfcharmarked(tex_font, c)
14 #define out_eexec_char t1_putchar
15 #define save_offset() pdfsaveoffset = pdfoffset()
16 #define end_last_eexec_line() \
17  t1_eexec_encrypt = false
18 #define t1_putchar(c) pdfout(c)
19 #define update_cur_enc(font, glyph_names) update_enc(font, glyph_names)
20 #define t1_char(c) c
21 #define embed_all_glyphs(tex_font) \
22  fm_tab[pdffontmap[tex_font]].all_glyphs
23 #define extra_charset() fm_tab[pdffontmap[tex_font]].charset
25 
26 #else /* writet1 used with dvips */
27 #include "ptexmac.h"
28 #include "dvips.h"
29 #ifndef KPATHSEA
30 #define true 1
31 #define false 0
32 #define XTALLOC(n, t) ((t *) xmalloc ((n) * sizeof (t)))
33 #define xmalloc(size) malloc ((size) ? (size) : 1)
34 #define xstrdup(s) strdup(s)
35 #define xfclose(f, filename) fclose(f)
36 #endif
37 #undef fm_extend
38 #define fm_extend(f) 0
39 #undef fm_slant
40 #define fm_slant(f) 0
41 #undef is_reencoded
42 #define is_reencoded(f) (cur_enc_name != 0)
43 #undef is_subsetted
44 #define is_subsetted(f) true
45 #undef is_included
46 #define is_included(f) true
47 #undef set_cur_file_name
48 #define set_cur_file_name(s) cur_file_name = s
49 #ifdef ORIGINAL
50 #define t1_open() \
51  ((t1_file = search(headerpath, cur_file_name, FOPEN_RBIN_MODE)) != NULL)
52 #define enc_open() \
53  ((enc_file = search(headerpath, cur_file_name, FOPEN_RBIN_MODE)) != NULL)
54 #endif
55 #define external_enc() ext_glyph_names
56 #define full_file_name() cur_file_name
57 #define get_length1()
58 #define get_length2()
59 #define get_length3()
60 #define is_used_char(c) (grid[c] == 1)
61 #define out_eexec_char t1_outhex
62 #define save_offset()
63 #define end_last_eexec_line() \
64  hexline_length = HEXLINE_WIDTH; \
65  end_hexline(); \
66  t1_eexec_encrypt = false
67 #define t1_log(s)
68 #define t1_scan_only()
69 #define t1_include()
70 #define t1_putchar(c) fputc(c, outfp)
71 #define t1_scan_keys()
72 #define update_cur_enc(font, glyph_names)
73 #define embed_all_glyphs(tex_font) false
74 #ifdef SHIFTLOWCHARS
75 #define t1_char(c) T1Char(c)
76 #else /* SHIFTLOWCHARS */
77 #define t1_char(c) c
78 #endif /* SHIFTLOWCHARS */
79 #define extra_charset() 0
80 extern FILE *outfp ;
81 extern FILE *search();
82 static char *cur_file_name;
83 static char *cur_enc_name;
84 static unsigned char *grid;
85 static char *ext_glyph_names[MAX_CHAR_CODE + 1];
87 static int hexline_length;
88 static char notdef[] = ".notdef";
89 #endif /* pdfTeX */
90 
91 #ifdef ORIGINAL
92 #include <kpathsea/c-vararg.h>
93 #include <kpathsea/c-proto.h>
94 #endif
95 
96 #define t1_getchar() getc(t1_file)
97 #define t1_ungetchar(c) ungetc(c, t1_file)
98 #define t1_eof() feof(t1_file)
99 #define t1_close() xfclose(t1_file, cur_file_name)
100 
101 #define enc_getchar() getc(enc_file)
102 #define enc_eof() feof(enc_file)
103 #define enc_close() xfclose(enc_file, cur_file_name)
104 
105 #define valid_code(c) (c >= 0 && c <= MAX_CHAR_CODE)
106 
107 static char *standard_glyph_names[] = {
111 notdef, notdef, notdef, notdef, notdef, "space", "exclam", "quotedbl",
112 "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft",
113 "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash",
114 "zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
115 "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at",
116 "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O",
117 "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft",
118 "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a",
119 "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",
120 "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar",
121 "braceright", "asciitilde", notdef, notdef, notdef, notdef, notdef, notdef,
125 notdef, "exclamdown", "cent", "sterling", "fraction", "yen", "florin",
126 "section", "currency", "quotesingle", "quotedblleft", "guillemotleft",
127 "guilsinglleft", "guilsinglright", "fi", "fl", notdef, "endash", "dagger",
128 "daggerdbl", "periodcentered", notdef, "paragraph", "bullet",
129 "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright",
130 "ellipsis", "perthousand", notdef, "questiondown", notdef, "grave", "acute",
131 "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", notdef,
132 "ring", "cedilla", notdef, "hungarumlaut", "ogonek", "caron", "emdash",
135 "ordfeminine", notdef, notdef, notdef, notdef, "Lslash", "Oslash", "OE",
136 "ordmasculine", notdef, notdef, notdef, notdef, notdef, "ae", notdef, notdef,
137 notdef, "dotlessi", notdef, notdef, "lslash", "oslash", "oe", "germandbls",
139 };
140 
143 static boolean read_encoding_only;
144 static int t1_encoding;
145 
146 typedef char *extra_glyphs_entry;
148 static int extra_glyphs_max;
149 
150 #define T1_BUF_SIZE 4096
151 #define ENC_BUF_SIZE 1024
152 
153 #define ENC_STANDARD 0
154 #define ENC_BUILTIN 1
155 
156 #define CS_HSTEM 1
157 #define CS_VSTEM 3
158 #define CS_VMOVETO 4
159 #define CS_RLINETO 5
160 #define CS_HLINETO 6
161 #define CS_VLINETO 7
162 #define CS_RRCURVETO 8
163 #define CS_CLOSEPATH 9
164 #define CS_CALLSUBR 10
165 #define CS_RETURN 11
166 #define CS_ESCAPE 12
167 #define CS_HSBW 13
168 #define CS_ENDCHAR 14
169 #define CS_RMOVETO 21
170 #define CS_HMOVETO 22
171 #define CS_VHCURVETO 30
172 #define CS_HVCURVETO 31
173 #define CS_1BYTE_MAX (CS_HVCURVETO + 1)
174 
175 #define CS_DOTSECTION CS_1BYTE_MAX + 0
176 #define CS_VSTEM3 CS_1BYTE_MAX + 1
177 #define CS_HSTEM3 CS_1BYTE_MAX + 2
178 #define CS_SEAC CS_1BYTE_MAX + 6
179 #define CS_SBW CS_1BYTE_MAX + 7
180 #define CS_DIV CS_1BYTE_MAX + 12
181 #define CS_CALLOTHERSUBR CS_1BYTE_MAX + 16
182 #define CS_POP CS_1BYTE_MAX + 17
183 #define CS_SETCURRENTPOINT CS_1BYTE_MAX + 33
184 #define CS_2BYTE_MAX (CS_SETCURRENTPOINT + 1)
185 #define CS_MAX CS_2BYTE_MAX
186 
187 typedef unsigned char byte;
188 
189 typedef struct {
190  byte nargs; /* number of arguments */
191  boolean bottom; /* take arguments from bottom of stack? */
192  boolean clear; /* clear stack? */
193  boolean valid;
194 } cc_entry; /* CharString Command */
195 
196 typedef struct {
197  char *name; /* glyph name (or notdef for Subrs entry) */
198  byte *data;
199  unsigned short len; /* length of the whole string */
200  unsigned short cslen; /* length of the encoded part of the string */
201  boolean used;
202  boolean valid;
203 } cs_entry;
204 
205 static unsigned short t1_dr, t1_er;
206 static unsigned short t1_c1 = 52845, t1_c2 = 22719;
207 static unsigned short t1_cslen, t1_lenIV;
209 static char enc_line[ENC_BUF_SIZE];
210 
211 static char *cs_start;
212 
214 static char *cs_dict_start, *cs_dict_end;
216 
220 
222 static int t1_in_eexec; /* 0 before eexec-encrypted, 1 during, 2 after */
223 static long t1_block_length;
224 static int last_hexbyte;
225 static FILE *t1_file;
226 static FILE *enc_file;
227 
228 #define str_prefix(s1, s2) (strncmp(s1, s2, strlen(s2)) == 0)
229 #define t1_prefix(s) str_prefix(t1_line, s)
230 #define t1_charstrings() strstr(t1_line, "/CharStrings")
231 #define t1_subrs() t1_prefix("/Subrs")
232 #define t1_end_eexec() t1_suffix("mark currentfile closefile")
233 #define t1_cleartomark() t1_prefix("cleartomark")
234 
235 #ifndef pdfTeX
236 #ifdef ORIGINAL
237 static void pdftex_fail(char *fmt,...)
238 {
239  va_list args;
240  va_start(args, fmt);
241  fputs("\nError: module writet1", stderr);
242  if (cur_file_name)
243  fprintf(stderr, " (file %s)", cur_file_name);
244  fputs(": ", stderr);
245  vsprintf(print_buf, fmt, args);
246  fputs(print_buf, stderr);
247  fputs("\n", stderr);
248  va_end(args);
249  exit(-1);
250 }
251 
252 static void pdftex_warn(char *fmt,...)
253 {
254  va_list args;
255  va_start(args, fmt);
256  fputs("\nWarning: module writet1 of dvips", stderr);
257  if (cur_file_name)
258  fprintf(stderr, " (file %s)", cur_file_name);
259  fputs(": ", stderr);
260  vsprintf(print_buf, fmt, args);
261  fputs(print_buf, stderr);
262  fputs("\n", stderr);
263  va_end(args);
264 }
265 #else
266 static void pdftex_fail();
267 static void pdftex_warn();
268 #endif
269 
270 #define HEXLINE_WIDTH 64
271 
272 static void end_hexline()
273 {
274  if (hexline_length == HEXLINE_WIDTH) {
275  fputs("\n", outfp);
276  hexline_length = 0;
277  }
278 }
279 
280 static void t1_outhex(byte b)
281 {
282  static char *hexdigits = "0123456789ABCDEF";
283  t1_putchar(hexdigits[b/16]);
284  t1_putchar(hexdigits[b%16]);
285  hexline_length += 2;
286  end_hexline();
287 }
288 #endif /* pdfTeX */
289 
290 static void enc_getline(void)
291 {
292  char *p;
293  int c;
294 restart:
295  if (enc_eof())
296  pdftex_fail("unexpected end of file");
297  p = enc_line;
298  do {
299  c = enc_getchar();
301  } while (c != 10);
303  if (p - enc_line <= 2 || *enc_line == '%')
304  goto restart;
305 }
306 
307 void load_enc(char *enc_name, char **glyph_names)
308 {
309  char buf[ENC_BUF_SIZE], *p, *r;
310  int names_count;
312  if (!enc_open()) {
313  pdftex_warn("cannot open encoding file for reading");
314  cur_file_name = 0;
315  return;
316  }
317  t1_log("{");
319  enc_getline();
320  if (*enc_line != '/' || (r = strchr(enc_line, '[')) == NULL) {
322  pdftex_fail("invalid encoding vector (a name or `[' missing): `%s'", enc_line);
323  }
324  names_count = 0;
325  r++; /* skip '[' */
326  skip(r, ' ');
327  for (;;) {
328  while (*r == '/') {
329  for (p = buf, r++; *r != ' ' && *r != 10 && *r != ']' && *r != '/'; *p++ = *r++);
330  *p = 0;
331  skip(r, ' ');
333  pdftex_fail("encoding vector contains more than %i names",
334  (int)(MAX_CHAR_CODE + 1));
335  if (strcmp(buf, notdef) != 0)
336  glyph_names[names_count] = xstrdup(buf);
337  names_count++;
338  }
339  if (*r != 10 && *r != '%') {
340  if (strncmp(r, "] def", strlen("] def")) == 0)
341  goto done;
342  else {
344  pdftex_fail("invalid encoding vector: a name or `] def' expected: `%s'", enc_line);
345  }
346  }
347  enc_getline();
348  r = enc_line;
349  }
350 done:
351  enc_close();
352  t1_log("}");
353  cur_file_name = 0;
354 }
355 
356 static void t1_check_pfa(void)
357 {
358  int c = t1_getchar();
359  if (c != 128)
360  t1_pfa = true;
361  else
362  t1_pfa = false;
363  t1_ungetchar(c);
364 }
365 
366 static int t1_getbyte(void)
367 {
368  int c = t1_getchar();
369  if (t1_pfa)
370  return c;
371  if (t1_block_length == 0) {
372  if (c != 128)
373  pdftex_fail("invalid marker");
374  c = t1_getchar();
375  if (c == 3)
376  return EOF;
377  t1_block_length = t1_getchar() & 0xff;
378  t1_block_length |= (t1_getchar() & 0xff) << 8;
379  t1_block_length |= (t1_getchar() & 0xff) << 16;
380  t1_block_length |= (t1_getchar() & 0xff) << 24;
381  c = t1_getchar();
382  }
383  t1_block_length--;
384  return c;
385 }
386 
387 static int hexval(int c)
388 {
389  if (c >= 'A' && c <= 'F')
390  return c - 'A' + 10;
391  else if (c >= 'a' && c <= 'f')
392  return c - 'a' + 10;
393  else if (c >= '0' && c <= '9')
394  return c - '0';
395  else
396  return -1;
397 }
398 
399 static byte edecrypt(byte cipher)
400 {
401  byte plain;
402  if (t1_pfa) {
403  while (cipher == 10 || cipher == 13)
404  cipher = t1_getbyte();
405  last_hexbyte = cipher = (hexval(cipher) << 4) + hexval(t1_getbyte());
406  }
407  plain = (cipher^(t1_dr >> 8));
408  t1_dr = (cipher + t1_dr)*t1_c1 + t1_c2;
409  return plain;
410 }
411 
412 static byte cdecrypt(byte cipher, unsigned short *cr)
413 {
414  byte plain = (cipher^(*cr >> 8));
415  *cr = (cipher + *cr)*t1_c1 + t1_c2;
416  return plain;
417 }
418 
419 static byte eencrypt(byte plain)
420 {
421  byte cipher = (plain^(t1_er >> 8));
422  t1_er = (cipher + t1_er)*t1_c1 + t1_c2;
423  return cipher;
424 }
425 
426 static char *eol(char *s)
427 {
428  char *p = strend(s);
429  if (p - s > 1 && p[-1] != 10) {
430  *p++ = 10;
431  *p = 0;
432  }
433  return p;
434 }
435 
436 static boolean t1_suffix(char *s)
437 {
438  char *s1 = t1_line_ptr - 1,
439  *s2 = strend(s) - 1;
440  if (*s1 == 10)
441  s1--;
442  while (s1 >= t1_line && s2 >= s) {
443  if (*s1-- != *s2--)
444  return false;
445  }
446  return s1 >= t1_line - 1;
447 }
448 
449 static void t1_getline(void)
450 {
451  int c, l, eexec_scan;
452  char *p;
453  static char eexec_str[] = "currentfile eexec";
454  static int eexec_len = 17; /* strlen(eexec_str) */
455 restart:
456  if (t1_eof())
457  pdftex_fail("unexpected end of file");
459  t1_cslen = 0;
460  eexec_scan = 0;
461  c = t1_getbyte();
462  if (c == EOF)
463  return;
464  while (!t1_eof()) {
465  if (t1_in_eexec == 1)
466  c = edecrypt((byte)c);
468  if (t1_in_eexec == 0 && eexec_scan >= 0 && eexec_scan < eexec_len) {
469  if (t1_line[eexec_scan] == eexec_str[eexec_scan])
470  eexec_scan++;
471  else
472  eexec_scan = -1;
473  }
474  if (c == 10 || (t1_pfa && eexec_scan == eexec_len && c == 32))
475  break;
476  if (t1_cs && t1_cslen == 0 &&
477  (t1_line_ptr - t1_line > 4) &&
478  (t1_suffix(" RD ") || t1_suffix(" -| ")))
479  {
480  p = t1_line_ptr - 5;
481  while (*p != ' ')
482  p--;
483  t1_cslen = l = atoi(p + 1);
486  while (l-- > 0)
487  *t1_line_ptr++ = edecrypt((byte)t1_getbyte());
488  }
489  c = t1_getbyte();
490  }
492  if (t1_line_ptr - t1_line <= 1)
493  goto restart;
494  if (eexec_scan == eexec_len)
495  t1_in_eexec = 1;
496 }
497 
498 static void t1_putline(void)
499 {
500  char *p = t1_line;
501  if (t1_line_ptr - t1_line <= 1)
502  return;
503  if (t1_eexec_encrypt)
504  while (p < t1_line_ptr)
506  else
507  while (p < t1_line_ptr)
508  t1_putchar(*p++);
509 }
510 
511 static void t1_puts(char *s)
512 {
513  if (s != t1_line)
514  strcpy(t1_line, s);
516  t1_putline();
517 }
518 
519 #ifdef ORIGINAL
520 static void t1_printf(char *fmt,...)
521 {
522  va_list args;
523  va_start(args, fmt);
524  vsprintf(t1_line, fmt, args);
525  t1_puts(t1_line);
526  va_end(args);
527 }
528 #else
529 static void t1_printf(fmt, a, b, c)
530 char *fmt;
531 char *a, *b, *c;
532 {
533  sprintf(t1_line, fmt, a, b, c);
534  t1_puts(t1_line);
535 }
536 #endif
537 
538 static void t1_init_params(char *open_name_prefix)
539 {
540  t1_log(open_name_prefix);
542  t1_lenIV = 4;
543  t1_dr = 55665;
544  t1_er = 55665;
545  t1_in_eexec = 0;
546  t1_cs = false;
547  t1_scan = true;
548  t1_synthetic = false;
549  t1_eexec_encrypt = false;
550  t1_block_length = 0;
551  t1_check_pfa();
552 }
553 
554 static void t1_close_font_file(char *close_name_suffix)
555 {
556  t1_log(close_name_suffix);
557  t1_close();
558  cur_file_name = 0;
559 }
560 
561 static void t1_check_block_len(boolean decrypt)
562 {
563  int l, c;
564  if (t1_block_length == 0)
565  return;
566  c = t1_getbyte();
567  if (decrypt)
568  c = edecrypt((byte)c);
569  l = t1_block_length;
570  if (!(l == 0 && (c == 10 || c == 13))) {
571  pdftex_warn("%i bytes more than expected were ignored", l + 1);
572  while (l-- > 0)
573  t1_getbyte();
574  }
575 }
576 
577 static void t1_start_eexec(void)
578 {
579  int i, c;
580  if (is_included(fm_cur)) {
581  get_length1();
582  save_offset();
583  }
584  if (!t1_pfa)
585  t1_check_block_len(false);
586  for (t1_line_ptr = t1_line, i = 0; i < 4; i++) {
587  edecrypt((byte)t1_getbyte());
588  *t1_line_ptr++ = 0;
589  }
590  t1_eexec_encrypt = true;
591  if (is_included(fm_cur))
592  t1_putline(); /* to put the first four bytes */
593 }
594 
595 static void t1_stop_eexec(void)
596 {
597  int c;
598  if (is_included(fm_cur)) {
599  get_length2();
600  save_offset();
601  }
603  if (!t1_pfa)
604  t1_check_block_len(true);
605  else {
606  c = edecrypt((byte)t1_getbyte());
607  if (!(c == 10 || c == 13))
608  if (last_hexbyte == 0)
609  t1_puts("00");
610  else
611  pdftex_warn("unexpected data after eexec");
612  }
613  t1_cs = false;
614  t1_in_eexec = 2;
615 }
616 
617 #ifdef pdfTeX
618 static void t1_modify_fm(void)
619 {
620  /*
621  * font matrix is given as six numbers a0..a5, which stands for the matrix
622  *
623  * a0 a1 0
624  * M = a2 a3 0
625  * a4 a5 1
626  *
627  * ExtendFont is given as
628  *
629  * e 0 0
630  * E = 0 1 0
631  * 0 0 1
632  *
633  * SlantFont is given as
634  *
635  * 1 0 0
636  * S = s 1 0
637  * 0 0 1
638  *
639  * and the final transformation is
640  *
641  * e*a0 e*a1 0
642  * F = E.S.M = s*e*a0+a2 s*e*a1+a3 0
643  * a4 a5 1
644  */
645  float e, s, a[6], b[6];
646  int i, c;
647  char *p, *q;
648  if ((p = strchr(t1_line, '[')) == 0)
649  if ((p = strchr(t1_line, '{')) == 0) {
650  remove_eol(p, t1_line);
651  pdftex_fail("FontMatrix: an array expected: `%s'", t1_line);
652  }
653  c = *p; /* save the character '[' resp. '{' */
654  strncpy(t1_buf, t1_line, p - t1_line + 1);
655  if (sscanf(p + 1, "%f %f %f %f %f %f",
656  a, a + 1, a + 2, a + 3, a + 4, a + 5) != 6) {
657  remove_eol(p, t1_line);
658  pdftex_fail("FontMatrix: six numbers expected: `%s'", t1_line);
659  }
660  if (fm_extend(fm_cur) != 0)
661  e = fm_extend(fm_cur)*1E-3;
662  else
663  e = 1;
664  s = fm_slant(fm_cur)*1E-3;
665  b[0] = e*a[0];
666  b[1] = e*a[1];
667  b[2] = s*e*a[0] + a[2];
668  b[3] = s*e*a[1] + a[3];
669  b[4] = a[4];
670  b[5] = a[5];
671  q = t1_buf + (p - t1_line + 1);
672  for (i = 0; i < 6; i++) {
673  sprintf(q, "%G ", b[i]);
674  q = strend(q);
675  }
676  if (c == '[') {
677  while (*p != ']' && *p != 0)
678  p++;
679  }
680  else {
681  while (*p != '}' && *p != 0)
682  p++;
683  }
684  if (*p == 0) {
685  remove_eol(p, t1_line);
686  pdftex_fail("FontMatrix: cannot find the corresponding character to '%c': `%s'", c, t1_line);
687  }
688  strcpy(q, p);
691 }
692 
693 static void t1_modify_italic(void)
694 {
695  float a;
696  char buf[1024], *p, *r;
697  if (fm_slant(fm_cur) == 0)
698  return;
699  p = strchr(t1_line, ' ');
700  strncpy(t1_buf, t1_line, p - t1_line + 1);
701  sscanf(p + 1, "%f", &a);
702  for (r = p + 1; *r != ' ' && *r != 10; r++);
703  a -= atan(fm_slant(fm_cur)*1E-3)*(180/M_PI);
704  sprintf(t1_buf + (p - t1_line + 1), "%.2g", a);
705  strcpy(strend(t1_buf), r);
708  font_keys[ITALIC_ANGLE_CODE].value.i = (a > 0) ? a + 0.5 : a - 0.5;
709  font_keys[ITALIC_ANGLE_CODE].valid = true;
710 }
711 
712 static void t1_scan_keys(void)
713 {
714  int i, k;
715  char *p, *q, *r;
716  key_entry *key;
717  if (fm_extend(fm_cur) != 0 || fm_slant(fm_cur) != 0) {
718  if (strncmp(t1_line + 1, "FontMatrix", strlen("FontMatrix")) == 0) {
719  t1_modify_fm();
720  return;
721  }
722  if (strncmp(t1_line + 1, "ItalicAngle", strlen("ItalicAngle")) == 0) {
724  return;
725  }
726  }
727  for (key = font_keys; key - font_keys < MAX_KEY_CODE; key++)
728  if (strncmp(t1_line + 1, key->t1name, strlen(key->t1name)) == 0)
729  break;
730  if (key - font_keys == MAX_KEY_CODE)
731  return;
732  key->valid = true;
733  p = t1_line + strlen(key->t1name) + 1;
734  skip(p, ' ');
735  if ((k = key - font_keys) == FONTNAME_CODE) {
736  if (*p != '/') {
737  remove_eol(p, t1_line);
738  pdftex_fail("a name expected: `%s'", t1_line);
739  }
740  r = ++p; /* skip the slash */
741  for (q = t1_buf; *p != ' ' && *p != 10; *q++ = *p++);
742  *q = 0;
743  if (fm_extend(fm_cur) != 0) {
744  sprintf(q, "-Extend_%i", (int)fm_extend(fm_cur));
745  }
746  if (fm_slant(fm_cur) != 0) {
747  sprintf(q, "-Slant_%i", (int)fm_slant(fm_cur));
748  }
749  key->value.s = xstrdup(t1_buf);
750  if (is_included(fm_cur) && is_subsetted(fm_cur)) {
751  strcpy(t1_buf, p);
752  sprintf(r, "%s+%s%s", fm_cur->subset_tag, key->value.s, t1_buf);
753  t1_line_ptr = eol(r);
754  }
755  return;
756  }
757  if ((k == STEMV_CODE || k == FONTBBOX1_CODE) &&
758  (*p == '[' || *p == '{'))
759  p++;
760  if (k == FONTBBOX1_CODE) {
761  for (i = 0; i < 4; i++) {
762  key[i].value.i = atoi(p);
763  skip(p, ' ');
764  skip(p, '-');
765  while (isdigit(*p))
766  p++;
767  }
768  return;
769  }
770  key->value.i = atoi(p);
771 }
772 #endif /* pdfTeX */
773 
774 static boolean t1_check_unique_id(void)
775 {
776  if (strncmp(t1_line, "/UniqueID", strlen("/UniqueID")) == 0) {
777  t1_line_ptr = t1_line; /* ignore the current line */
778  return true;
779  }
780  return false;
781 }
782 
783 static void t1_scan_param(void)
784 {
785  /*
786  if (t1_check_unique_id())
787  return;
788  */
789  if (!t1_scan || *t1_line != '/')
790  return;
791  if (t1_prefix("/lenIV")) {
792  t1_lenIV = atoi(strchr(t1_line, ' ') + 1);
793  return;
794  }
795  t1_scan_keys();
796 }
797 
798 static copy_glyph_names(char **glyph_names, int a, int b)
799 {
800  if (glyph_names[b] != notdef) {
801  free(glyph_names[b]);
802  glyph_names[b] = notdef;
803  }
804  if (glyph_names[a] != notdef) {
805  glyph_names[b] = xstrdup(glyph_names[a]);
806  }
807 }
808 
809 static void t1_builtin_enc(void)
810 {
811  int i, a, b, c, counter = 0;
812  char *r, *p;
813  char **glyph_names = t1_builtin_glyph_names;
814  /*
815  * At this moment "/Encoding" is the prefix of t1_line
816  *
817  * We have two possible forms of Encoding vector. The first case is
818  *
819  * /Encoding [/a /b /c...] readonly def
820  *
821  * and the second case can look like
822  *
823  * /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for
824  * dup 0 /x put
825  * dup 1 /y put
826  * ...
827  * readonly def
828  */
829  for (i = 0; i <= MAX_CHAR_CODE; i++)
830  glyph_names[i] = notdef;
831  if (t1_prefix("/Encoding [") || t1_prefix("/Encoding[")) { /* the first case */
832  r = strchr(t1_line, '[') + 1;
833  skip(r, ' ');
834  for(;;) {
835  while (*r == '/') {
836  for (p = t1_buf, r++;
837  *r != 32 && *r != 10 && *r != ']' && *r != '/';
838  *p++ = *r++);
839  *p = 0;
840  skip(r, ' ');
841  if (counter > MAX_CHAR_CODE)
842  pdftex_fail("encoding vector contains more than %i names",
843  (int)(MAX_CHAR_CODE + 1));
844  if (strcmp(t1_buf, notdef) != 0)
845  glyph_names[counter] = xstrdup(t1_buf);
846  counter++;
847  }
848  if (*r != 10 && *r != '%') {
849  if (str_prefix(r, "] def") || str_prefix(r, "] readonly def"))
850  break;
851  else {
852  remove_eol(r, t1_line);
853  pdftex_fail("a name or `] def' or `] readonly def' expected: `%s'",
854  t1_line);
855  }
856  }
857  t1_getline();
858  r = t1_line;
859  }
860  }
861  else { /* the second case */
862  for (p = strchr(t1_line, 10);
863  !(strcmp(p, "def\n") == 0 && p > t1_line && p[-1] == ' ');
864  ) {
865  if (*p == 10) {
866  t1_getline();
867  p = t1_line;
868  }
869  /*
870  check for `dup <index> <glyph> put'
871  */
872  if (sscanf(p, "dup %i%256s put", &i, t1_buf) == 2 &&
873  *t1_buf == '/' && valid_code(i)) {
874  if (strcmp(t1_buf + 1, notdef) != 0)
875  glyph_names[i] = xstrdup(t1_buf + 1);
876  p = strstr(p, " put") + strlen(" put");
877  skip(p, ' ');
878  }
879  /*
880  check for `dup dup <to> exch <from> get put'
881  */
882  else if (sscanf(p, "dup dup %i exch %i get put", &b, &a) == 2 &&
883  valid_code(a) && valid_code(b)) {
884  copy_glyph_names(glyph_names, a, b);
885  p = strstr(p, " get put") + strlen(" get put");
886  skip(p, ' ');
887  }
888  /*
889  check for `dup dup <from> <size> getinterval <to> exch putinterval'
890  */
891  else if (sscanf(p, "dup dup %i %i getinterval %i exch putinterval",
892  &a, &c, &b) == 3 &&
893  valid_code(a) && valid_code(b) && valid_code(c)) {
894  for (i = 0; i < c; i++)
895  copy_glyph_names(glyph_names, a + i, b + i);
896  p = strstr(p, " putinterval") + strlen(" putinterval");
897  skip(p, ' ');
898  }
899  else {
900  while (*p != ' ' && *p != 10)
901  p++;
902  skip(p, ' ');
903  }
904  }
905  }
906 }
907 
908 static void t1_check_predef_enc(void)
909 {
910  if (t1_suffix("def")) { /* predefined encoding */
911  sscanf(t1_line + strlen("/Encoding"), "%256s", t1_buf);
912  if (strcmp(t1_buf, "StandardEncoding") == 0)
914  else
915  pdftex_fail("cannot subset font (unknown predefined encoding `%s')",
916  t1_buf);
917  }
918  else
920 }
921 
922 static void t1_check_end(void)
923 {
924  if (t1_eof())
925  return;
926  t1_getline();
927  if (t1_prefix("{restore}"))
928  t1_putline();
929 }
930 
931 #ifdef pdfTeX
932 static boolean t1_open_fontfile(char *open_name_prefix)
933 {
934  if (fm_cur->ex_name != 0) {
935  set_cur_file_name(fm_cur->ex_name);
936  if (t1_open()) /* found mm instance */
937  goto open_ok;
938  }
939  if (fm_cur->found)
940  t1_file = xfopen(cur_file_name = fm_cur->ff_name, FOPEN_RBIN_MODE);
941  else {
942  set_cur_file_name(fm_cur->ff_name);
943  if (!t1_open()) {
944  pdftex_warn("cannot open Type 1 font file for reading");
945  return false;
946  }
947  fix_ffname(fm_cur, cur_file_name = full_file_name());
948  }
949  if (pdfexpandfont[f] != 0) { /* use ExtendFont to simulate MM instance */
950  if (fm_extend(fm_cur) == 0)
951  fm_extend(fm_cur) = 1000;
952  fm_extend(fm_cur) = xnoverd(fm_extend(fm_cur), 1000 + pdfexpandfont[f], 1000);
953  }
954 open_ok:
955  t1_init_params(open_name_prefix);
956  fontfile_found = true;
957  return true;
958 }
959 
960 boolean t1_read_enc(fm_entry *fm)
961 {
962  read_encoding_only = true;
963  fm_cur = fm;
964  if (!t1_open_fontfile("{"))
965  return false;
966  fix_ffname(fm_cur, cur_file_name = full_file_name());
967  while (!t1_prefix("/Encoding"))
968  t1_getline();
970  if (t1_encoding == ENC_BUILTIN)
971  t1_builtin_enc();
972  t1_close_font_file("}");
973  return true;
974 }
975 
976 static void t1_scan_only(void)
977 {
978  int i;
979  do {
980  t1_getline();
981  t1_scan_param();
982  } while (t1_in_eexec == 0);
983  t1_start_eexec();
984  do {
985  t1_getline();
986  t1_scan_param();
987  } while (!(t1_charstrings() || t1_subrs()));
988 }
989 
990 static void t1_include(void)
991 {
992  save_offset();
993  do {
994  t1_getline();
995  t1_scan_param();
996  t1_putline();
997  } while (t1_in_eexec == 0);
998  t1_start_eexec();
999  do {
1000  t1_getline();
1001  t1_scan_param();
1002  t1_putline();
1003  } while (!(t1_charstrings() || t1_subrs()));
1004  t1_cs = true;
1005  do {
1006  t1_getline();
1007  t1_putline();
1008  } while (!t1_end_eexec());
1009  t1_stop_eexec();
1010  do {
1011  t1_getline();
1012  t1_putline();
1013  } while (!t1_cleartomark());
1014  t1_check_end(); /* write "{restore}if" if found */
1015  get_length3();
1016 }
1017 
1018 #else /* not pdfTeX */
1019 static boolean t1_open_fontfile(char *open_name_prefix)
1020 {
1021  if (!t1_open())
1022  return false;
1023  t1_init_params(open_name_prefix);
1024  return true;
1025 }
1026 #endif /* pdfTeX */
1027 
1028 #define check_subr(subr) \
1029  if (subr >= subr_size || subr < 0) \
1030  pdftex_fail("Subrs array: entry index out of range (%i)", subr);
1031 
1032 static void cs_store(boolean is_subr)
1033 {
1034  char *p, *q;
1035  cs_entry *ptr;
1036  int subr;
1037  for (p = t1_line, q = t1_buf; *p != ' '; *q++ = *p++);
1038  *q = 0;
1039  if (is_subr) {
1040  subr = atoi(p + 1);
1041  check_subr(subr);
1042  ptr = subr_tab + subr;
1043  }
1044  else {
1045  ptr = cs_ptr++;
1046  if (strcmp(t1_buf + 1, notdef) == 0) /* skip the slash */
1047  ptr->name = notdef;
1048  else
1049  ptr->name = xstrdup(t1_buf + 1);
1050  }
1051  memcpy(t1_buf, cs_start - 4, t1_cslen + 4); /* copy " RD " + cs data to t1_buf */
1052  for (p = cs_start + t1_cslen, q = t1_buf + t1_cslen + 4; *p != 10; *q++ = *p++);
1053  /* copy the end of cs data to t1_buf */
1054  *q++ = 10;
1055  ptr->len = q - t1_buf;
1056  ptr->cslen = t1_cslen;
1057  ptr->data = xtalloc(ptr->len, byte);
1058  memcpy(ptr->data, t1_buf, ptr->len);
1059  ptr->valid = true;
1060 }
1061 
1062 #define store_subr() cs_store(true)
1063 #define store_cs() cs_store(false)
1064 
1065 #define CC_STACK_SIZE 24
1066 
1069 static boolean is_cc_init = false;
1070 
1071 
1072 #define cc_pop(N) \
1073  if (stack_ptr - cc_stack < (N)) \
1074  stack_error(N); \
1075  stack_ptr -= N
1076 
1077 #define stack_error(N) { \
1078  pdftex_warn("CharString: invalid access (%i) to stack (%i entries)", \
1079  N, stack_ptr - cc_stack); \
1080  cs_error = true; \
1081 }
1082 
1083 /*
1084 static integer cc_get(integer index)
1085 {
1086  if (index < 0) {
1087  if (stack_ptr + index < cc_stack )
1088  stack_error(stack_ptr - cc_stack + index);
1089  return *(stack_ptr + index);
1090  }
1091  else {
1092  if (cc_stack + index >= stack_ptr)
1093  stack_error(index);
1094  return cc_stack[index];
1095  }
1096 }
1097 */
1098 
1099 #define cc_get(N) ((N) < 0 ? *(stack_ptr + (N)) : *(cc_stack + (N)))
1100 
1101 #define cc_push(V) *stack_ptr++ = V
1102 #define cc_clear() stack_ptr = cc_stack
1103 
1104 #define set_cc(N, B, A, C) \
1105  cc_tab[N].nargs = A; \
1106  cc_tab[N].bottom = B; \
1107  cc_tab[N].clear = C; \
1108  cc_tab[N].valid = true
1109 
1110 static void cc_init(void)
1111 {
1112  int i;
1113  if (is_cc_init)
1114  return;
1115  for (i = 0; i < CS_MAX; i++)
1116  cc_tab[i].valid = false;
1117  set_cc(CS_HSTEM, true, 2, true);
1118  set_cc(CS_VSTEM, true, 2, true);
1119  set_cc(CS_VMOVETO, true, 1, true);
1120  set_cc(CS_RLINETO, true, 2, true);
1121  set_cc(CS_HLINETO, true, 1, true);
1122  set_cc(CS_VLINETO, true, 1, true);
1123  set_cc(CS_RRCURVETO, true, 6, true);
1124  set_cc(CS_CLOSEPATH, false, 0, true);
1125  set_cc(CS_CALLSUBR, false, 1, false);
1126  set_cc(CS_RETURN, false, 0, false);
1127  /*
1128  set_cc(CS_ESCAPE, false, 0, false);
1129  */
1130  set_cc(CS_HSBW, true, 2, true);
1131  set_cc(CS_ENDCHAR, false, 0, true);
1132  set_cc(CS_RMOVETO, true, 2, true);
1133  set_cc(CS_HMOVETO, true, 1, true);
1134  set_cc(CS_VHCURVETO, true, 4, true);
1135  set_cc(CS_HVCURVETO, true, 4, true);
1136  set_cc(CS_DOTSECTION, false, 0, true);
1137  set_cc(CS_VSTEM3, true, 6, true);
1138  set_cc(CS_HSTEM3, true, 6, true);
1139  set_cc(CS_SEAC, true, 5, true);
1140  set_cc(CS_SBW, true, 4, true);
1141  set_cc(CS_DIV, false, 2, false);
1142  set_cc(CS_CALLOTHERSUBR, false, 0, false);
1143  set_cc(CS_POP, false, 0, false);
1144  set_cc(CS_SETCURRENTPOINT, true, 2, true);
1145  is_cc_init = true;
1146 }
1147 
1148 #define cs_getchar() cdecrypt(*data++, &cr)
1149 
1150 #define mark_subr(n) cs_mark(0, n)
1151 #define mark_cs(s) cs_mark(s, 0)
1152 
1153 static void cs_mark(char *cs_name, int subr)
1154 {
1155  byte *data;
1156  int i, b, cs_len;
1157  integer a, a1, a2;
1158  unsigned short cr;
1159  boolean cs_error = false;
1160  static integer lastargOtherSubr3 = 3; /* the argument of last call to
1161  OtherSubrs[3] */
1162  cs_entry *ptr;
1163  cc_entry *cc;
1164  if (cs_name == 0) {
1165  check_subr(subr);
1166  ptr = subr_tab + subr;
1167  if (!ptr->valid)
1168  pdftex_fail("Subrs: entry `%i' is not valid", subr);
1169  }
1170  else {
1171  if (cs_notdef != 0 &&
1172  (cs_name == notdef || strcmp(cs_name, notdef) == 0))
1173  ptr = cs_notdef;
1174  else {
1175  for (ptr = cs_tab; ptr < cs_ptr; ptr++)
1176  if (strcmp(ptr->name, cs_name) == 0)
1177  break;
1178  if (ptr == cs_ptr) {
1179  pdftex_warn("glyph `%s' undefined", cs_name);
1180  return;
1181  }
1182  if (ptr->name == notdef)
1183  cs_notdef = ptr;
1184  }
1185  }
1186  /* only marked CharString entries and invalid entries can be skipped;
1187  valid marked subrs must be parsed to keep the stack */
1188  if (!ptr->valid || (ptr->used && cs_name != 0))
1189  return;
1190  ptr->used = true;
1191  cr = 4330;
1192  cs_len = ptr->cslen;
1193  data = ptr->data + 4;
1194  for (i = 0; i < t1_lenIV; i++, cs_len--)
1195  cs_getchar();
1196  while (cs_len > 0) {
1197  --cs_len;
1198  b = cs_getchar();
1199  if (b >= 32) {
1200  if (b <= 246)
1201  a = b - 139;
1202  else if (b <= 250) {
1203  --cs_len;
1204  a = ((b - 247) << 8) + 108 + cs_getchar();
1205  }
1206  else if (b <= 254) {
1207  --cs_len;
1208  a = -((b - 251) << 8) - 108 - cs_getchar();
1209  }
1210  else {
1211  cs_len -= 4;
1212  a = (cs_getchar() & 0xff) << 24;
1213  a |= (cs_getchar() & 0xff) << 16;
1214  a |= (cs_getchar() & 0xff) << 8;
1215  a |= (cs_getchar() & 0xff) << 0;
1216  if (sizeof(integer) > 4 && (a & 0x80000000))
1217  a |= ~0x7FFFFFFF;
1218  }
1219  cc_push(a);
1220  }
1221  else {
1222  if (b == CS_ESCAPE) {
1223  b = cs_getchar() + CS_1BYTE_MAX;
1224  cs_len--;
1225  }
1226  if (b >= CS_MAX) {
1227  pdftex_warn("CharString: command value out of range: %i",
1228  (int)b);
1229  cs_error = true;
1230  }
1231  cc = cc_tab + b;
1232  if (!cc->valid) {
1233  pdftex_warn("CharString: command not valid: %i", (int)b);
1234  cs_error = true;
1235  }
1236  if (cc->bottom && stack_ptr - cc_stack < cc->nargs) {
1237  pdftex_fail("CharString: less arguments on stack (%i) than required (%i)",
1238  (int)(stack_ptr - cc_stack), (int)cc->nargs);
1239  cs_error = true;
1240  }
1241  if (cc->clear && cc->bottom && stack_ptr - cc_stack > cc->nargs) {
1242  pdftex_warn("CharString: more operands on stack (%i) than required (%i)",
1243  (int)(stack_ptr - cc_stack), (int)cc->nargs);
1244  cs_error = true;
1245  }
1246  switch (cc - cc_tab) {
1247  case CS_CALLSUBR:
1248  a1 = cc_get(-1);
1249  cc_pop(1);
1250  mark_subr(a1);
1251  break;
1252  case CS_DIV:
1253  cc_pop(2);
1254  cc_push(0);
1255  break;
1256  case CS_CALLOTHERSUBR:
1257  if (cc_get(-1) == 3)
1258  lastargOtherSubr3 = cc_get(-3);
1259  a1 = cc_get(-2) + 2;
1260  cc_pop(a1);
1261  break;
1262  case CS_POP:
1263  cc_push(lastargOtherSubr3);
1264  /* the only case when we care about the value being pushed onto
1265  stack is when POP follows CALLOTHERSUBR (changing hints by
1266  OtherSubrs[3])
1267  */
1268  break;
1269  case CS_SEAC:
1270  a1 = cc_get(3);
1271  a2 = cc_get(4);
1272  cc_clear();
1275  break;
1276  default:
1277  if (cc->clear)
1278  cc_clear();
1279  }
1280  }
1281  if (cs_error) { /* an error occured during parsing */
1282  ptr->valid = false;
1283  ptr->used = false;
1284  return;
1285  }
1286  }
1287 }
1288 
1289 static void t1_subset_ascii_part(void)
1290 {
1291  int i;
1292  save_offset();
1293  t1_getline();
1294  while (!t1_prefix("/Encoding")) {
1295  t1_scan_param();
1296  t1_putline();
1297  t1_getline();
1298  }
1299  t1_check_predef_enc(); /* set t1_encoding to ENC_STANDARD or ENC_BUILTIN */
1300  if (t1_encoding == ENC_STANDARD)
1301  t1_putline(); /* write the predefined encoding */
1302  else /* read the built-in encoding into t1_builtin_glyph_names */
1303  t1_builtin_enc();
1304  if (is_reencoded(fm_cur))
1306  else if (t1_encoding == ENC_BUILTIN)
1308  else
1311  update_cur_enc(tex_font, t1_glyph_names); /* set glyph names for chars
1312  that have been moved from 0..32 range */
1313  if (t1_encoding != ENC_STANDARD) {
1314  t1_puts("/Encoding 256 array\n0 1 255 {1 index exch /.notdef put} for\n");
1315  for (i = 0; i <= MAX_CHAR_CODE; i++)
1316  if (is_used_char(i) && t1_glyph_names[i] != notdef)
1317  t1_printf("dup %i /%s put\n", (int)t1_char(i),
1318  t1_glyph_names[i]);
1319  t1_puts("readonly def\n");
1320  }
1321  do {
1322  t1_getline();
1323  t1_scan_param();
1324  t1_putline();
1325  } while (t1_in_eexec == 0);
1326 }
1327 
1328 #define t1_subr_flush() t1_flush_cs(true)
1329 #define t1_cs_flush() t1_flush_cs(false)
1330 
1331 static void t1_flush_cs(boolean);
1332 
1333 static void cs_init(void)
1334 {
1335  cs_ptr = cs_tab = 0;
1336  cs_dict_start = cs_dict_end = 0;
1337  cs_count = cs_size = cs_size_pos = 0;
1338  subr_tab = 0;
1341 }
1342 
1344 {
1345  cs->data = 0;
1346  cs->name = 0;
1347  cs->len = 0;
1348  cs->cslen = 0;
1349  cs->used = false;
1350  cs->valid = false;
1351 }
1352 
1353 static void t1_mark_glyphs(void);
1354 
1355 static void t1_read_subrs(void)
1356 {
1357  int i;
1358  char *s;
1359  cs_entry *ptr;
1360  t1_getline();
1361  while (!(t1_charstrings() || t1_subrs())) {
1362  t1_scan_param();
1363  t1_putline();
1364  t1_getline();
1365  }
1366 found:
1367  t1_cs = true;
1368  t1_scan = false;
1369  if (!t1_subrs())
1370  return;
1371  subr_size_pos = strlen("/Subrs") + 1;
1372  /* subr_size_pos points to the number indicating dict size after "/Subrs" */
1374  if (subr_size == 0) {
1375  while (!t1_charstrings())
1376  t1_getline();
1377  return;
1378  }
1380  for (ptr = subr_tab; ptr - subr_tab < subr_size; ptr++)
1381  init_cs_entry(ptr);
1383  t1_getline();
1384  while (t1_cslen) {
1385  store_subr();
1386  t1_getline();
1387  }
1388  /* mark the first four entries without parsing */
1389  for (i = 0; i < subr_size && i < 4; i++)
1390  subr_tab[i].used = true;
1391  /* the end of the Subrs array might have more than one line so we need to
1392  concatnate them to subr_array_end. Unfortunately some fonts don't have
1393  the Subrs array followed by the CharStrings dict immediately (synthetic
1394  fonts). If we cannot find CharStrings in next POST_SUBRS_SCAN lines then
1395  we will treat the font as synthetic and ignore everything until next
1396  Subrs is found
1397  */
1398 #define POST_SUBRS_SCAN 5
1399  s = t1_buf;
1400  *t1_buf = 0;
1401  for (i = 0; i < POST_SUBRS_SCAN; i++) {
1402  if (t1_charstrings())
1403  break;
1405  strcat(t1_buf, t1_line);
1406  s += t1_line_ptr - t1_line;
1407  t1_getline();
1408  }
1410  if (i == POST_SUBRS_SCAN) { /* CharStrings not found;
1411  suppose synthetic font */
1412  for (ptr = subr_tab; ptr - subr_tab < subr_size; ptr++)
1413  if (ptr->valid)
1414  xfree(ptr->data);
1415  xfree(subr_tab);
1418  cs_init();
1419  t1_cs = false;
1420  t1_synthetic = true;
1421  while (!(t1_charstrings() || t1_subrs()))
1422  t1_getline();
1423  goto found;
1424  }
1425 }
1426 
1427 static void t1_flush_cs(boolean is_subr)
1428 {
1429  char *p;
1430  cs_entry *tab, *end_tab, *ptr;
1431  char *start_line, *line_end;
1432  int count, size_pos;
1433  if (is_subr) {
1435  line_end = subr_array_end;
1436  size_pos = subr_size_pos;
1437  tab = subr_tab;
1438  end_tab = subr_tab + subr_size;
1439  count = subr_max + 1;
1440  }
1441  else {
1443  line_end = cs_dict_end;
1444  size_pos = cs_size_pos;
1445  tab = cs_tab;
1446  end_tab = cs_ptr;
1447  count = cs_count;
1448  }
1449  t1_line_ptr = t1_line;
1450  for (p = start_line; p - start_line < size_pos;)
1451  *t1_line_ptr++ = *p++;
1452  while (isdigit(*p))
1453  p++;
1454  sprintf(t1_line_ptr, "%u", count);
1455  strcat(t1_line_ptr, p);
1456  t1_line_ptr = eol(t1_line);
1457  t1_putline();
1458  for (ptr = tab; ptr < end_tab; ptr++) {
1459  if (ptr->used) {
1460  if (is_subr)
1461  sprintf(t1_line, "dup %u %u", ptr - tab, ptr->cslen);
1462  else
1463  sprintf(t1_line, "/%s %u", ptr->name, ptr->cslen);
1464  p = strend(t1_line);
1465  memcpy(p, ptr->data, ptr->len);
1466  t1_line_ptr = p + ptr->len;
1467  t1_putline();
1468  }
1469  xfree(ptr->data);
1470  if (ptr->name != 0 && ptr->name != notdef)
1471  xfree(ptr->name);
1472  }
1473  sprintf(t1_line, "%s", line_end);
1474  t1_line_ptr = eol(t1_line);
1475  t1_putline();
1476  xfree(tab);
1477  xfree(start_line);
1478  xfree(line_end);
1479 }
1480 
1481 static void t1_mark_glyphs(void)
1482 {
1483  int i;
1484  char *charset = extra_charset();
1485  char *g, *s, *r;
1486  cs_entry *ptr;
1488  if (t1_synthetic || embed_all_glyphs(tex_font)) { /* mark everything */
1489  if (cs_tab != 0)
1490  for (ptr = cs_tab; ptr < cs_ptr; ptr++)
1491  if (ptr->valid)
1492  ptr->used = true;
1493  if (subr_tab != 0) {
1494  for (ptr = subr_tab; ptr - subr_tab < subr_size; ptr++)
1495  if (ptr->valid)
1496  ptr->used = true;
1497  subr_max = subr_size - 1;
1498  }
1499  return;
1500  }
1501  mark_cs(notdef);
1502  for (i = 0; i <= MAX_CHAR_CODE; i++)
1503  if (is_used_char(i)) {
1504  if (t1_glyph_names[i] == notdef)
1505  pdftex_warn("character %i is mapped to %s", i, notdef);
1506  else
1508  }
1509  if (charset == 0)
1510  goto set_subr_max;
1511  g = s = charset + 1; /* skip the first '/' */
1512  r = strend(g);
1513  while (g < r) {
1514  while (*s != '/' && s < r)
1515  s++;
1516  *s = 0; /* terminate g by rewriting '/' to 0 */
1517  mark_cs(g);
1518  g = s + 1;
1519  }
1520 set_subr_max:
1521  if (subr_tab != 0)
1522  for (subr_max = -1, ptr = subr_tab; ptr - subr_tab < subr_size; ptr++)
1523  if (ptr->used && ptr - subr_tab > subr_max)
1524  subr_max = ptr - subr_tab;
1525 }
1526 
1527 static void t1_subset_charstrings(void)
1528 {
1529  int i;
1530  cs_entry *ptr;
1531  cs_size_pos = strstr(t1_line, "/CharStrings") + strlen("/CharStrings")
1532  - t1_line + 1;
1533  /* cs_size_pos points to the number indicating
1534  dict size after "/CharStrings" */
1537  for (ptr = cs_tab; ptr - cs_tab < cs_size; ptr++)
1538  init_cs_entry(ptr);
1539  cs_notdef = 0;
1541  t1_getline();
1542  while (t1_cslen) {
1543  store_cs();
1544  t1_getline();
1545  }
1547  t1_mark_glyphs();
1548  if (subr_tab != 0)
1549  t1_subr_flush();
1550  for (cs_count = 0, ptr = cs_tab; ptr < cs_ptr; ptr++)
1551  if (ptr->used)
1552  cs_count++;
1553  t1_cs_flush();
1554 }
1555 
1556 static void t1_subset_end(void)
1557 {
1558  int k;
1559  if (t1_synthetic) { /* copy to "dup /FontName get exch definefont pop" */
1560  while (!strstr(t1_line, "definefont")) {
1561  t1_getline();
1562  t1_putline();
1563  }
1564  while (!t1_end_eexec())
1565  t1_getline(); /* ignore the rest */
1566  t1_putline(); /* write "mark currentfile closefile" */
1567  }
1568  else while (!t1_end_eexec()) { /* copy to "mark currentfile closefile" */
1569  t1_getline();
1570  t1_putline();
1571  }
1572  t1_stop_eexec();
1573  while (!t1_cleartomark()) {
1574  t1_getline();
1575  t1_putline();
1576  }
1577  if (!t1_synthetic) /* don't check "{restore}if" for synthetic fonts */
1578  t1_check_end(); /* write "{restore}if" if found */
1579  get_length3();
1580 }
1581 
1582 void writet1(void)
1583 {
1584  read_encoding_only = false;
1585  if (!is_included(fm_cur)) { /* scan parameters from font file */
1586  if (!t1_open_fontfile("{"))
1587  return;
1588  t1_scan_only();
1589  t1_close_font_file("}");
1590  return;
1591  }
1592  if (!is_subsetted(fm_cur)) { /* include entire font */
1593  if (!t1_open_fontfile("<<"))
1594  return;
1595  t1_include();
1596  t1_close_font_file(">>");
1597  return;
1598  }
1599  /* partial downloading */
1600  if (!t1_open_fontfile("<"))
1601  return;
1603  t1_start_eexec();
1604  cc_init();
1605  cs_init();
1606  t1_read_subrs();
1608  t1_subset_end();
1609  t1_close_font_file(">");
1610 }
1611 
1612 #ifndef pdfTeX
1613 void t1_subset(char *fontfile, char *encfile, unsigned char *g)
1614 {
1615  int i;
1617  for (i = 0; i <= MAX_CHAR_CODE; i++)
1619  if (cur_enc_name != 0)
1621  grid = g;
1623  hexline_length = 0;
1624  writet1();
1625  for (i = 0; i <= MAX_CHAR_CODE; i++)
1626  if (ext_glyph_names[i] != notdef)
1628 }
1629 #endif /* not pdfTeX */
1630 
1631 /* changed for dvi2ps
1632  */
1633 
1635 {
1637  return (t1_file != NULL);
1638 }
1639 
1641 {
1643  return (enc_file != NULL);
1644 }
1645 
1646 static void pdftex_fail(fmt, a, b, c)
1647 char *fmt;
1648 char *a, *b, *c;
1649 {
1650  char newfmt[256];
1651 
1652  strcpy(newfmt, "(write1) ");
1653  strcat(newfmt, fmt);
1654  Fatal(newfmt, a, b, c);
1655 }
1656 
1657 static void pdftex_warn(fmt, a, b, c)
1658 char *fmt;
1659 char *a, *b, *c;
1660 {
1661  char newfmt[256];
1662 
1663  strcpy(newfmt, "(write1) ");
1664  strcat(newfmt, fmt);
1665  Warning(newfmt, a, b, c);
1666 }
1667 
1668 /* added for dvi2ps
1669  */
1670 
1672 char *encfile;
1673 char *glyphs[];
1674 {
1675  int i;
1676 
1678  for (i = 0; i <= MAX_CHAR_CODE; i++)
1679  glyphs[i] = notdef;
1680  if (cur_enc_name != 0)
1682 }
1683 
1685 char *glyphs[];
1686 {
1687  int i;
1688 
1689  for (i = 0; i <= MAX_CHAR_CODE; i++)
1690  if (glyphs[i] != notdef)
1691  free(glyphs[i]);
1692 }
double __cdecl atan(double _X)
q
Definition: afm2pl.c:2287
#define count(a)
Definition: aptex-macros.h:781
#define cs_name
Definition: aptex-macros.h:488
static void cs_error(void)
Definition: aptex-src.c:31633
static char hexdigits[]
Definition: bmepsoe.c:110
#define b
Definition: jpegint.h:372
#define free(a)
Definition: decNumber.cpp:310
void Warning(const char *sb1, const char *sb2)
Definition: detex.c:4677
void glyphs(int opcode)
Definition: disdvi.c:775
void Fatal()
#define fopen
Definition: xxstdio.h:21
#define FOPEN_RBIN_MODE
Definition: dvips.h:86
#define skip(p, c)
Definition: ptexmac.h:70
#define FONTBBOX1_CODE
Definition: ptexmac.h:97
#define MAX_KEY_CODE
Definition: ptexmac.h:101
#define remove_eol(p, buf)
Definition: ptexmac.h:64
#define check_buf(size, buf_size)
Definition: ptexmac.h:37
#define ITALIC_ANGLE_CODE
Definition: ptexmac.h:94
#define strend(s)
Definition: ptexmac.h:86
#define append_eol(p, buf, buf_size)
Definition: ptexmac.h:52
#define xfree(p)
Definition: ptexmac.h:85
#define STEMV_CODE
Definition: ptexmac.h:95
#define PRINTF_BUF_SIZE
Definition: ptexmac.h:35
#define FONTNAME_CODE
Definition: ptexmac.h:93
#define xtalloc
Definition: ptexmac.h:87
#define append_char_to_buf(c, p, buf, buf_size)
Definition: ptexmac.h:41
char * strncpy()
int strcmp()
Definition: coll.cpp:143
int sscanf()
char * strcpy()
struct rect data
Definition: dvipdfm.c:64
mpz_t * f
Definition: gen-fib.c:34
#define a1
#define a2
#define s
Definition: afcover.h:80
#define c(n)
Definition: gpos-common.c:150
#define a(n)
Definition: gpos-common.c:148
#define strchr
Definition: gsftopk.c:59
#define memcpy(d, s, n)
Definition: gsftopk.c:64
#define E
Definition: hpcdtoppm.c:1119
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p
Definition: afcover.h:72
small capitals from c petite p scientific i
Definition: afcover.h:80
void exit()
#define EOF
Definition: afmparse.c:59
#define M_PI
Definition: gd.h:236
int atoi(const char *)
FILE * xfopen(char *filename, int is_binary, char *area_list, char *extension)
#define CS_HLINETO
Definition: writet1.c:160
static char * eol(char *s)
Definition: writet1.c:426
void load_enc(char *enc_name, char **glyph_names)
Definition: writet1.c:307
static char print_buf[1024]
Definition: writet1.c:86
#define CS_HMOVETO
Definition: writet1.c:170
#define t1_end_eexec()
Definition: writet1.c:232
static void init_cs_entry(cs_entry *cs)
Definition: writet1.c:1343
unsigned char byte
Definition: writet1.c:187
#define xstrdup(s)
Definition: writet1.c:34
#define CS_CALLSUBR
Definition: writet1.c:164
static cc_entry cc_tab[((31+1)+33+1)]
Definition: writet1.c:1068
static void t1_scan_param(void)
Definition: writet1.c:783
#define is_used_char(c)
Definition: writet1.c:60
#define ENC_BUF_SIZE
Definition: writet1.c:151
static void t1_printf(char *fmt, char *a, char *b, char *c)
Definition: writet1.c:529
static int subr_size
Definition: writet1.c:219
static void t1_subset_end(void)
Definition: writet1.c:1556
#define out_eexec_char
Definition: writet1.c:61
static void t1_flush_cs(boolean)
Definition: writet1.c:1427
static void cs_mark(char *cs_name, int subr)
Definition: writet1.c:1153
#define t1_include()
Definition: writet1.c:69
static char * t1_line_ptr
Definition: writet1.c:208
#define cc_clear()
Definition: writet1.c:1102
#define external_enc()
Definition: writet1.c:55
#define CS_RLINETO
Definition: writet1.c:159
static char * cur_enc_name
Definition: writet1.c:83
static void t1_check_pfa(void)
Definition: writet1.c:356
#define t1_subrs()
Definition: writet1.c:231
static void t1_subset_charstrings(void)
Definition: writet1.c:1527
static char ** extra_glyphs_tab
Definition: writet1.c:147
#define end_last_eexec_line()
Definition: writet1.c:63
#define CS_VLINETO
Definition: writet1.c:161
static char t1_buf[4096]
Definition: writet1.c:208
#define t1_getchar()
Definition: writet1.c:96
static void t1_builtin_enc(void)
Definition: writet1.c:809
static char * cs_dict_end
Definition: writet1.c:214
#define CS_RRCURVETO
Definition: writet1.c:162
static FILE * t1_file
Definition: writet1.c:225
#define fm_extend(f)
Definition: writet1.c:38
#define is_included(f)
Definition: writet1.c:46
#define t1_prefix(s)
Definition: writet1.c:229
static void t1_outhex(byte b)
Definition: writet1.c:280
#define CS_HSTEM3
Definition: writet1.c:177
#define t1_log(s)
Definition: writet1.c:67
void t1_subset(char *fontfile, char *encfile, unsigned char *g)
Definition: writet1.c:1613
#define CS_MAX
Definition: writet1.c:185
#define fm_slant(f)
Definition: writet1.c:40
static char notdef[]
Definition: writet1.c:88
#define CS_CALLOTHERSUBR
Definition: writet1.c:181
static char enc_line[1024]
Definition: writet1.c:209
#define CS_VSTEM3
Definition: writet1.c:176
static int subr_max
Definition: writet1.c:219
void writet1(void)
Definition: writet1.c:1582
#define CS_RETURN
Definition: writet1.c:165
static void cs_store(boolean is_subr)
Definition: writet1.c:1032
#define CS_VSTEM
Definition: writet1.c:157
#define ENC_BUILTIN
Definition: writet1.c:154
#define CS_DIV
Definition: writet1.c:180
#define full_file_name()
Definition: writet1.c:56
#define t1_scan_only()
Definition: writet1.c:68
static boolean t1_check_unique_id(void)
Definition: writet1.c:774
static void t1_start_eexec(void)
Definition: writet1.c:577
static void t1_check_predef_enc(void)
Definition: writet1.c:908
static void t1_stop_eexec(void)
Definition: writet1.c:595
#define t1_cs_flush()
Definition: writet1.c:1329
static unsigned short t1_c1
Definition: writet1.c:206
static boolean t1_open_fontfile(char *open_name_prefix)
Definition: writet1.c:1019
#define set_cur_file_name(s)
Definition: writet1.c:48
#define t1_ungetchar(c)
Definition: writet1.c:97
#define CS_VHCURVETO
Definition: writet1.c:171
static int cs_count
Definition: writet1.c:215
static unsigned char * grid
Definition: writet1.c:84
static int last_hexbyte
Definition: writet1.c:224
static void enc_getline(void)
Definition: writet1.c:290
#define t1_subr_flush()
Definition: writet1.c:1328
#define CS_ESCAPE
Definition: writet1.c:166
static char * cur_file_name
Definition: writet1.c:82
t1_open()
Definition: writet1.c:1634
#define cc_push(V)
Definition: writet1.c:1101
#define t1_charstrings()
Definition: writet1.c:230
#define CS_RMOVETO
Definition: writet1.c:169
#define cs_getchar()
Definition: writet1.c:1148
static int subr_size_pos
Definition: writet1.c:219
#define enc_close()
Definition: writet1.c:103
#define str_prefix(s1, s2)
Definition: writet1.c:228
#define t1_eof()
Definition: writet1.c:98
#define update_cur_enc(font, glyph_names)
Definition: writet1.c:72
static cs_entry * cs_tab
Definition: writet1.c:213
static boolean t1_eexec_encrypt
Definition: writet1.c:221
char * extra_glyphs_entry
Definition: writet1.c:146
static int t1_in_eexec
Definition: writet1.c:222
t1_free_encode(glyphs)
Definition: writet1.c:1684
static byte eencrypt(byte plain)
Definition: writet1.c:419
#define CS_SEAC
Definition: writet1.c:178
FILE * outfp
Definition: aftopl.c:22
static boolean t1_pfa
Definition: writet1.c:221
#define CS_SBW
Definition: writet1.c:179
static int cs_size
Definition: writet1.c:215
static unsigned short t1_dr
Definition: writet1.c:205
static void t1_puts(char *s)
Definition: writet1.c:511
#define CS_HSTEM
Definition: writet1.c:156
#define CS_HSBW
Definition: writet1.c:167
char * t1_builtin_glyph_names[255+1]
Definition: writet1.c:142
#define mark_subr(n)
Definition: writet1.c:1150
static char * cs_dict_start
Definition: writet1.c:214
static void t1_subset_ascii_part(void)
Definition: writet1.c:1289
#define CS_CLOSEPATH
Definition: writet1.c:163
#define CS_SETCURRENTPOINT
Definition: writet1.c:183
static copy_glyph_names(char **glyph_names, int a, int b)
Definition: writet1.c:798
static int cs_size_pos
Definition: writet1.c:215
static boolean t1_suffix(char *s)
Definition: writet1.c:436
#define enc_getchar()
Definition: writet1.c:101
#define mark_cs(s)
Definition: writet1.c:1151
static void cs_init(void)
Definition: writet1.c:1333
#define get_length1()
Definition: writet1.c:57
static void t1_mark_glyphs(void)
Definition: writet1.c:1481
static integer cc_stack[24]
Definition: writet1.c:1067
static boolean is_cc_init
Definition: writet1.c:1069
static int hexval(int c)
Definition: writet1.c:387
static void t1_putline(void)
Definition: writet1.c:498
static cs_entry * cs_ptr
Definition: writet1.c:213
static char * standard_glyph_names[]
Definition: writet1.c:107
#define set_cc(N, B, A, C)
Definition: writet1.c:1104
static char * cs_start
Definition: writet1.c:211
#define t1_char(c)
Definition: writet1.c:77
#define t1_putchar(c)
Definition: writet1.c:70
#define cc_pop(N)
Definition: writet1.c:1072
static unsigned short t1_c2
Definition: writet1.c:206
#define CC_STACK_SIZE
Definition: writet1.c:1065
#define ENC_STANDARD
Definition: writet1.c:153
static void t1_check_block_len(boolean decrypt)
Definition: writet1.c:561
#define enc_eof()
Definition: writet1.c:102
static void pdftex_fail()
static void t1_init_params(char *open_name_prefix)
Definition: writet1.c:538
static int extra_glyphs_max
Definition: writet1.c:148
static void t1_read_subrs(void)
Definition: writet1.c:1355
#define CS_ENDCHAR
Definition: writet1.c:168
static char * subr_array_start
Definition: writet1.c:218
#define store_cs()
Definition: writet1.c:1063
static char ** extra_glyphs_ptr
Definition: writet1.c:147
static char * subr_array_end
Definition: writet1.c:218
static boolean t1_cs
Definition: writet1.c:221
enc_open()
Definition: writet1.c:1640
static char * ext_glyph_names[255+1]
Definition: writet1.c:85
#define CS_1BYTE_MAX
Definition: writet1.c:173
#define HEXLINE_WIDTH
Definition: writet1.c:270
char ** t1_glyph_names
Definition: writet1.c:141
#define t1_scan_keys()
Definition: writet1.c:71
#define CS_VMOVETO
Definition: writet1.c:158
static boolean t1_synthetic
Definition: writet1.c:221
static void t1_close_font_file(char *close_name_suffix)
Definition: writet1.c:554
static char t1_line[4096]
Definition: writet1.c:208
static long t1_block_length
Definition: writet1.c:223
static integer * stack_ptr
Definition: writet1.c:1067
#define extra_charset()
Definition: writet1.c:79
#define t1_close()
Definition: writet1.c:99
#define embed_all_glyphs(tex_font)
Definition: writet1.c:73
#define is_reencoded(f)
Definition: writet1.c:42
FILE * search()
Definition: strsrch.cpp:65
static int t1_encoding
Definition: writet1.c:144
#define cc_get(N)
Definition: writet1.c:1099
static void end_hexline()
Definition: writet1.c:272
#define store_subr()
Definition: writet1.c:1062
static void t1_check_end(void)
Definition: writet1.c:922
#define POST_SUBRS_SCAN
static cs_entry * cs_notdef
Definition: writet1.c:213
#define is_subsetted(f)
Definition: writet1.c:44
#define save_offset()
Definition: writet1.c:62
static byte cdecrypt(byte cipher, unsigned short *cr)
Definition: writet1.c:412
#define check_subr(subr)
Definition: writet1.c:1028
static void pdftex_warn()
#define CS_POP
Definition: writet1.c:182
static cs_entry * subr_tab
Definition: writet1.c:217
static boolean read_encoding_only
Definition: writet1.c:143
static boolean t1_scan
Definition: writet1.c:221
#define get_length3()
Definition: writet1.c:59
static byte edecrypt(byte cipher)
Definition: writet1.c:399
static int t1_getbyte(void)
Definition: writet1.c:366
#define CS_HVCURVETO
Definition: writet1.c:172
static FILE * enc_file
Definition: writet1.c:226
static int hexline_length
Definition: writet1.c:87
#define T1_BUF_SIZE
Definition: writet1.c:150
t1_get_encode(char *encfile, glyphs)
Definition: writet1.c:1671
static unsigned short t1_lenIV
Definition: writet1.c:207
static unsigned short t1_cslen
Definition: writet1.c:207
static unsigned short t1_er
Definition: writet1.c:205
#define CS_DOTSECTION
Definition: writet1.c:175
#define t1_cleartomark()
Definition: writet1.c:233
#define valid_code(c)
Definition: writet1.c:105
static void t1_getline(void)
Definition: writet1.c:449
#define get_length2()
Definition: writet1.c:58
static void cc_init(void)
Definition: writet1.c:1110
#define buf
char * strstr()
static const char * tab[]
Definition: xdirtest.c:23
#define fputs
Definition: mendex.h:67
#define fprintf
Definition: mendex.h:64
char * encfile
Definition: ps2pk.c:207
integer t1_length1
Definition: writet1.c:109
integer t1_length3
Definition: writet1.c:109
static void t1_modify_italic(void)
Definition: writet1.c:646
integer t1_length2
Definition: writet1.c:109
static void t1_modify_fm(void)
Definition: writet1.c:581
char args[100]
Definition: fixwrites.c:7
int strncmp()
#define sprintf
Definition: snprintf.c:44
#define isdigit(c)
Definition: snprintf.c:177
const char * font_keys[]
Definition: luafflib.c:2372
static int decrypt(lua_State *L)
Definition: md5lib.c:147
int k
Definition: otp-parser.c:70
int integer
Definition: pbmtopk.c:38
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF ptr
int g
Definition: ppmqvga.c:68
int r
Definition: ppmqvga.c:68
#define MAX_CHAR_CODE
Definition: pst1form.c:9
charset
Definition: charset.h:51
ShellFileEnvironment e
Definition: sh6.c:388
Definition: usprintf.c:39
Definition: writet1.c:189
boolean valid
Definition: writet1.c:193
byte nargs
Definition: writet1.c:190
boolean bottom
Definition: writet1.c:191
boolean clear
Definition: writet1.c:192
Definition: writet1.c:196
char * name
Definition: writet1.c:197
boolean valid
Definition: writet1.c:202
unsigned short len
Definition: writet1.c:199
boolean used
Definition: writet1.c:201
unsigned short cslen
Definition: writet1.c:200
byte * data
Definition: writet1.c:198
Definition: pst1form.c:310
Definition: ptexlib.h:90
Definition: ptexlib.h:50
#define FILE
Definition: t1stdio.h:34
s1
Definition: t4ht.c:1059
char * s2
Definition: t4ht.c:1062
*job_name strlen((char *) job_name) - 4)
#define key
Definition: tex2xindy.c:753
char fmt[256]
Definition: tex4ht.c:3925
found
Definition: tex4ht.c:5000
static struct count_rec * counter
Definition: tex4ht.c:1052
FILE * fontfile
Definition: ttf2afm.c:100
int names_count
Definition: ttf2afm.c:116
static char start_line[256]
Definition: preamble.c:117
#define va_start(pvar)
Definition: varargs.h:30
#define va_end(pvar)
Definition: varargs.h:38
char * va_list
Definition: varargs.h:22
char cr[]
Definition: vlna.c:107