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)  

cairo-cff-subset.c
Go to the documentation of this file.
1 /* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
2 /* cairo - a vector graphics library with display and print output
3  *
4  * Copyright © 2006 Adrian Johnson
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it either under the terms of the GNU Lesser General Public
8  * License version 2.1 as published by the Free Software Foundation
9  * (the "LGPL") or, at your option, under the terms of the Mozilla
10  * Public License Version 1.1 (the "MPL"). If you do not alter this
11  * notice, a recipient may use your version of this file under either
12  * the MPL or the LGPL.
13  *
14  * You should have received a copy of the LGPL along with this library
15  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
17  * You should have received a copy of the MPL along with this library
18  * in the file COPYING-MPL-1.1
19  *
20  * The contents of this file are subject to the Mozilla Public License
21  * Version 1.1 (the "License"); you may not use this file except in
22  * compliance with the License. You may obtain a copy of the License at
23  * http://www.mozilla.org/MPL/
24  *
25  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
26  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
27  * the specific language governing rights and limitations.
28  *
29  * The Original Code is the cairo graphics library.
30  *
31  * The Initial Developer of the Original Code is Adrian Johnson.
32  *
33  * Contributor(s):
34  * Adrian Johnson <ajohnson@redneon.com>
35  * Eugeniy Meshcheryakov <eugen@debian.org>
36  */
37 
38 /*
39  * Useful links:
40  * http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5176.CFF.pdf
41  * http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5177.Type2.pdf
42  */
43 
44 #define _DEFAULT_SOURCE /* for snprintf(), strdup() */
45 #include "cairoint.h"
46 
47 #include "cairo-array-private.h"
48 #include "cairo-error-private.h"
49 
50 #if CAIRO_HAS_FONT_SUBSET
51 
54 #include <string.h>
55 #include <locale.h>
56 
57 /* CFF Dict Operators. If the high byte is 0 the command is encoded
58  * with a single byte. */
59 #define BASEFONTNAME_OP 0x0c16
60 #define CIDCOUNT_OP 0x0c22
61 #define CHARSET_OP 0x000f
62 #define CHARSTRINGS_OP 0x0011
63 #define COPYRIGHT_OP 0x0c00
64 #define DEFAULTWIDTH_OP 0x0014
65 #define ENCODING_OP 0x0010
66 #define FAMILYNAME_OP 0x0003
67 #define FDARRAY_OP 0x0c24
68 #define FDSELECT_OP 0x0c25
69 #define FONTBBOX_OP 0x0005
70 #define FONTMATRIX_OP 0x0c07
71 #define FONTNAME_OP 0x0c26
72 #define FULLNAME_OP 0x0002
73 #define LOCAL_SUB_OP 0x0013
74 #define NOMINALWIDTH_OP 0x0015
75 #define NOTICE_OP 0x0001
76 #define POSTSCRIPT_OP 0x0c15
77 #define PRIVATE_OP 0x0012
78 #define ROS_OP 0x0c1e
79 #define UNIQUEID_OP 0x000d
80 #define VERSION_OP 0x0000
81 #define WEIGHT_OP 0x0004
82 #define XUID_OP 0x000e
83 
84 #define NUM_STD_STRINGS 391
85 
86 /* Type 2 Charstring operators */
87 #define TYPE2_hstem 0x0001
88 #define TYPE2_vstem 0x0003
89 #define TYPE2_callsubr 0x000a
90 
91 #define TYPE2_return 0x000b
92 #define TYPE2_endchar 0x000e
93 
94 #define TYPE2_hstemhm 0x0012
95 #define TYPE2_hintmask 0x0013
96 #define TYPE2_cntrmask 0x0014
97 #define TYPE2_vstemhm 0x0017
98 #define TYPE2_callgsubr 0x001d
99 
100 #define TYPE2_rmoveto 0x0015
101 #define TYPE2_hmoveto 0x0016
102 #define TYPE2_vmoveto 0x0004
103 
104 
105 #define MAX_SUBROUTINE_NESTING 10 /* From Type2 Charstring spec */
106 
107 
108 typedef struct _cff_header {
109  uint8_t major;
110  uint8_t minor;
114 
115 typedef struct _cff_index_element {
117  unsigned char *data;
118  int length;
120 
121 typedef struct _cff_dict_operator {
123 
124  unsigned short operator;
125  unsigned char *operand;
126  int operand_length;
127  int operand_offset;
129 
130 typedef struct _cairo_cff_font {
131 
134 
135  /* Font Data */
136  unsigned char *data;
137  unsigned long data_length;
138  unsigned char *current_ptr;
139  unsigned char *data_end;
141  char *font_name;
142  char *ps_name;
149  unsigned char *charset;
150  int num_glyphs;
153  int units_per_em;
154  int global_sub_bias;
155  int local_sub_bias;
156  double default_width;
157  double nominal_width;
158 
159  /* CID Font Data */
160  int *fdselect;
161  unsigned int num_fontdicts;
165  int *fd_local_sub_bias;
166  double *fd_default_width;
167  double *fd_nominal_width;
168 
169  /* Subsetted Font Data */
170  char *subset_font_name;
173  int euro_sid;
174  int *fdselect_subset;
175  unsigned int num_subset_fontdicts;
176  int *fd_subset_map;
177  int *private_dict_offset;
183 
184  /* Subset Metrics */
185  int *widths;
186  int x_min, y_min, x_max, y_max;
187  int ascent, descent;
188 
189  /* Type 2 charstring data */
190  int type2_stack_size;
193  int type2_num_hints;
199  int type2_width;
201 
203 
204 /* Encoded integer using maximum sized encoding. This is required for
205  * operands that are later modified after encoding. */
206 static unsigned char *
207 encode_integer_max (unsigned char *p, int i)
208 {
209  *p++ = 29;
210  *p++ = i >> 24;
211  *p++ = (i >> 16) & 0xff;
212  *p++ = (i >> 8) & 0xff;
213  *p++ = i & 0xff;
214  return p;
215 }
216 
217 static unsigned char *
218 encode_integer (unsigned char *p, int i)
219 {
220  if (i >= -107 && i <= 107) {
221  *p++ = i + 139;
222  } else if (i >= 108 && i <= 1131) {
223  i -= 108;
224  *p++ = (i >> 8)+ 247;
225  *p++ = i & 0xff;
226  } else if (i >= -1131 && i <= -108) {
227  i = -i - 108;
228  *p++ = (i >> 8)+ 251;
229  *p++ = i & 0xff;
230  } else if (i >= -32768 && i <= 32767) {
231  *p++ = 28;
232  *p++ = (i >> 8) & 0xff;
233  *p++ = i & 0xff;
234  } else {
235  p = encode_integer_max (p, i);
236  }
237  return p;
238 }
239 
240 static unsigned char *
241 decode_integer (unsigned char *p, int *integer)
242 {
243  if (*p == 28) {
244  *integer = (int)(p[1]<<8 | p[2]);
245  p += 3;
246  } else if (*p == 29) {
247  *integer = (int)((p[1] << 24) | (p[2] << 16) | (p[3] << 8) | p[4]);
248  p += 5;
249  } else if (*p >= 32 && *p <= 246) {
250  *integer = *p++ - 139;
251  } else if (*p <= 250) {
252  *integer = (p[0] - 247) * 256 + p[1] + 108;
253  p += 2;
254  } else if (*p <= 254) {
255  *integer = -(p[0] - 251) * 256 - p[1] - 108;
256  p += 2;
257  } else {
258  *integer = 0;
259  p += 1;
260  }
261  return p;
262 }
263 
264 static char *
265 decode_nibble (int n, char *buf)
266 {
267  switch (n)
268  {
269  case 0xa:
270  *buf++ = '.';
271  break;
272  case 0xb:
273  *buf++ = 'E';
274  break;
275  case 0xc:
276  *buf++ = 'E';
277  *buf++ = '-';
278  break;
279  case 0xd:
280  *buf++ = '-';
281  break;
282  case 0xe:
283  *buf++ = '-';
284  break;
285  case 0xf:
286  break;
287  default:
288  *buf++ = '0' + n;
289  break;
290  }
291 
292  return buf;
293 }
294 
295 static unsigned char *
296 decode_real (unsigned char *p, double *real)
297 {
298  char buffer[100];
299  char *buf = buffer;
300  char *buf_end = buffer + sizeof (buffer);
301  char *end;
302  int n;
303 
304  p++;
305  while (buf + 2 < buf_end) {
306  n = *p >> 4;
307  buf = decode_nibble (n, buf);
308  n = *p & 0x0f;
309  buf = decode_nibble (n, buf);
310  if ((*p & 0x0f) == 0x0f) {
311  p++;
312  break;
313  }
314  p++;
315  };
316  *buf = 0;
317 
318  *real = _cairo_strtod (buffer, &end);
319 
320  return p;
321 }
322 
323 static unsigned char *
324 decode_number (unsigned char *p, double *number)
325 {
326  if (*p == 30) {
327  p = decode_real (p, number);
328  } else {
329  int i;
330  p = decode_integer (p, &i);
331  *number = i;
332  }
333  return p;
334 }
335 
336 static unsigned char *
337 decode_operator (unsigned char *p, unsigned short *operator)
338 {
339  unsigned short op = 0;
340 
341  op = *p++;
342  if (op == 12) {
343  op <<= 8;
344  op |= *p++;
345  }
346  *operator = op;
347  return p;
348 }
349 
350 /* return 0 if not an operand */
351 static int
352 operand_length (unsigned char *p)
353 {
354  unsigned char *begin = p;
355 
356  if (*p == 28)
357  return 3;
358 
359  if (*p == 29)
360  return 5;
361 
362  if (*p >= 32 && *p <= 246)
363  return 1;
364 
365  if (*p >= 247 && *p <= 254)
366  return 2;
367 
368  if (*p == 30) {
369  while ((*p & 0x0f) != 0x0f)
370  p++;
371  return p - begin + 1;
372  }
373 
374  return 0;
375 }
376 
377 static unsigned char *
378 encode_index_offset (unsigned char *p, int offset_size, unsigned long offset)
379 {
380  while (--offset_size >= 0) {
381  p[offset_size] = (unsigned char) (offset & 0xff);
382  offset >>= 8;
383  }
384  return p + offset_size;
385 }
386 
387 static unsigned long
388 decode_index_offset(unsigned char *p, int off_size)
389 {
390  unsigned long offset = 0;
391 
392  while (off_size-- > 0)
393  offset = offset*256 + *p++;
394  return offset;
395 }
396 
397 static void
399 {
401 }
402 
403 static cairo_int_status_t
404 cff_index_read (cairo_array_t *index, unsigned char **ptr, unsigned char *end_ptr)
405 {
407  unsigned char *data, *p;
409  int offset_size, count, start, i;
410  int end = 0;
411 
412  p = *ptr;
413  if (p + 2 > end_ptr)
416  p += 2;
417  if (count > 0) {
418  offset_size = *p++;
419  if (p + (count + 1)*offset_size > end_ptr)
421  data = p + offset_size*(count + 1) - 1;
422  start = decode_index_offset (p, offset_size);
423  p += offset_size;
424  for (i = 0; i < count; i++) {
425  end = decode_index_offset (p, offset_size);
426  p += offset_size;
427  if (p > end_ptr)
429  element.length = end - start;
430  element.is_copy = FALSE;
431  element.data = data + start;
433  if (unlikely (status))
434  return status;
435  start = end;
436  }
437  p = data + end;
438  }
439  *ptr = p;
440 
441  return CAIRO_STATUS_SUCCESS;
442 }
443 
444 static cairo_status_t
446 {
447  int offset_size;
448  int offset;
449  int num_elem;
450  int i;
452  uint16_t count;
453  unsigned char buf[5];
455 
456  num_elem = _cairo_array_num_elements (index);
457  count = cpu_to_be16 ((uint16_t) num_elem);
459  if (unlikely (status))
460  return status;
461 
462  if (num_elem == 0)
463  return CAIRO_STATUS_SUCCESS;
464 
465  /* Find maximum offset to determine offset size */
466  offset = 1;
467  for (i = 0; i < num_elem; i++) {
469  offset += element->length;
470  }
471  if (offset < 0x100)
472  offset_size = 1;
473  else if (offset < 0x10000)
474  offset_size = 2;
475  else if (offset < 0x1000000)
476  offset_size = 3;
477  else
478  offset_size = 4;
479 
480  buf[0] = (unsigned char) offset_size;
482  if (unlikely (status))
483  return status;
484 
485  offset = 1;
486  encode_index_offset (buf, offset_size, offset);
487  status = _cairo_array_append_multiple (output, buf, offset_size);
488  if (unlikely (status))
489  return status;
490 
491  for (i = 0; i < num_elem; i++) {
493  offset += element->length;
494  encode_index_offset (buf, offset_size, offset);
495  status = _cairo_array_append_multiple (output, buf, offset_size);
496  if (unlikely (status))
497  return status;
498  }
499 
500  for (i = 0; i < num_elem; i++) {
502  if (element->length > 0) {
504  element->data,
505  element->length);
506  }
507  if (unlikely (status))
508  return status;
509  }
510  return CAIRO_STATUS_SUCCESS;
511 }
512 
513 static void
515  unsigned char *object , int length)
516 {
518 
519  element = _cairo_array_index (index, obj_index);
520  if (element->is_copy)
521  free (element->data);
522 
523  element->data = object;
524  element->length = length;
525  element->is_copy = FALSE;
526 }
527 
528 static cairo_status_t
529 cff_index_append (cairo_array_t *index, unsigned char *object , int length)
530 {
532 
533  element.length = length;
534  element.is_copy = FALSE;
535  element.data = object;
536 
537  return _cairo_array_append (index, &element);
538 }
539 
540 static cairo_status_t
542  const unsigned char *object,
543  unsigned int length)
544 {
547 
548  element.length = length;
549  element.is_copy = TRUE;
550  element.data = _cairo_malloc (element.length);
551  if (unlikely (element.data == NULL))
553 
554  memcpy (element.data, object, element.length);
555 
557  if (unlikely (status)) {
558  free (element.data);
559  return status;
560  }
561 
562  return CAIRO_STATUS_SUCCESS;
563 }
564 
565 static void
567 {
569  unsigned int i;
570 
571  for (i = 0; i < _cairo_array_num_elements (index); i++) {
573  if (element->is_copy && element->data)
574  free (element->data);
575  }
577 }
578 
579 static cairo_bool_t
580 _cairo_cff_dict_equal (const void *key_a, const void *key_b)
581 {
582  const cff_dict_operator_t *op_a = key_a;
583  const cff_dict_operator_t *op_b = key_b;
584 
585  return op_a->operator == op_b->operator;
586 }
587 
588 static cairo_status_t
590 {
592  if (unlikely (*dict == NULL))
594 
595  return CAIRO_STATUS_SUCCESS;
596 }
597 
598 static void
600 {
601  key->base.hash = (unsigned long) operator;
602  key->operator = operator;
603 }
604 
605 static cairo_status_t
607  unsigned char *operand,
608  int size,
610 {
612 
613  op = _cairo_malloc (sizeof (cff_dict_operator_t));
614  if (unlikely (op == NULL))
616 
617  _cairo_dict_init_key (op, operator);
618  op->operand = _cairo_malloc (size);
619  if (unlikely (op->operand == NULL)) {
620  free (op);
622  }
623 
624  memcpy (op->operand, operand, size);
625  op->operand_length = size;
626  op->operand_offset = -1;
627 
628  *out = op;
629  return CAIRO_STATUS_SUCCESS;
630 }
631 
632 static cairo_status_t
633 cff_dict_read (cairo_hash_table_t *dict, unsigned char *p, int dict_size)
634 {
635  unsigned char *end;
636  cairo_array_t operands;
638  unsigned short operator;
640  int size;
641 
642  end = p + dict_size;
643  _cairo_array_init (&operands, 1);
644  while (p < end) {
645  size = operand_length (p);
646  if (size != 0) {
647  status = _cairo_array_append_multiple (&operands, p, size);
648  if (unlikely (status))
649  goto fail;
650 
651  p += size;
652  } else {
653  p = decode_operator (p, &operator);
654  status = cff_dict_create_operator (operator,
655  _cairo_array_index (&operands, 0),
656  _cairo_array_num_elements (&operands),
657  &op);
658  if (unlikely (status))
659  goto fail;
660 
661  status = _cairo_hash_table_insert (dict, &op->base);
662  if (unlikely (status))
663  goto fail;
664 
665  _cairo_array_truncate (&operands, 0);
666  }
667  }
668 
669 fail:
670  _cairo_array_fini (&operands);
671 
672  return status;
673 }
674 
675 static void
676 cff_dict_remove (cairo_hash_table_t *dict, unsigned short operator)
677 {
679 
680  _cairo_dict_init_key (&key, operator);
681  op = _cairo_hash_table_lookup (dict, &key.base);
682  if (op != NULL) {
683  free (op->operand);
685  free (op);
686  }
687 }
688 
689 static unsigned char *
691  unsigned short operator,
692  int *size)
693 {
695 
696  _cairo_dict_init_key (&key, operator);
697  op = _cairo_hash_table_lookup (dict, &key.base);
698  if (op != NULL) {
699  *size = op->operand_length;
700  return op->operand;
701  }
702 
703  return NULL;
704 }
705 
706 static cairo_status_t
708  unsigned short operator,
709  unsigned char *operand,
710  int size)
711 {
714 
715  _cairo_dict_init_key (&key, operator);
716  op = _cairo_hash_table_lookup (dict, &key.base);
717  if (op != NULL) {
718  free (op->operand);
719  op->operand = _cairo_malloc (size);
720  if (unlikely (op->operand == NULL))
722 
723  memcpy (op->operand, operand, size);
724  op->operand_length = size;
725  }
726  else
727  {
728  status = cff_dict_create_operator (operator, operand, size, &op);
729  if (unlikely (status))
730  return status;
731 
732  status = _cairo_hash_table_insert (dict, &op->base);
733  if (unlikely (status))
734  return status;
735  }
736 
737  return CAIRO_STATUS_SUCCESS;
738 }
739 
740 static int
742  unsigned short operator,
743  int *size)
744 {
746 
747  _cairo_dict_init_key (&key, operator);
748  op = _cairo_hash_table_lookup (dict, &key.base);
749  if (op != NULL) {
750  *size = op->operand_length;
751  return op->operand_offset;
752  }
753 
754  return -1;
755 }
756 
757 typedef struct _dict_write_info {
761 
762 static void
764 {
765  unsigned char data;
766 
767  op->operand_offset = _cairo_array_num_elements (write_info->output);
768  write_info->status = _cairo_array_append_multiple (write_info->output, op->operand, op->operand_length);
769  if (write_info->status)
770  return;
771 
772  if (op->operator & 0xff00) {
773  data = op->operator >> 8;
774  write_info->status = _cairo_array_append (write_info->output, &data);
775  if (write_info->status)
776  return;
777  }
778  data = op->operator & 0xff;
779  write_info->status = _cairo_array_append (write_info->output, &data);
780 }
781 
782 static void
784 {
785  dict_write_info_t *write_info = closure;
787 
788  if (write_info->status)
789  return;
790 
791  /* The ROS operator is handled separately in cff_dict_write() */
792  if (op->operator != ROS_OP)
793  cairo_dict_write_operator (op, write_info);
794 }
795 
796 static cairo_status_t
798 {
799  dict_write_info_t write_info;
801 
802  write_info.output = output;
803  write_info.status = CAIRO_STATUS_SUCCESS;
804 
805  /* The CFF specification requires that the Top Dict of CID fonts
806  * begin with the ROS operator. */
808  op = _cairo_hash_table_lookup (dict, &key.base);
809  if (op != NULL)
810  cairo_dict_write_operator (op, &write_info);
811 
812  _cairo_hash_table_foreach (dict, _cairo_dict_collect, &write_info);
813 
814  return write_info.status;
815 }
816 
817 static void
818 _cff_dict_entry_pluck (void *_entry, void *dict)
819 {
820  cff_dict_operator_t *entry = _entry;
821 
822  _cairo_hash_table_remove (dict, &entry->base);
823  free (entry->operand);
824  free (entry);
825 }
826 
827 static void
829 {
832 }
833 
834 static cairo_int_status_t
836 {
837  if (font->data_length < sizeof (cff_header_t))
839 
840 
841  font->header = (cff_header_t *) font->data;
842  font->current_ptr = font->data + font->header->header_size;
843 
844  return CAIRO_STATUS_SUCCESS;
845 }
846 
847 static cairo_int_status_t
849 {
853  unsigned char *p;
854  int i, len;
855 
857  status = cff_index_read (&index, &font->current_ptr, font->data_end);
858  if (!font->is_opentype) {
860  p = element->data;
861  len = element->length;
862 
863  /* If font name is prefixed with a subset tag, strip it off. */
864  if (len > 7 && p[6] == '+') {
865  for (i = 0; i < 6; i++)
866  if (p[i] < 'A' || p[i] > 'Z')
867  break;
868  if (i == 6) {
869  p += 7;
870  len -= 7;
871  }
872  }
873  font->ps_name = _cairo_malloc (len + 1);
874  if (unlikely (font->ps_name == NULL))
876 
877  memcpy (font->ps_name, p, len);
878  font->ps_name[len] = 0;
879 
880  status = _cairo_escape_ps_name (&font->ps_name);
881  }
883 
884  return status;
885 }
886 
887 static cairo_int_status_t
889  cairo_hash_table_t *private_dict,
890  cairo_array_t *local_sub_index,
891  int *local_sub_bias,
892  cairo_bool_t **local_subs_used,
893  double *default_width,
894  double *nominal_width,
895  unsigned char *ptr,
896  int size)
897 {
899  unsigned char buf[10];
900  unsigned char *end_buf;
901  int offset;
902  int i;
903  unsigned char *operand;
904  unsigned char *p;
905  int num_subs;
906 
907  status = cff_dict_read (private_dict, ptr, size);
908  if (unlikely (status))
909  return status;
910 
911  operand = cff_dict_get_operands (private_dict, LOCAL_SUB_OP, &i);
912  if (operand) {
913  decode_integer (operand, &offset);
914  p = ptr + offset;
915  status = cff_index_read (local_sub_index, &p, font->data_end);
916  if (unlikely (status))
917  return status;
918 
919  /* Use maximum sized encoding to reserve space for later modification. */
920  end_buf = encode_integer_max (buf, 0);
921  status = cff_dict_set_operands (private_dict, LOCAL_SUB_OP, buf, end_buf - buf);
922  if (unlikely (status))
923  return status;
924  }
925 
926  *default_width = 0;
927  operand = cff_dict_get_operands (private_dict, DEFAULTWIDTH_OP, &i);
928  if (operand)
929  decode_number (operand, default_width);
930 
931  *nominal_width = 0;
932  operand = cff_dict_get_operands (private_dict, NOMINALWIDTH_OP, &i);
933  if (operand)
934  decode_number (operand, nominal_width);
935 
936  num_subs = _cairo_array_num_elements (local_sub_index);
937  *local_subs_used = calloc (num_subs, sizeof (cairo_bool_t));
938  if (unlikely (*local_subs_used == NULL))
940 
941  if (num_subs < 1240)
942  *local_sub_bias = 107;
943  else if (num_subs < 33900)
944  *local_sub_bias = 1131;
945  else
946  *local_sub_bias = 32768;
947 
948  return CAIRO_STATUS_SUCCESS;
949 }
950 
951 static cairo_int_status_t
953 {
954  int type, num_ranges, first, last, fd, i, j;
955 
956  font->fdselect = calloc (font->num_glyphs, sizeof (int));
957  if (unlikely (font->fdselect == NULL))
959 
960  type = *p++;
961  if (type == 0)
962  {
963  for (i = 0; i < font->num_glyphs; i++)
964  font->fdselect[i] = *p++;
965  } else if (type == 3) {
966  num_ranges = get_unaligned_be16 (p);
967  p += 2;
968  for (i = 0; i < num_ranges; i++)
969  {
971  p += 2;
972  fd = *p++;
974  for (j = first; j < last; j++)
975  font->fdselect[j] = fd;
976  }
977  } else {
979  }
980 
981  return CAIRO_STATUS_SUCCESS;
982 }
983 
984 static cairo_int_status_t
986 {
989  unsigned int i;
990  int size;
991  unsigned char *operand;
992  int offset;
994  unsigned char buf[100];
995  unsigned char *end_buf;
996 
998  status = cff_index_read (&index, &ptr, font->data_end);
999  if (unlikely (status))
1000  goto fail;
1001 
1002  font->num_fontdicts = _cairo_array_num_elements (&index);
1003 
1004  font->fd_dict = calloc (sizeof (cairo_hash_table_t *), font->num_fontdicts);
1005  if (unlikely (font->fd_dict == NULL)) {
1007  goto fail;
1008  }
1009 
1010  font->fd_private_dict = calloc (sizeof (cairo_hash_table_t *), font->num_fontdicts);
1011  if (unlikely (font->fd_private_dict == NULL)) {
1013  goto fail;
1014  }
1015 
1016  font->fd_local_sub_index = calloc (sizeof (cairo_array_t), font->num_fontdicts);
1017  if (unlikely (font->fd_local_sub_index == NULL)) {
1019  goto fail;
1020  }
1021 
1022  font->fd_local_sub_bias = calloc (sizeof (int), font->num_fontdicts);
1023  if (unlikely (font->fd_local_sub_bias == NULL)) {
1025  goto fail;
1026  }
1027 
1028  font->fd_local_subs_used = calloc (sizeof (cairo_bool_t *), font->num_fontdicts);
1029  if (unlikely (font->fd_local_subs_used == NULL)) {
1031  goto fail;
1032  }
1033 
1034  font->fd_default_width = calloc (font->num_fontdicts, sizeof (double));
1035  if (unlikely (font->fd_default_width == NULL)) {
1037  goto fail;
1038  }
1039 
1040  font->fd_nominal_width = calloc (font->num_fontdicts, sizeof (double));
1041  if (unlikely (font->fd_nominal_width == NULL)) {
1043  goto fail;
1044  }
1045 
1046  for (i = 0; i < font->num_fontdicts; i++) {
1047  status = cff_dict_init (&font->fd_dict[i]);
1048  if (unlikely (status))
1049  goto fail;
1050 
1052  status = cff_dict_read (font->fd_dict[i], element->data, element->length);
1053  if (unlikely (status))
1054  goto fail;
1055 
1056  operand = cff_dict_get_operands (font->fd_dict[i], PRIVATE_OP, &size);
1057  if (operand == NULL) {
1059  goto fail;
1060  }
1061  operand = decode_integer (operand, &size);
1062  decode_integer (operand, &offset);
1063  status = cff_dict_init (&font->fd_private_dict[i]);
1064  if (unlikely (status))
1065  goto fail;
1066 
1067  cff_index_init (&font->fd_local_sub_index[i]);
1069  font->fd_private_dict[i],
1070  &font->fd_local_sub_index[i],
1071  &font->fd_local_sub_bias[i],
1072  &font->fd_local_subs_used[i],
1073  &font->fd_default_width[i],
1074  &font->fd_nominal_width[i],
1075  font->data + offset,
1076  size);
1077  if (unlikely (status))
1078  goto fail;
1079 
1080  /* Set integer operand to max value to use max size encoding to reserve
1081  * space for any value later */
1082  end_buf = encode_integer_max (buf, 0);
1083  end_buf = encode_integer_max (end_buf, 0);
1084  status = cff_dict_set_operands (font->fd_dict[i], PRIVATE_OP, buf, end_buf - buf);
1085  if (unlikely (status))
1086  goto fail;
1087  }
1088 
1089  return CAIRO_STATUS_SUCCESS;
1090 
1091 fail:
1092  cff_index_fini (&index);
1093 
1094  return status;
1095 }
1096 
1097 static void
1099 {
1100  unsigned char *p;
1101  unsigned char *end;
1102  int size;
1103  double x_min, y_min, x_max, y_max;
1104  double xx, yx, xy, yy;
1105 
1106  x_min = 0.0;
1107  y_min = 0.0;
1108  x_max = 0.0;
1109  y_max = 0.0;
1110  p = cff_dict_get_operands (font->top_dict, FONTBBOX_OP, &size);
1111  if (p) {
1112  end = p + size;
1113  if (p < end)
1114  p = decode_number (p, &x_min);
1115  if (p < end)
1116  p = decode_number (p, &y_min);
1117  if (p < end)
1118  p = decode_number (p, &x_max);
1119  if (p < end)
1120  p = decode_number (p, &y_max);
1121  }
1122  font->x_min = floor (x_min);
1123  font->y_min = floor (y_min);
1124  font->x_max = floor (x_max);
1125  font->y_max = floor (y_max);
1126  font->ascent = font->y_max;
1127  font->descent = font->y_min;
1128 
1129  xx = 0.001;
1130  yx = 0.0;
1131  xy = 0.0;
1132  yy = 0.001;
1133  p = cff_dict_get_operands (font->top_dict, FONTMATRIX_OP, &size);
1134  if (p) {
1135  end = p + size;
1136  if (p < end)
1137  p = decode_number (p, &xx);
1138  if (p < end)
1139  p = decode_number (p, &yx);
1140  if (p < end)
1141  p = decode_number (p, &xy);
1142  if (p < end)
1143  p = decode_number (p, &yy);
1144  }
1145  /* Freetype uses 1/abs(yy) to get units per EM */
1146  font->units_per_em = _cairo_round(1.0/fabs(yy));
1147 }
1148 
1149 static cairo_int_status_t
1151 {
1154  unsigned char buf[20];
1155  unsigned char *end_buf;
1156  unsigned char *operand;
1158  unsigned char *p;
1159  int size;
1160  int offset;
1161 
1162  cff_index_init (&index);
1163  status = cff_index_read (&index, &font->current_ptr, font->data_end);
1164  if (unlikely (status))
1165  goto fail;
1166 
1168  status = cff_dict_read (font->top_dict, element->data, element->length);
1169  if (unlikely (status))
1170  goto fail;
1171 
1172  if (cff_dict_get_operands (font->top_dict, ROS_OP, &size) != NULL)
1173  font->is_cid = TRUE;
1174  else
1175  font->is_cid = FALSE;
1176 
1177  operand = cff_dict_get_operands (font->top_dict, CHARSTRINGS_OP, &size);
1178  decode_integer (operand, &offset);
1179  p = font->data + offset;
1180  status = cff_index_read (&font->charstrings_index, &p, font->data_end);
1181  if (unlikely (status))
1182  goto fail;
1183  font->num_glyphs = _cairo_array_num_elements (&font->charstrings_index);
1184 
1185  if (font->is_cid) {
1186  operand = cff_dict_get_operands (font->top_dict, CHARSET_OP, &size);
1187  if (!operand)
1189 
1190  decode_integer (operand, &offset);
1191  font->charset = font->data + offset;
1192  if (font->charset >= font->data_end)
1194  }
1195 
1196  if (!font->is_opentype)
1198 
1199  if (font->is_cid) {
1200  operand = cff_dict_get_operands (font->top_dict, FDSELECT_OP, &size);
1201  decode_integer (operand, &offset);
1203  if (unlikely (status))
1204  goto fail;
1205 
1206  operand = cff_dict_get_operands (font->top_dict, FDARRAY_OP, &size);
1207  decode_integer (operand, &offset);
1209  if (unlikely (status))
1210  goto fail;
1211  } else {
1212  operand = cff_dict_get_operands (font->top_dict, PRIVATE_OP, &size);
1213  operand = decode_integer (operand, &size);
1214  decode_integer (operand, &offset);
1216  font->private_dict,
1217  &font->local_sub_index,
1218  &font->local_sub_bias,
1219  &font->local_subs_used,
1220  &font->default_width,
1221  &font->nominal_width,
1222  font->data + offset,
1223  size);
1224  if (unlikely (status))
1225  goto fail;
1226  }
1227 
1228  /* Use maximum sized encoding to reserve space for later modification. */
1229  end_buf = encode_integer_max (buf, 0);
1230  status = cff_dict_set_operands (font->top_dict,
1231  CHARSTRINGS_OP, buf, end_buf - buf);
1232  if (unlikely (status))
1233  goto fail;
1234 
1235  status = cff_dict_set_operands (font->top_dict,
1236  CHARSET_OP, buf, end_buf - buf);
1237  if (unlikely (status))
1238  goto fail;
1239 
1240  if (font->scaled_font_subset->is_latin) {
1241  status = cff_dict_set_operands (font->top_dict,
1242  ENCODING_OP, buf, end_buf - buf);
1243  if (unlikely (status))
1244  goto fail;
1245 
1246  /* Private has two operands - size and offset */
1247  end_buf = encode_integer_max (end_buf, 0);
1248  cff_dict_set_operands (font->top_dict, PRIVATE_OP, buf, end_buf - buf);
1249  if (unlikely (status))
1250  goto fail;
1251 
1252  } else {
1253  status = cff_dict_set_operands (font->top_dict,
1254  FDSELECT_OP, buf, end_buf - buf);
1255  if (unlikely (status))
1256  goto fail;
1257 
1258  status = cff_dict_set_operands (font->top_dict,
1259  FDARRAY_OP, buf, end_buf - buf);
1260  if (unlikely (status))
1261  goto fail;
1262 
1263  cff_dict_remove (font->top_dict, ENCODING_OP);
1264  cff_dict_remove (font->top_dict, PRIVATE_OP);
1265  }
1266 
1267  /* Remove the unique identifier operators as the subsetted font is
1268  * not the same is the original font. */
1269  cff_dict_remove (font->top_dict, UNIQUEID_OP);
1270  cff_dict_remove (font->top_dict, XUID_OP);
1271 
1272 fail:
1273  cff_index_fini (&index);
1274 
1275  return status;
1276 }
1277 
1278 static cairo_int_status_t
1280 {
1281  return cff_index_read (&font->strings_index, &font->current_ptr, font->data_end);
1282 }
1283 
1284 static cairo_int_status_t
1286 {
1288  int num_subs;
1289 
1290  status = cff_index_read (&font->global_sub_index, &font->current_ptr, font->data_end);
1291  if (unlikely (status))
1292  return status;
1293 
1294  num_subs = _cairo_array_num_elements (&font->global_sub_index);
1295  font->global_subs_used = calloc (num_subs, sizeof(cairo_bool_t));
1296  if (unlikely (font->global_subs_used == NULL))
1298 
1299  if (num_subs < 1240)
1300  font->global_sub_bias = 107;
1301  else if (num_subs < 33900)
1302  font->global_sub_bias = 1131;
1303  else
1304  font->global_sub_bias = 32768;
1305 
1306  return CAIRO_STATUS_SUCCESS;
1307 }
1308 
1311 
1312 static const font_read_t font_read_funcs[] = {
1318 };
1319 
1320 static cairo_int_status_t
1322 {
1324  unsigned int i;
1325 
1326  for (i = 0; i < ARRAY_LENGTH (font_read_funcs); i++) {
1328  if (unlikely (status))
1329  return status;
1330  }
1331 
1332  return CAIRO_STATUS_SUCCESS;
1333 }
1334 
1335 static cairo_status_t
1337 {
1339  unsigned char buf[30];
1340  unsigned char *p;
1341  int sid1, sid2;
1342  const char *registry = "Adobe";
1343  const char *ordering = "Identity";
1344 
1345  sid1 = NUM_STD_STRINGS + _cairo_array_num_elements (&font->strings_subset_index);
1346  status = cff_index_append_copy (&font->strings_subset_index,
1347  (unsigned char *)registry,
1348  strlen(registry));
1349  if (unlikely (status))
1350  return status;
1351 
1352  sid2 = NUM_STD_STRINGS + _cairo_array_num_elements (&font->strings_subset_index);
1353  status = cff_index_append_copy (&font->strings_subset_index,
1354  (unsigned char *)ordering,
1355  strlen(ordering));
1356  if (unlikely (status))
1357  return status;
1358 
1359  p = encode_integer (buf, sid1);
1360  p = encode_integer (p, sid2);
1361  p = encode_integer (p, 0);
1362  status = cff_dict_set_operands (font->top_dict, ROS_OP, buf, p - buf);
1363  if (unlikely (status))
1364  return status;
1365 
1366  p = encode_integer (buf, font->scaled_font_subset->num_glyphs);
1367  status = cff_dict_set_operands (font->top_dict, CIDCOUNT_OP, buf, p - buf);
1368  if (unlikely (status))
1369  return status;
1370 
1371  return CAIRO_STATUS_SUCCESS;
1372 }
1373 
1374 static cairo_status_t
1376  cairo_hash_table_t *dict,
1377  int operator)
1378 {
1379  int size;
1380  unsigned char *p;
1381  int sid;
1382  unsigned char buf[100];
1385 
1386  p = cff_dict_get_operands (dict, operator, &size);
1387  if (!p)
1388  return CAIRO_STATUS_SUCCESS;
1389 
1390  decode_integer (p, &sid);
1391  if (sid < NUM_STD_STRINGS)
1392  return CAIRO_STATUS_SUCCESS;
1393 
1394  element = _cairo_array_index (&font->strings_index, sid - NUM_STD_STRINGS);
1395  sid = NUM_STD_STRINGS + _cairo_array_num_elements (&font->strings_subset_index);
1396  status = cff_index_append (&font->strings_subset_index, element->data, element->length);
1397  if (unlikely (status))
1398  return status;
1399 
1400  p = encode_integer (buf, sid);
1401  status = cff_dict_set_operands (dict, operator, buf, p - buf);
1402  if (unlikely (status))
1403  return status;
1404 
1405  return CAIRO_STATUS_SUCCESS;
1406 }
1407 
1408 static const int dict_strings[] = {
1409  VERSION_OP,
1410  NOTICE_OP,
1411  COPYRIGHT_OP,
1412  FULLNAME_OP,
1413  FAMILYNAME_OP,
1414  WEIGHT_OP,
1415  POSTSCRIPT_OP,
1417  FONTNAME_OP,
1418 };
1419 
1420 static cairo_status_t
1422  cairo_hash_table_t *dict)
1423 {
1425  unsigned int i;
1426 
1427  for (i = 0; i < ARRAY_LENGTH (dict_strings); i++) {
1429  if (unlikely (status))
1430  return status;
1431  }
1432 
1433  return CAIRO_STATUS_SUCCESS;
1434 }
1435 
1436 static unsigned char *
1437 type2_decode_integer (unsigned char *p, int *integer)
1438 {
1439  if (*p == 28) {
1440  *integer = p[1] << 8 | p[2];
1441  p += 3;
1442  } else if (*p <= 246) {
1443  *integer = *p++ - 139;
1444  } else if (*p <= 250) {
1445  *integer = (p[0] - 247) * 256 + p[1] + 108;
1446  p += 2;
1447  } else if (*p <= 254) {
1448  *integer = -(p[0] - 251) * 256 - p[1] - 108;
1449  p += 2;
1450  } else { /* *p == 255 */
1451  /* 16.16 fixed-point number. The fraction is ignored. */
1452  *integer = (int16_t)((p[1] << 8) | p[2]);
1453  p += 5;
1454  }
1455  return p;
1456 }
1457 
1458 /* Type 2 charstring parser for finding calls to local or global
1459  * subroutines. For non Opentype CFF fonts it also gets the glyph
1460  * widths.
1461  *
1462  * When we find a subroutine operator, the subroutine is marked as in
1463  * use and recursively followed. The subroutine number is the value on
1464  * the top of the stack when the subroutine operator is executed. In
1465  * most fonts the subroutine number is encoded in an integer
1466  * immediately preceding the subroutine operator. However it is
1467  * possible for the subroutine number on the stack to be the result of
1468  * a computation (in which case there will be an operator preceding
1469  * the subroutine operator). If this occurs, subroutine subsetting is
1470  * disabled since we can't easily determine which subroutines are
1471  * used.
1472  *
1473  * The width, if present, is the first integer in the charstring. The
1474  * only way to confirm if the integer at the start of the charstring is
1475  * the width is when the first stack clearing operator is parsed,
1476  * check if there is an extra integer left over on the stack.
1477  *
1478  * When the first stack clearing operator is encountered
1479  * type2_find_width is set to FALSE and type2_found_width is set to
1480  * TRUE if an extra argument is found, otherwise FALSE.
1481  */
1482 static cairo_status_t
1484  unsigned char *charstring, int length,
1485  int glyph_id,
1486  cairo_bool_t need_width)
1487 {
1488  unsigned char *p = charstring;
1489  unsigned char *end = charstring + length;
1490  int integer;
1491  int hint_bytes;
1492  int sub_num;
1494  int fd;
1495 
1496  while (p < end) {
1497  if (*p == 28 || *p >= 32) {
1498  /* Integer value */
1500  font->type2_stack_size++;
1501  font->type2_stack_top_value = integer;
1502  font->type2_stack_top_is_int = TRUE;
1503  if (!font->type2_seen_first_int) {
1504  font->type2_width = integer;
1505  font->type2_seen_first_int = TRUE;
1506  }
1507  } else if (*p == TYPE2_hstem || *p == TYPE2_vstem ||
1508  *p == TYPE2_hstemhm || *p == TYPE2_vstemhm) {
1509  /* Hint operator. The number of hints declared by the
1510  * operator depends on the size of the stack. */
1511  font->type2_stack_top_is_int = FALSE;
1512  font->type2_num_hints += font->type2_stack_size/2;
1513  if (font->type2_find_width && font->type2_stack_size % 2)
1514  font->type2_found_width = TRUE;
1515 
1516  font->type2_stack_size = 0;
1517  font->type2_find_width = FALSE;
1518  p++;
1519  } else if (*p == TYPE2_hintmask || *p == TYPE2_cntrmask) {
1520  /* Hintmask operator. These operators are followed by a
1521  * variable length mask where the length depends on the
1522  * number of hints declared. The first time this is called
1523  * it is also an implicit vstem if there are arguments on
1524  * the stack. */
1525  if (font->type2_hintmask_bytes == 0) {
1526  font->type2_stack_top_is_int = FALSE;
1527  font->type2_num_hints += font->type2_stack_size/2;
1528  if (font->type2_find_width && font->type2_stack_size % 2)
1529  font->type2_found_width = TRUE;
1530 
1531  font->type2_stack_size = 0;
1532  font->type2_find_width = FALSE;
1533  font->type2_hintmask_bytes = (font->type2_num_hints+7)/8;
1534  }
1535 
1536  hint_bytes = font->type2_hintmask_bytes;
1537  p++;
1538  p += hint_bytes;
1539  } else if (*p == TYPE2_rmoveto) {
1540  if (font->type2_find_width && font->type2_stack_size > 2)
1541  font->type2_found_width = TRUE;
1542 
1543  font->type2_stack_size = 0;
1544  font->type2_find_width = FALSE;
1545  font->type2_has_path = TRUE;
1546  p++;
1547  } else if (*p == TYPE2_hmoveto || *p == TYPE2_vmoveto) {
1548  if (font->type2_find_width && font->type2_stack_size > 1)
1549  font->type2_found_width = TRUE;
1550 
1551  font->type2_stack_size = 0;
1552  font->type2_find_width = FALSE;
1553  font->type2_has_path = TRUE;
1554  p++;
1555  } else if (*p == TYPE2_endchar) {
1556  if (!font->type2_has_path && font->type2_stack_size > 3)
1557  return CAIRO_INT_STATUS_UNSUPPORTED; /* seac (Ref Appendix C of Type 2 Charstring Format */
1558 
1559  if (font->type2_find_width && font->type2_stack_size > 0)
1560  font->type2_found_width = TRUE;
1561 
1562  return CAIRO_STATUS_SUCCESS;
1563  } else if (*p == TYPE2_callsubr) {
1564  /* call to local subroutine */
1565  if (! font->type2_stack_top_is_int)
1567 
1568  if (++font->type2_nesting_level > MAX_SUBROUTINE_NESTING)
1570 
1571  p++;
1572  font->type2_stack_top_is_int = FALSE;
1573  font->type2_stack_size--;
1574  if (font->type2_find_width && font->type2_stack_size == 0)
1575  font->type2_seen_first_int = FALSE;
1576 
1577  if (font->is_cid) {
1578  fd = font->fdselect[glyph_id];
1579  sub_num = font->type2_stack_top_value + font->fd_local_sub_bias[fd];
1580  element = _cairo_array_index (&font->fd_local_sub_index[fd], sub_num);
1581  if (! font->fd_local_subs_used[fd][sub_num]) {
1582  font->fd_local_subs_used[fd][sub_num] = TRUE;
1583  cairo_cff_parse_charstring (font, element->data, element->length, glyph_id, need_width);
1584  }
1585  } else {
1586  sub_num = font->type2_stack_top_value + font->local_sub_bias;
1587  element = _cairo_array_index (&font->local_sub_index, sub_num);
1588  if (! font->local_subs_used[sub_num] ||
1589  (need_width && !font->type2_found_width))
1590  {
1591  font->local_subs_used[sub_num] = TRUE;
1592  cairo_cff_parse_charstring (font, element->data, element->length, glyph_id, need_width);
1593  }
1594  }
1595  font->type2_nesting_level--;
1596  } else if (*p == TYPE2_callgsubr) {
1597  /* call to global subroutine */
1598  if (! font->type2_stack_top_is_int)
1600 
1601  if (++font->type2_nesting_level > MAX_SUBROUTINE_NESTING)
1603 
1604  p++;
1605  font->type2_stack_size--;
1606  font->type2_stack_top_is_int = FALSE;
1607  if (font->type2_find_width && font->type2_stack_size == 0)
1608  font->type2_seen_first_int = FALSE;
1609 
1610  sub_num = font->type2_stack_top_value + font->global_sub_bias;
1611  element = _cairo_array_index (&font->global_sub_index, sub_num);
1612  if (! font->global_subs_used[sub_num] ||
1613  (need_width && !font->type2_found_width))
1614  {
1615  font->global_subs_used[sub_num] = TRUE;
1616  cairo_cff_parse_charstring (font, element->data, element->length, glyph_id, need_width);
1617  }
1618  font->type2_nesting_level--;
1619  } else if (*p == 12) {
1620  /* 2 byte instruction */
1621 
1622  /* All the 2 byte operators are either not valid before a
1623  * stack clearing operator or they are one of the
1624  * arithmetic, storage, or conditional operators. */
1625  if (need_width && font->type2_find_width)
1627 
1628  p += 2;
1629  font->type2_stack_top_is_int = FALSE;
1630  } else {
1631  /* 1 byte instruction */
1632  p++;
1633  font->type2_stack_top_is_int = FALSE;
1634  }
1635  }
1636 
1637  return CAIRO_STATUS_SUCCESS;
1638 }
1639 
1640 static cairo_status_t
1642  unsigned char *charstring, int length,
1643  int glyph_id, int subset_id)
1644 {
1646  int width;
1647  int fd;
1648 
1649  font->type2_stack_size = 0;
1650  font->type2_stack_top_value = 0;;
1651  font->type2_stack_top_is_int = FALSE;
1652  font->type2_num_hints = 0;
1653  font->type2_hintmask_bytes = 0;
1654  font->type2_nesting_level = 0;
1655  font->type2_seen_first_int = FALSE;
1656  font->type2_find_width = TRUE;
1657  font->type2_found_width = FALSE;
1658  font->type2_width = 0;
1659  font->type2_has_path = FALSE;
1660 
1661  status = cairo_cff_parse_charstring (font, charstring, length, glyph_id, TRUE);
1662  if (status)
1663  return status;
1664 
1665  if (!font->is_opentype) {
1666  if (font->is_cid) {
1667  fd = font->fdselect[glyph_id];
1668  if (font->type2_found_width)
1669  width = font->fd_nominal_width[fd] + font->type2_width;
1670  else
1671  width = font->fd_default_width[fd];
1672  } else {
1673  if (font->type2_found_width)
1674  width = font->nominal_width + font->type2_width;
1675  else
1676  width = font->default_width;
1677  }
1678  font->widths[subset_id] = width;
1679  }
1680 
1681  return CAIRO_STATUS_SUCCESS;
1682 }
1683 
1684 static cairo_int_status_t
1685 cairo_cff_font_get_gid_for_cid (cairo_cff_font_t *font, unsigned long cid, unsigned long *gid)
1686 {
1687  unsigned char *p;
1688  unsigned long first_gid;
1689  unsigned long first_cid;
1690  int num_left;
1691  unsigned long c, g;
1692 
1693  if (cid == 0) {
1694  *gid = 0;
1695  return CAIRO_STATUS_SUCCESS;
1696  }
1697 
1698  switch (font->charset[0]) {
1699  /* Format 0 */
1700  case 0:
1701  p = font->charset + 1;
1702  g = 1;
1703  while (g <= (unsigned)font->num_glyphs && p < font->data_end) {
1704  c = get_unaligned_be16 (p);
1705  if (c == cid) {
1706  *gid = g;
1707  return CAIRO_STATUS_SUCCESS;
1708  }
1709  g++;
1710  p += 2;
1711  }
1712  break;
1713 
1714  /* Format 1 */
1715  case 1:
1716  first_gid = 1;
1717  p = font->charset + 1;
1718  while (first_gid <= (unsigned)font->num_glyphs && p + 2 < font->data_end) {
1719  first_cid = get_unaligned_be16 (p);
1720  num_left = p[2];
1721  if (cid >= first_cid && cid <= first_cid + num_left) {
1722  *gid = first_gid + cid - first_cid;
1723  return CAIRO_STATUS_SUCCESS;
1724  }
1725  first_gid += num_left + 1;
1726  p += 3;
1727  }
1728  break;
1729 
1730  /* Format 2 */
1731  case 2:
1732  first_gid = 1;
1733  p = font->charset + 1;
1734  while (first_gid <= (unsigned)font->num_glyphs && p + 3 < font->data_end) {
1735  first_cid = get_unaligned_be16 (p);
1736  num_left = get_unaligned_be16 (p+2);
1737  if (cid >= first_cid && cid <= first_cid + num_left) {
1738  *gid = first_gid + cid - first_cid;
1739  return CAIRO_STATUS_SUCCESS;
1740  }
1741  first_gid += num_left + 1;
1742  p += 4;
1743  }
1744  break;
1745 
1746  default:
1747  break;
1748  }
1750 }
1751 
1752 static cairo_int_status_t
1754 {
1756  unsigned int i;
1758  unsigned long glyph, cid;
1759 
1760  font->subset_subroutines = TRUE;
1761  for (i = 0; i < font->scaled_font_subset->num_glyphs; i++) {
1762  if (font->is_cid && !font->is_opentype) {
1763  cid = font->scaled_font_subset->glyphs[i];
1765  if (unlikely (status))
1766  return status;
1767  } else {
1768  glyph = font->scaled_font_subset->glyphs[i];
1769  }
1770  element = _cairo_array_index (&font->charstrings_index, glyph);
1771  status = cff_index_append (&font->charstrings_subset_index,
1772  element->data,
1773  element->length);
1774  if (unlikely (status))
1775  return status;
1776 
1777  if (font->subset_subroutines) {
1779  element->data, element->length,
1780  glyph, i);
1782  /* If parsing the charstrings fails we embed all the
1783  * subroutines. But if the font is not opentype we
1784  * need to successfully parse all charstrings to get
1785  * the widths. */
1786  font->subset_subroutines = FALSE;
1787  if (!font->is_opentype)
1788  return status;
1789  } else if (unlikely (status)) {
1790  return status;
1791  }
1792  }
1793  }
1794 
1795  return CAIRO_STATUS_SUCCESS;
1796 }
1797 
1798 static cairo_status_t
1800 {
1801  unsigned int i;
1802  int fd;
1803  int *reverse_map;
1804  unsigned long cid, gid;
1806 
1807  font->fdselect_subset = calloc (font->scaled_font_subset->num_glyphs,
1808  sizeof (int));
1809  if (unlikely (font->fdselect_subset == NULL))
1811 
1812  font->fd_subset_map = calloc (font->num_fontdicts, sizeof (int));
1813  if (unlikely (font->fd_subset_map == NULL))
1815 
1816  font->private_dict_offset = calloc (font->num_fontdicts, sizeof (int));
1817  if (unlikely (font->private_dict_offset == NULL))
1819 
1820  reverse_map = calloc (font->num_fontdicts, sizeof (int));
1821  if (unlikely (reverse_map == NULL))
1823 
1824  for (i = 0; i < font->num_fontdicts; i++)
1825  reverse_map[i] = -1;
1826 
1827  font->num_subset_fontdicts = 0;
1828  for (i = 0; i < font->scaled_font_subset->num_glyphs; i++) {
1829  if (font->is_opentype) {
1830  gid = font->scaled_font_subset->glyphs[i];
1831  } else {
1832  cid = font->scaled_font_subset->glyphs[i];
1834  if (unlikely (status)) {
1835  free (reverse_map);
1836  return status;
1837  }
1838  }
1839 
1840  fd = font->fdselect[gid];
1841  if (reverse_map[fd] < 0) {
1842  font->fd_subset_map[font->num_subset_fontdicts] = fd;
1843  reverse_map[fd] = font->num_subset_fontdicts++;
1844  }
1845  font->fdselect_subset[i] = reverse_map[fd];
1846  }
1847 
1848  free (reverse_map);
1849 
1850  return CAIRO_STATUS_SUCCESS;
1851 }
1852 
1853 static cairo_status_t
1855 {
1856  unsigned char buf[100];
1857  unsigned char *end_buf;
1859 
1860  font->num_fontdicts = 1;
1861  font->fd_dict = _cairo_malloc (sizeof (cairo_hash_table_t *));
1862  if (unlikely (font->fd_dict == NULL))
1864 
1865  if (cff_dict_init (&font->fd_dict[0])) {
1866  free (font->fd_dict);
1867  font->fd_dict = NULL;
1868  font->num_fontdicts = 0;
1870  }
1871 
1872  font->fd_subset_map = _cairo_malloc (sizeof (int));
1873  if (unlikely (font->fd_subset_map == NULL))
1875 
1876  font->private_dict_offset = _cairo_malloc (sizeof (int));
1877  if (unlikely (font->private_dict_offset == NULL))
1879 
1880  font->fd_subset_map[0] = 0;
1881  font->num_subset_fontdicts = 1;
1882 
1883  /* Set integer operand to max value to use max size encoding to reserve
1884  * space for any value later */
1885  end_buf = encode_integer_max (buf, 0);
1886  end_buf = encode_integer_max (end_buf, 0);
1887  status = cff_dict_set_operands (font->fd_dict[0], PRIVATE_OP, buf, end_buf - buf);
1888  if (unlikely (status))
1889  return status;
1890 
1891  return CAIRO_STATUS_SUCCESS;
1892 }
1893 
1894 static cairo_status_t
1896 {
1898  unsigned int i;
1899 
1901  if (unlikely (status))
1902  return status;
1903 
1904  if (font->is_cid) {
1905  for (i = 0; i < font->num_subset_fontdicts; i++) {
1906  status = cairo_cff_font_subset_dict_strings (font, font->fd_dict[font->fd_subset_map[i]]);
1907  if (unlikely (status))
1908  return status;
1909 
1910  status = cairo_cff_font_subset_dict_strings (font, font->fd_private_dict[font->fd_subset_map[i]]);
1911  if (unlikely (status))
1912  return status;
1913  }
1914  } else {
1916  }
1917 
1918  return status;
1919 }
1920 
1921 /* The Euro is the only the only character in the winansi encoding
1922  * with a glyph name that is not a CFF standard string. As the strings
1923  * are written before the charset, we need to check during the
1924  * subsetting phase if the Euro glyph is required and add the
1925  * glyphname to the list of strings to write out.
1926  */
1927 static cairo_status_t
1929 {
1931  unsigned int i;
1932  int ch;
1933  const char *euro = "Euro";
1934 
1935  for (i = 1; i < font->scaled_font_subset->num_glyphs; i++) {
1936  ch = font->scaled_font_subset->to_latin_char[i];
1937  if (ch == 128) {
1938  font->euro_sid = NUM_STD_STRINGS + _cairo_array_num_elements (&font->strings_subset_index);
1939  status = cff_index_append_copy (&font->strings_subset_index,
1940  (unsigned char *)euro, strlen(euro));
1941  return status;
1942  }
1943  }
1944 
1945  return CAIRO_STATUS_SUCCESS;
1946 }
1947 
1948 static cairo_status_t
1950 {
1952 
1953  if (!font->scaled_font_subset->is_latin) {
1955  if (unlikely (status))
1956  return status;
1957  }
1958 
1960  if (unlikely (status))
1961  return status;
1962 
1963  if (!font->scaled_font_subset->is_latin) {
1964  if (font->is_cid)
1966  else
1968  if (unlikely (status))
1969  return status;
1970  } else {
1971  font->private_dict_offset = _cairo_malloc (sizeof (int));
1972  if (unlikely (font->private_dict_offset == NULL))
1974  }
1975 
1977  if (unlikely (status))
1978  return status;
1979 
1980  if (font->scaled_font_subset->is_latin)
1982 
1983  return status;
1984 }
1985 
1986 /* Set the operand of the specified operator in the (already written)
1987  * top dict to point to the current position in the output
1988  * array. Operands updated with this function must have previously
1989  * been encoded with the 5-byte (max) integer encoding. */
1990 static void
1992  int operator)
1993 {
1994  int cur_pos;
1995  int offset;
1996  int size;
1997  unsigned char buf[10];
1998  unsigned char *buf_end;
1999  unsigned char *op_ptr;
2000 
2001  cur_pos = _cairo_array_num_elements (&font->output);
2003  offset = cff_dict_get_location (font->top_dict, operator, &size);
2004  assert (offset > 0);
2005  op_ptr = _cairo_array_index (&font->output, offset);
2006  memcpy (op_ptr, buf, buf_end - buf);
2007 }
2008 
2009 static cairo_status_t
2011 {
2012  return _cairo_array_append_multiple (&font->output,
2013  font->header,
2014  font->header->header_size);
2015 }
2016 
2017 static cairo_status_t
2019 {
2022 
2023  cff_index_init (&index);
2024 
2026  (unsigned char *) font->ps_name,
2027  strlen(font->ps_name));
2028  if (unlikely (status))
2029  goto FAIL;
2030 
2031  status = cff_index_write (&index, &font->output);
2032  if (unlikely (status))
2033  goto FAIL;
2034 
2035 FAIL:
2036  cff_index_fini (&index);
2037 
2038  return status;
2039 }
2040 
2041 static cairo_status_t
2043 {
2044  uint16_t count;
2045  unsigned char buf[10];
2046  unsigned char *p;
2047  int offset_index;
2048  int dict_start, dict_size;
2049  int offset_size = 4;
2051 
2052  /* Write an index containing the top dict */
2053 
2054  count = cpu_to_be16 (1);
2055  status = _cairo_array_append_multiple (&font->output, &count, 2);
2056  if (unlikely (status))
2057  return status;
2058  buf[0] = offset_size;
2059  status = _cairo_array_append (&font->output, buf);
2060  if (unlikely (status))
2061  return status;
2062  encode_index_offset (buf, offset_size, 1);
2063  status = _cairo_array_append_multiple (&font->output, buf, offset_size);
2064  if (unlikely (status))
2065  return status;
2066 
2067  /* Reserve space for last element of offset array and update after
2068  * dict is written */
2069  offset_index = _cairo_array_num_elements (&font->output);
2070  status = _cairo_array_append_multiple (&font->output, buf, offset_size);
2071  if (unlikely (status))
2072  return status;
2073 
2074  dict_start = _cairo_array_num_elements (&font->output);
2075  status = cff_dict_write (font->top_dict, &font->output);
2076  if (unlikely (status))
2077  return status;
2078  dict_size = _cairo_array_num_elements (&font->output) - dict_start;
2079 
2080  encode_index_offset (buf, offset_size, dict_size + 1);
2081  p = _cairo_array_index (&font->output, offset_index);
2082  memcpy (p, buf, offset_size);
2083 
2084  return CAIRO_STATUS_SUCCESS;
2085 }
2086 
2087 static cairo_status_t
2089 {
2090  return cff_index_write (&font->strings_subset_index, &font->output);
2091 }
2092 
2093 static cairo_status_t
2095 {
2096  unsigned int i;
2097  unsigned char return_op = TYPE2_return;
2098 
2099  /* poppler and fontforge don't like zero length subroutines so we
2100  * replace unused subroutines with a 'return' instruction. */
2101  if (font->subset_subroutines) {
2102  for (i = 0; i < _cairo_array_num_elements (&font->global_sub_index); i++) {
2103  if (! font->global_subs_used[i])
2104  cff_index_set_object (&font->global_sub_index, i, &return_op, 1);
2105  }
2106  }
2107 
2108  return cff_index_write (&font->global_sub_index, &font->output);
2109 }
2110 
2111 static cairo_status_t
2113 {
2114  unsigned char buf[2];
2116  unsigned int i;
2117 
2119  buf[0] = 0; /* Format 0 */
2120  buf[1] = font->scaled_font_subset->num_glyphs - 1;
2121  status = _cairo_array_append_multiple (&font->output, buf, 2);
2122  if (unlikely (status))
2123  return status;
2124 
2125  for (i = 1; i < font->scaled_font_subset->num_glyphs; i++) {
2126  unsigned char ch = font->scaled_font_subset->to_latin_char[i];
2127  status = _cairo_array_append (&font->output, &ch);
2128  if (unlikely (status))
2129  return status;
2130  }
2131 
2132  return CAIRO_STATUS_SUCCESS;
2133 }
2134 
2135 static cairo_status_t
2137 {
2138  unsigned char data;
2139  unsigned int i;
2141 
2143 
2144  if (font->is_cid) {
2145  data = 0;
2146  status = _cairo_array_append (&font->output, &data);
2147  if (unlikely (status))
2148  return status;
2149 
2150  for (i = 0; i < font->scaled_font_subset->num_glyphs; i++) {
2151  data = font->fdselect_subset[i];
2152  status = _cairo_array_append (&font->output, &data);
2153  if (unlikely (status))
2154  return status;
2155  }
2156  } else {
2157  unsigned char byte;
2158  uint16_t word;
2159 
2160  status = _cairo_array_grow_by (&font->output, 9);
2161  if (unlikely (status))
2162  return status;
2163 
2164  byte = 3;
2165  status = _cairo_array_append (&font->output, &byte);
2167 
2168  word = cpu_to_be16 (1);
2169  status = _cairo_array_append_multiple (&font->output, &word, 2);
2171 
2172  word = cpu_to_be16 (0);
2173  status = _cairo_array_append_multiple (&font->output, &word, 2);
2175 
2176  byte = 0;
2177  status = _cairo_array_append (&font->output, &byte);
2179 
2180  word = cpu_to_be16 (font->scaled_font_subset->num_glyphs);
2181  status = _cairo_array_append_multiple (&font->output, &word, 2);
2183  }
2184 
2185  return CAIRO_STATUS_SUCCESS;
2186 }
2187 
2188 /* Winansi to CFF standard strings mapping for characters 128 to 255 */
2189 static const int winansi_to_cff_std_string[] = {
2190  /* 128 */
2191  0, 0, 117, 101, 118, 121, 112, 113,
2192  126, 122, 192, 107, 142, 0, 199, 0,
2193  /* 144 */
2194  0, 65, 8, 105, 119, 116, 111, 137,
2195  127, 153, 221, 108, 148, 0, 228, 198,
2196  /* 160 */
2197  0, 96, 97, 98, 103, 100, 160, 102,
2198  131, 170, 139, 106, 151, 0, 165, 128,
2199  /* 176 */
2200  161, 156, 164, 169, 125, 152, 115, 114,
2201  133, 150, 143, 120, 158, 155, 163, 123,
2202  /* 192 */
2203  174, 171, 172, 176, 173, 175, 138, 177,
2204  181, 178, 179, 180, 185, 182, 183, 184,
2205  /* 208 */
2206  154, 186, 190, 187, 188, 191, 189, 168,
2207  141, 196, 193, 194, 195, 197, 157, 149,
2208  /* 224 */
2209  203, 200, 201, 205, 202, 204, 144, 206,
2210  210, 207, 208, 209, 214, 211, 212, 213,
2211  /* 240 */
2212  167, 215, 219, 216, 217, 220, 218, 159,
2213  147, 225, 222, 223, 224, 226, 162, 227,
2214 };
2215 
2216 static int
2218 {
2219  int sid;
2220 
2221  if (ch == 39) {
2222  sid = 104;
2223 
2224  } else if (ch == 96) {
2225  sid = 124;
2226 
2227  } else if (ch >= 32 && ch <= 126) {
2228  sid = ch - 31;
2229 
2230  } else if (ch == 128) {
2231  assert (font->euro_sid >= NUM_STD_STRINGS);
2232  sid = font->euro_sid;
2233 
2234  } else if (ch >= 128 && ch <= 255) {
2235  sid = winansi_to_cff_std_string[ch - 128];
2236 
2237  } else {
2238  sid = 0;
2239  }
2240 
2241  return sid;
2242 }
2243 
2244 static cairo_status_t
2246 {
2247  unsigned char format = 0;
2248  unsigned int i;
2249  int ch, sid;
2251  uint16_t sid_be16;
2252 
2254  status = _cairo_array_append (&font->output, &format);
2255  if (unlikely (status))
2256  return status;
2257 
2258  for (i = 1; i < font->scaled_font_subset->num_glyphs; i++) {
2259  ch = font->scaled_font_subset->to_latin_char[i];
2261  if (unlikely (status))
2262  return status;
2263 
2264  sid_be16 = cpu_to_be16(sid);
2265  status = _cairo_array_append_multiple (&font->output, &sid_be16, sizeof(sid_be16));
2266  if (unlikely (status))
2267  return status;
2268  }
2269 
2270  return CAIRO_STATUS_SUCCESS;
2271 }
2272 
2273 static cairo_status_t
2275 {
2276  unsigned char byte;
2277  uint16_t word;
2279 
2281  status = _cairo_array_grow_by (&font->output, 5);
2282  if (unlikely (status))
2283  return status;
2284 
2285  byte = 2;
2286  status = _cairo_array_append (&font->output, &byte);
2288 
2289  word = cpu_to_be16 (1);
2290  status = _cairo_array_append_multiple (&font->output, &word, 2);
2292 
2293  word = cpu_to_be16 (font->scaled_font_subset->num_glyphs - 2);
2294  status = _cairo_array_append_multiple (&font->output, &word, 2);
2296 
2297  return CAIRO_STATUS_SUCCESS;
2298 }
2299 
2300 static cairo_status_t
2302 {
2304 
2305  return cff_index_write (&font->charstrings_subset_index, &font->output);
2306 }
2307 
2308 static cairo_status_t
2310 {
2311  unsigned int i;
2313  unsigned int offset_array;
2314  unsigned char *offset_array_ptr;
2315  int offset_base;
2316  uint16_t count;
2317  uint8_t offset_size = 4;
2318 
2320  count = cpu_to_be16 (font->num_subset_fontdicts);
2322  if (unlikely (status))
2323  return status;
2324  status = _cairo_array_append (&font->output, &offset_size);
2325  if (unlikely (status))
2326  return status;
2327 
2328  offset_array = _cairo_array_num_elements (&font->output);
2329  status = _cairo_array_allocate (&font->output,
2330  (font->num_subset_fontdicts + 1)*offset_size,
2331  (void **) &offset_array_ptr);
2332  if (unlikely (status))
2333  return status;
2334  offset_base = _cairo_array_num_elements (&font->output) - 1;
2335  put_unaligned_be32(1, offset_array_ptr);
2336  offset_array += sizeof(uint32_t);
2337  for (i = 0; i < font->num_subset_fontdicts; i++) {
2338  status = cff_dict_write (font->fd_dict[font->fd_subset_map[i]],
2339  &font->output);
2340  if (unlikely (status))
2341  return status;
2342 
2343  offset_array_ptr = _cairo_array_index (&font->output, offset_array);
2344  put_unaligned_be32 (_cairo_array_num_elements (&font->output) - offset_base,
2345  offset_array_ptr);
2346  offset_array += sizeof(uint32_t);
2347  }
2348 
2349  return CAIRO_STATUS_SUCCESS;
2350 }
2351 
2352 static cairo_status_t
2354  int dict_num,
2355  cairo_hash_table_t *parent_dict,
2356  cairo_hash_table_t *private_dict)
2357 {
2358  int offset;
2359  int size;
2360  unsigned char buf[10];
2361  unsigned char *buf_end;
2362  unsigned char *p;
2364 
2365  /* Write private dict and update offset and size in top dict */
2366  font->private_dict_offset[dict_num] = _cairo_array_num_elements (&font->output);
2367  status = cff_dict_write (private_dict, &font->output);
2368  if (unlikely (status))
2369  return status;
2370 
2371  size = _cairo_array_num_elements (&font->output) - font->private_dict_offset[dict_num];
2372  /* private entry has two operands - size and offset */
2374  buf_end = encode_integer_max (buf_end, font->private_dict_offset[dict_num]);
2375  offset = cff_dict_get_location (parent_dict, PRIVATE_OP, &size);
2376  assert (offset > 0);
2377  p = _cairo_array_index (&font->output, offset);
2378  memcpy (p, buf, buf_end - buf);
2379 
2380  return CAIRO_STATUS_SUCCESS;
2381 }
2382 
2383 static cairo_status_t
2385  int dict_num,
2386  cairo_hash_table_t *private_dict,
2387  cairo_array_t *local_sub_index,
2388  cairo_bool_t *local_subs_used)
2389 {
2390  int offset;
2391  int size;
2392  unsigned char buf[10];
2393  unsigned char *buf_end;
2394  unsigned char *p;
2396  unsigned int i;
2397  unsigned char return_op = TYPE2_return;
2398 
2399  if (_cairo_array_num_elements (local_sub_index) > 0) {
2400  /* Write local subroutines and update offset in private
2401  * dict. Local subroutines offset is relative to start of
2402  * private dict */
2403  offset = _cairo_array_num_elements (&font->output) - font->private_dict_offset[dict_num];
2405  offset = cff_dict_get_location (private_dict, LOCAL_SUB_OP, &size);
2406  assert (offset > 0);
2407  p = _cairo_array_index (&font->output, offset);
2408  memcpy (p, buf, buf_end - buf);
2409 
2410  /* poppler and fontforge don't like zero length subroutines so
2411  * we replace unused subroutines with a 'return' instruction.
2412  */
2413  if (font->subset_subroutines) {
2414  for (i = 0; i < _cairo_array_num_elements (local_sub_index); i++) {
2415  if (! local_subs_used[i])
2416  cff_index_set_object (local_sub_index, i, &return_op, 1);
2417  }
2418  }
2419  status = cff_index_write (local_sub_index, &font->output);
2420  if (unlikely (status))
2421  return status;
2422  }
2423 
2424  return CAIRO_STATUS_SUCCESS;
2425 }
2426 
2427 
2428 static cairo_status_t
2430 {
2431  unsigned int i;
2433 
2434  if (font->is_cid) {
2435  for (i = 0; i < font->num_subset_fontdicts; i++) {
2437  font,
2438  i,
2439  font->fd_dict[font->fd_subset_map[i]],
2440  font->fd_private_dict[font->fd_subset_map[i]]);
2441  if (unlikely (status))
2442  return status;
2443  }
2444 
2445  for (i = 0; i < font->num_subset_fontdicts; i++) {
2447  font,
2448  i,
2449  font->fd_private_dict[font->fd_subset_map[i]],
2450  &font->fd_local_sub_index[font->fd_subset_map[i]],
2451  font->fd_local_subs_used[font->fd_subset_map[i]]);
2452  if (unlikely (status))
2453  return status;
2454  }
2455  } else {
2457  0,
2458  font->fd_dict[0],
2459  font->private_dict);
2460  if (unlikely (status))
2461  return status;
2462 
2464  0,
2465  font->private_dict,
2466  &font->local_sub_index,
2467  font->local_subs_used);
2468  if (unlikely (status))
2469  return status;
2470  }
2471 
2472  return CAIRO_STATUS_SUCCESS;
2473 }
2474 
2475 static cairo_status_t
2477 {
2479 
2481  0,
2482  font->top_dict,
2483  font->private_dict);
2484  if (unlikely (status))
2485  return status;
2486 
2488  0,
2489  font->private_dict,
2490  &font->local_sub_index,
2491  font->local_subs_used);
2492  if (unlikely (status))
2493  return status;
2494 
2495  return CAIRO_STATUS_SUCCESS;
2496 }
2497 
2498 
2501 
2513 };
2514 
2525 };
2526 
2527 static cairo_status_t
2529 {
2531  unsigned int i;
2532 
2533  if (font->scaled_font_subset->is_latin) {
2534  for (i = 0; i < ARRAY_LENGTH (font_write_type1_funcs); i++) {
2536  if (unlikely (status))
2537  return status;
2538  }
2539  } else {
2540  for (i = 0; i < ARRAY_LENGTH (font_write_cid_funcs); i++) {
2542  if (unlikely (status))
2543  return status;
2544  }
2545  }
2546 
2547  return CAIRO_STATUS_SUCCESS;
2548 }
2549 
2550 static cairo_int_status_t
2552  const char **data,
2553  unsigned long *length)
2554 {
2556 
2558  if (unlikely (status))
2559  return status;
2560 
2561  /* If the PS name is not found, create a CairoFont-x-y name. */
2562  if (font->ps_name == NULL) {
2563  font->ps_name = _cairo_malloc (30);
2564  if (unlikely (font->ps_name == NULL))
2566 
2567  snprintf(font->ps_name, 30, "CairoFont-%u-%u",
2568  font->scaled_font_subset->font_id,
2569  font->scaled_font_subset->subset_id);
2570  }
2571 
2573  if (unlikely (status))
2574  return status;
2575 
2577  if (unlikely (status))
2578  return status;
2579 
2580 
2581  *data = _cairo_array_index (&font->output, 0);
2582  *length = _cairo_array_num_elements (&font->output);
2583 
2584  return CAIRO_STATUS_SUCCESS;
2585 }
2586 
2587 static cairo_int_status_t
2589 {
2590  unsigned long size;
2591  unsigned long long_entry_size;
2592  unsigned long short_entry_size;
2593  unsigned int i;
2594  tt_hhea_t hhea;
2595  int num_hmetrics;
2596  uint16_t short_entry;
2597  int glyph_index;
2599 
2600  size = sizeof (tt_hhea_t);
2601  status = font->backend->load_truetype_table (font->scaled_font_subset->scaled_font,
2602  TT_TAG_hhea, 0,
2603  (unsigned char*) &hhea, &size);
2604  if (unlikely (status))
2605  return status;
2606  num_hmetrics = be16_to_cpu (hhea.num_hmetrics);
2607 
2608  for (i = 0; i < font->scaled_font_subset->num_glyphs; i++) {
2609  glyph_index = font->scaled_font_subset->glyphs[i];
2610  long_entry_size = 2 * sizeof (int16_t);
2611  short_entry_size = sizeof (int16_t);
2612  if (glyph_index < num_hmetrics) {
2613  status = font->backend->load_truetype_table (font->scaled_font_subset->scaled_font,
2614  TT_TAG_hmtx,
2615  glyph_index * long_entry_size,
2616  (unsigned char *) &short_entry,
2617  &short_entry_size);
2618  if (unlikely (status))
2619  return status;
2620  }
2621  else
2622  {
2623  status = font->backend->load_truetype_table (font->scaled_font_subset->scaled_font,
2624  TT_TAG_hmtx,
2625  (num_hmetrics - 1) * long_entry_size,
2626  (unsigned char *) &short_entry,
2627  &short_entry_size);
2628  if (unlikely (status))
2629  return status;
2630  }
2631  font->widths[i] = be16_to_cpu (short_entry);
2632  }
2633 
2634  return CAIRO_STATUS_SUCCESS;
2635 }
2636 
2637 static cairo_bool_t
2638 check_fontdata_is_cff (const unsigned char *data, long length)
2639 {
2641 
2642  if (length < (long)sizeof (cff_header_t))
2643  return FALSE;
2644 
2645  header = (cff_header_t *) data;
2646  if (header->major == 1 &&
2647  header->minor == 0 &&
2648  header->header_size == 4)
2649  {
2650  return TRUE;
2651  }
2652 
2653  return FALSE;
2654 }
2655 
2656 static cairo_int_status_t
2658 {
2659  const cairo_scaled_font_backend_t *backend = font->backend;
2661  tt_head_t head;
2662  tt_hhea_t hhea;
2663  unsigned long size, data_length;
2664 
2665  if (!backend->load_truetype_table)
2667 
2668  data_length = 0;
2669  status = backend->load_truetype_table (font->scaled_font_subset->scaled_font,
2670  TT_TAG_CFF, 0, NULL, &data_length);
2671  if (status)
2672  return status;
2673 
2674  size = sizeof (tt_head_t);
2675  status = backend->load_truetype_table (font->scaled_font_subset->scaled_font,
2676  TT_TAG_head, 0,
2677  (unsigned char *) &head, &size);
2678  if (unlikely (status))
2679  return status;
2680 
2681  size = sizeof (tt_hhea_t);
2682  status = backend->load_truetype_table (font->scaled_font_subset->scaled_font,
2683  TT_TAG_hhea, 0,
2684  (unsigned char *) &hhea, &size);
2685  if (unlikely (status))
2686  return status;
2687 
2688  size = 0;
2689  status = backend->load_truetype_table (font->scaled_font_subset->scaled_font,
2690  TT_TAG_hmtx, 0, NULL, &size);
2691  if (unlikely (status))
2692  return status;
2693 
2694  font->x_min = (int16_t) be16_to_cpu (head.x_min);
2695  font->y_min = (int16_t) be16_to_cpu (head.y_min);
2696  font->x_max = (int16_t) be16_to_cpu (head.x_max);
2697  font->y_max = (int16_t) be16_to_cpu (head.y_max);
2698  font->ascent = (int16_t) be16_to_cpu (hhea.ascender);
2699  font->descent = (int16_t) be16_to_cpu (hhea.descender);
2700  font->units_per_em = (int16_t) be16_to_cpu (head.units_per_em);
2701  if (font->units_per_em == 0)
2702  font->units_per_em = 1000;
2703 
2704  font->font_name = NULL;
2705  status = _cairo_truetype_read_font_name (font->scaled_font_subset->scaled_font,
2706  &font->ps_name,
2707  &font->font_name);
2709  return status;
2710 
2711  font->is_opentype = TRUE;
2712  font->data_length = data_length;
2713  font->data = _cairo_malloc (data_length);
2714  if (unlikely (font->data == NULL))
2716 
2717  status = font->backend->load_truetype_table (font->scaled_font_subset->scaled_font,
2718  TT_TAG_CFF, 0, font->data,
2719  &font->data_length);
2720  if (unlikely (status))
2721  return status;
2722 
2723  if (!check_fontdata_is_cff (font->data, data_length))
2725 
2726  return CAIRO_STATUS_SUCCESS;
2727 }
2728 
2729 static cairo_int_status_t
2731 {
2732  const cairo_scaled_font_backend_t *backend = font->backend;
2734  unsigned long data_length;
2735 
2736  if (!backend->load_type1_data)
2738 
2739  data_length = 0;
2740  status = backend->load_type1_data (font->scaled_font_subset->scaled_font,
2741  0, NULL, &data_length);
2742  if (unlikely (status))
2743  return status;
2744 
2745  font->font_name = NULL;
2746  font->is_opentype = FALSE;
2747  font->data_length = data_length;
2748  font->data = _cairo_malloc (data_length);
2749  if (unlikely (font->data == NULL))
2751 
2752  status = font->backend->load_type1_data (font->scaled_font_subset->scaled_font,
2753  0, font->data, &font->data_length);
2754  if (unlikely (status))
2755  return status;
2756 
2757  if (!check_fontdata_is_cff (font->data, data_length))
2759 
2760  return CAIRO_STATUS_SUCCESS;
2761 }
2762 
2763 static cairo_int_status_t
2765  cairo_cff_font_t **font_return,
2766  const char *subset_name)
2767 {
2770  cairo_bool_t is_synthetic;
2772 
2773  backend = scaled_font_subset->scaled_font->backend;
2774 
2775  /* We need to use a fallback font if this font differs from the CFF outlines. */
2776  if (backend->is_synthetic) {
2777  status = backend->is_synthetic (scaled_font_subset->scaled_font, &is_synthetic);
2778  if (unlikely (status))
2779  return status;
2780 
2781  if (is_synthetic)
2783  }
2784 
2785  font = calloc (1, sizeof (cairo_cff_font_t));
2786  if (unlikely (font == NULL))
2788 
2789  font->backend = backend;
2790  font->scaled_font_subset = scaled_font_subset;
2791 
2795  if (status)
2796  goto fail1;
2797 
2798  font->data_end = font->data + font->data_length;
2799  _cairo_array_init (&font->output, sizeof (char));
2800  status = _cairo_array_grow_by (&font->output, 4096);
2801  if (unlikely (status))
2802  goto fail2;
2803 
2804  font->subset_font_name = strdup (subset_name);
2805  if (unlikely (font->subset_font_name == NULL)) {
2807  goto fail2;
2808  }
2809 
2810  font->widths = calloc (font->scaled_font_subset->num_glyphs, sizeof (int));
2811  if (unlikely (font->widths == NULL)) {
2813  goto fail3;
2814  }
2815 
2816  if (font->is_opentype) {
2818  if (unlikely (status))
2819  goto fail4;
2820  }
2821 
2822  status = cff_dict_init (&font->top_dict);
2823  if (unlikely (status))
2824  goto fail4;
2825 
2826  status = cff_dict_init (&font->private_dict);
2827  if (unlikely (status))
2828  goto fail5;
2829 
2830  cff_index_init (&font->strings_index);
2831  cff_index_init (&font->charstrings_index);
2832  cff_index_init (&font->global_sub_index);
2833  cff_index_init (&font->local_sub_index);
2834  cff_index_init (&font->charstrings_subset_index);
2835  cff_index_init (&font->strings_subset_index);
2836  font->euro_sid = 0;
2837  font->fdselect = NULL;
2838  font->fd_dict = NULL;
2839  font->fd_private_dict = NULL;
2840  font->fd_local_sub_index = NULL;
2841  font->fd_local_sub_bias = NULL;
2842  font->fdselect_subset = NULL;
2843  font->fd_subset_map = NULL;
2844  font->private_dict_offset = NULL;
2845  font->global_subs_used = NULL;
2846  font->local_subs_used = NULL;
2847  font->fd_local_subs_used = NULL;
2848 
2849  *font_return = font;
2850 
2851  return CAIRO_STATUS_SUCCESS;
2852 
2853 fail5:
2854  _cairo_hash_table_destroy (font->top_dict);
2855 fail4:
2856  free (font->widths);
2857 fail3:
2858  free (font->subset_font_name);
2859 fail2:
2860  free (font->ps_name);
2861  _cairo_array_fini (&font->output);
2862 fail1:
2863  free (font->data);
2864  free (font->font_name);
2865  free (font);
2866 
2867  return status;
2868 }
2869 
2870 static void
2872 {
2873  unsigned int i;
2874 
2875  free (font->widths);
2876  free (font->font_name);
2877  free (font->ps_name);
2878  free (font->subset_font_name);
2879  _cairo_array_fini (&font->output);
2880  cff_dict_fini (font->top_dict);
2881  cff_dict_fini (font->private_dict);
2882  cff_index_fini (&font->strings_index);
2883  cff_index_fini (&font->charstrings_index);
2884  cff_index_fini (&font->global_sub_index);
2885  cff_index_fini (&font->local_sub_index);
2886  cff_index_fini (&font->charstrings_subset_index);
2887  cff_index_fini (&font->strings_subset_index);
2888 
2889  /* If we bailed out early as a result of an error some of the
2890  * following cairo_cff_font_t members may still be NULL */
2891  if (font->fd_dict) {
2892  for (i = 0; i < font->num_fontdicts; i++) {
2893  if (font->fd_dict[i])
2894  cff_dict_fini (font->fd_dict[i]);
2895  }
2896  free (font->fd_dict);
2897  }
2898  free (font->global_subs_used);
2899  free (font->local_subs_used);
2900  free (font->fd_subset_map);
2901  free (font->private_dict_offset);
2902 
2903  if (font->is_cid) {
2904  free (font->fdselect);
2905  free (font->fdselect_subset);
2906  if (font->fd_private_dict) {
2907  for (i = 0; i < font->num_fontdicts; i++) {
2908  if (font->fd_private_dict[i])
2909  cff_dict_fini (font->fd_private_dict[i]);
2910  }
2911  free (font->fd_private_dict);
2912  }
2913  if (font->fd_local_sub_index) {
2914  for (i = 0; i < font->num_fontdicts; i++)
2915  cff_index_fini (&font->fd_local_sub_index[i]);
2916  free (font->fd_local_sub_index);
2917  }
2918  free (font->fd_local_sub_bias);
2919  if (font->fd_local_subs_used) {
2920  for (i = 0; i < font->num_fontdicts; i++) {
2921  free (font->fd_local_subs_used[i]);
2922  }
2923  free (font->fd_local_subs_used);
2924  }
2925  free (font->fd_default_width);
2926  free (font->fd_nominal_width);
2927  }
2928 
2929  free (font->data);
2930 
2931  free (font);
2932 }
2933 
2936  const char *subset_name,
2937  cairo_scaled_font_subset_t *font_subset)
2938 {
2939  cairo_cff_font_t *font = NULL; /* squelch bogus compiler warning */
2941  const char *data = NULL; /* squelch bogus compiler warning */
2942  unsigned long length = 0; /* squelch bogus compiler warning */
2943  unsigned int i;
2944 
2945  status = _cairo_cff_font_create (font_subset, &font, subset_name);
2946  if (unlikely (status))
2947  return status;
2948 
2950  if (unlikely (status))
2951  goto fail1;
2952 
2953  cff_subset->ps_name = strdup (font->ps_name);
2954  if (unlikely (cff_subset->ps_name == NULL)) {
2956  goto fail1;
2957  }
2958 
2959  if (font->font_name) {
2960  cff_subset->family_name_utf8 = strdup (font->font_name);
2961  if (cff_subset->family_name_utf8 == NULL) {
2963  goto fail2;
2964  }
2965  } else {
2966  cff_subset->family_name_utf8 = NULL;
2967  }
2968 
2969  cff_subset->widths = calloc (sizeof (double), font->scaled_font_subset->num_glyphs);
2970  if (unlikely (cff_subset->widths == NULL)) {
2972  goto fail3;
2973  }
2974  for (i = 0; i < font->scaled_font_subset->num_glyphs; i++)
2975  cff_subset->widths[i] = (double)font->widths[i]/font->units_per_em;
2976 
2977  cff_subset->x_min = (double)font->x_min/font->units_per_em;
2978  cff_subset->y_min = (double)font->y_min/font->units_per_em;
2979  cff_subset->x_max = (double)font->x_max/font->units_per_em;
2980  cff_subset->y_max = (double)font->y_max/font->units_per_em;
2981  cff_subset->ascent = (double)font->ascent/font->units_per_em;
2982  cff_subset->descent = (double)font->descent/font->units_per_em;
2983 
2984  cff_subset->data = _cairo_malloc (length);
2985  if (unlikely (cff_subset->data == NULL)) {
2987  goto fail4;
2988  }
2989 
2990  memcpy (cff_subset->data, data, length);
2991  cff_subset->data_length = length;
2992 
2994 
2995  return CAIRO_STATUS_SUCCESS;
2996 
2997  fail4:
2998  free (cff_subset->widths);
2999  fail3:
3000  free (cff_subset->family_name_utf8);
3001  fail2:
3002  free (cff_subset->ps_name);
3003  fail1:
3005 
3006  return status;
3007 }
3008 
3009 void
3011 {
3012  free (subset->ps_name);
3013  free (subset->family_name_utf8);
3014  free (subset->widths);
3015  free (subset->data);
3016 }
3017 
3020 {
3023  unsigned char *data;
3024  unsigned long data_length;
3025  unsigned char *current_ptr;
3026  unsigned char *data_end;
3029  cairo_hash_table_t *top_dict;
3031  int size;
3032  cairo_bool_t is_cid = FALSE;
3033 
3034  backend = scaled_font->backend;
3035  data = NULL;
3036  data_length = 0;
3038  /* Try to load an OpenType/CFF font */
3039  if (backend->load_truetype_table &&
3040  (status = backend->load_truetype_table (scaled_font, TT_TAG_CFF,
3041  0, NULL, &data_length)) == CAIRO_INT_STATUS_SUCCESS)
3042  {
3043  data = _cairo_malloc (data_length);
3044  if (unlikely (data == NULL)) {
3046  return FALSE;
3047  }
3048 
3049  status = backend->load_truetype_table (scaled_font, TT_TAG_CFF,
3050  0, data, &data_length);
3051  if (unlikely (status))
3052  goto fail1;
3053  }
3054  /* Try to load a CFF font */
3056  backend->load_type1_data &&
3057  (status = backend->load_type1_data (scaled_font,
3058  0, NULL, &data_length)) == CAIRO_INT_STATUS_SUCCESS)
3059  {
3060  data = _cairo_malloc (data_length);
3061  if (unlikely (data == NULL)) {
3063  return FALSE;
3064  }
3065 
3066  status = backend->load_type1_data (scaled_font, 0, data, &data_length);
3067  if (unlikely (status))
3068  goto fail1;
3069  }
3070  if (status)
3071  goto fail1;
3072 
3073  /* Check if it looks like a CFF font */
3074  if (!check_fontdata_is_cff (data, data_length))
3075  goto fail1;
3076 
3077  data_end = data + data_length;
3078 
3079  /* skip header */
3080  if (data_length < sizeof (cff_header_t))
3081  goto fail1;
3082 
3083  header = (cff_header_t *) data;
3084  current_ptr = data + header->header_size;
3085 
3086  /* skip name */
3087  cff_index_init (&index);
3088  status = cff_index_read (&index, &current_ptr, data_end);
3089  cff_index_fini (&index);
3090 
3091  if (status)
3092  goto fail1;
3093 
3094  /* read top dict */
3095  cff_index_init (&index);
3096  status = cff_index_read (&index, &current_ptr, data_end);
3097  if (unlikely (status))
3098  goto fail2;
3099 
3100  status = cff_dict_init (&top_dict);
3101  if (unlikely (status))
3102  goto fail2;
3103 
3105  status = cff_dict_read (top_dict, element->data, element->length);
3106  if (unlikely (status))
3107  goto fail3;
3108 
3109  /* check for ROS operator indicating a CID font */
3110  if (cff_dict_get_operands (top_dict, ROS_OP, &size) != NULL)
3111  is_cid = TRUE;
3112 
3113 fail3:
3114  cff_dict_fini (top_dict);
3115 
3116 fail2:
3117  cff_index_fini (&index);
3118 
3119 fail1:
3120  free (data);
3121 
3122  return is_cid;
3123 }
3124 
3125 static cairo_int_status_t
3127  cairo_cff_font_t **font_return,
3128  const char *subset_name)
3129 {
3132 
3133  font = _cairo_malloc (sizeof (cairo_cff_font_t));
3134  if (unlikely (font == NULL))
3136 
3137  font->backend = NULL;
3138  font->scaled_font_subset = scaled_font_subset;
3139 
3140  _cairo_array_init (&font->output, sizeof (char));
3141  status = _cairo_array_grow_by (&font->output, 4096);
3142  if (unlikely (status))
3143  goto fail1;
3144 
3145  font->subset_font_name = strdup (subset_name);
3146  if (unlikely (font->subset_font_name == NULL)) {
3148  goto fail1;
3149  }
3150 
3151  font->ps_name = strdup (subset_name);
3152  if (unlikely (font->ps_name == NULL)) {
3154  goto fail2;
3155  }
3156  font->font_name = NULL;
3157 
3158  font->x_min = 0;
3159  font->y_min = 0;
3160  font->x_max = 0;
3161  font->y_max = 0;
3162  font->ascent = 0;
3163  font->descent = 0;
3164 
3165  font->widths = calloc (font->scaled_font_subset->num_glyphs, sizeof (int));
3166  if (unlikely (font->widths == NULL)) {
3168  goto fail3;
3169  }
3170 
3171  font->data_length = 0;
3172  font->data = NULL;
3173  font->data_end = NULL;
3174 
3175  status = cff_dict_init (&font->top_dict);
3176  if (unlikely (status))
3177  goto fail4;
3178 
3179  status = cff_dict_init (&font->private_dict);
3180  if (unlikely (status))
3181  goto fail5;
3182 
3183  cff_index_init (&font->strings_index);
3184  cff_index_init (&font->charstrings_index);
3185  cff_index_init (&font->global_sub_index);
3186  cff_index_init (&font->local_sub_index);
3187  cff_index_init (&font->charstrings_subset_index);
3188  cff_index_init (&font->strings_subset_index);
3189  font->global_subs_used = NULL;
3190  font->local_subs_used = NULL;
3191  font->subset_subroutines = FALSE;
3192  font->fdselect = NULL;
3193  font->fd_dict = NULL;
3194  font->fd_private_dict = NULL;
3195  font->fd_local_sub_index = NULL;
3196  font->fdselect_subset = NULL;
3197  font->fd_subset_map = NULL;
3198  font->private_dict_offset = NULL;
3199 
3200  *font_return = font;
3201 
3202  return CAIRO_STATUS_SUCCESS;
3203 
3204 fail5:
3205  _cairo_hash_table_destroy (font->top_dict);
3206 fail4:
3207  free (font->widths);
3208 fail3:
3209  free (font->font_name);
3210  free (font->ps_name);
3211 fail2:
3212  free (font->subset_font_name);
3213 fail1:
3214  _cairo_array_fini (&font->output);
3215  free (font);
3216  return status;
3217 }
3218 
3219 static cairo_int_status_t
3221  cairo_type2_charstrings_t *type2_subset,
3222  const char **data,
3223  unsigned long *length)
3224 {
3227  cairo_array_t *charstring;
3228  unsigned char buf[40];
3229  unsigned char *end_buf, *end_buf2;
3230  unsigned int i;
3231  int sid;
3232 
3233  /* Create header */
3234  header.major = 1;
3235  header.minor = 0;
3236  header.header_size = 4;
3237  header.offset_size = 4;
3238  font->header = &header;
3239 
3240  /* Create Top Dict */
3241  font->is_cid = FALSE;
3242 
3243  snprintf((char*)buf, sizeof(buf), "CairoFont-%u-%u",
3244  font->scaled_font_subset->font_id,
3245  font->scaled_font_subset->subset_id);
3246  sid = NUM_STD_STRINGS + _cairo_array_num_elements (&font->strings_subset_index);
3247  status = cff_index_append_copy (&font->strings_subset_index,
3248  (unsigned char *)buf,
3249  strlen((char*)buf));
3250  if (unlikely (status))
3251  return status;
3252 
3253  end_buf = encode_integer (buf, sid);
3255  buf, end_buf - buf);
3256  if (unlikely (status))
3257  return status;
3258 
3260  buf, end_buf - buf);
3261  if (unlikely (status))
3262  return status;
3263 
3264  end_buf = encode_integer (buf, type2_subset->x_min);
3265  end_buf = encode_integer (end_buf, type2_subset->y_min);
3266  end_buf = encode_integer (end_buf, type2_subset->x_max);
3267  end_buf = encode_integer (end_buf, type2_subset->y_max);
3268  status = cff_dict_set_operands (font->top_dict,
3269  FONTBBOX_OP, buf, end_buf - buf);
3270  if (unlikely (status))
3271  return status;
3272 
3273  end_buf = encode_integer_max (buf, 0);
3274  status = cff_dict_set_operands (font->top_dict,
3275  CHARSTRINGS_OP, buf, end_buf - buf);
3276  if (unlikely (status))
3277  return status;
3278 
3279 
3280  if (font->scaled_font_subset->is_latin) {
3281  status = cff_dict_set_operands (font->top_dict,
3282  ENCODING_OP, buf, end_buf - buf);
3283  if (unlikely (status))
3284  return status;
3285 
3286  /* Private has two operands - size and offset */
3287  end_buf2 = encode_integer_max (end_buf, 0);
3288  cff_dict_set_operands (font->top_dict, PRIVATE_OP, buf, end_buf2 - buf);
3289  if (unlikely (status))
3290  return status;
3291 
3292  } else {
3293  status = cff_dict_set_operands (font->top_dict,
3294  FDSELECT_OP, buf, end_buf - buf);
3295  if (unlikely (status))
3296  return status;
3297 
3298  status = cff_dict_set_operands (font->top_dict,
3299  FDARRAY_OP, buf, end_buf - buf);
3300  if (unlikely (status))
3301  return status;
3302  }
3303 
3304  status = cff_dict_set_operands (font->top_dict,
3305  CHARSET_OP, buf, end_buf - buf);
3306  if (unlikely (status))
3307  return status;
3308 
3309  if (!font->scaled_font_subset->is_latin) {
3311  if (unlikely (status))
3312  return status;
3313 
3314  /* Create CID FD dictionary */
3316  if (unlikely (status))
3317  return status;
3318  } else {
3319  font->private_dict_offset = _cairo_malloc (sizeof (int));
3320  if (unlikely (font->private_dict_offset == NULL))
3322  }
3323 
3324  /* Create charstrings */
3325  for (i = 0; i < font->scaled_font_subset->num_glyphs; i++) {
3326  charstring = _cairo_array_index(&type2_subset->charstrings, i);
3327 
3328  status = cff_index_append (&font->charstrings_subset_index,
3329  _cairo_array_index (charstring, 0),
3330  _cairo_array_num_elements (charstring));
3331 
3332  if (unlikely (status))
3333  return status;
3334  }
3335 
3336  if (font->scaled_font_subset->is_latin)
3338 
3340  if (unlikely (status))
3341  return status;
3342 
3343  *data = _cairo_array_index (&font->output, 0);
3344  *length = _cairo_array_num_elements (&font->output);
3345 
3346  return CAIRO_STATUS_SUCCESS;
3347 }
3348 
3351  const char *subset_name,
3352  cairo_scaled_font_subset_t *font_subset)
3353 {
3354  cairo_cff_font_t *font = NULL; /* squelch bogus compiler warning */
3356  const char *data = NULL; /* squelch bogus compiler warning */
3357  unsigned long length = 0; /* squelch bogus compiler warning */
3358  unsigned int i;
3359  cairo_type2_charstrings_t type2_subset;
3360 
3361  status = _cairo_cff_font_fallback_create (font_subset, &font, subset_name);
3362  if (unlikely (status))
3363  return status;
3364 
3365  status = _cairo_type2_charstrings_init (&type2_subset, font_subset);
3366  if (unlikely (status))
3367  goto fail1;
3368 
3369  status = cairo_cff_font_fallback_generate (font, &type2_subset, &data, &length);
3370  if (unlikely (status))
3371  goto fail2;
3372 
3373  cff_subset->family_name_utf8 = NULL;
3374  cff_subset->ps_name = strdup (font->ps_name);
3375  if (unlikely (cff_subset->ps_name == NULL)) {
3377  goto fail2;
3378  }
3379 
3380  cff_subset->widths = calloc (sizeof (double), font->scaled_font_subset->num_glyphs);
3381  if (unlikely (cff_subset->widths == NULL)) {
3383  goto fail3;
3384  }
3385 
3386  for (i = 0; i < font->scaled_font_subset->num_glyphs; i++)
3387  cff_subset->widths[i] = (double)type2_subset.widths[i]/1000;
3388 
3389  cff_subset->x_min = (double)type2_subset.x_min/1000;
3390  cff_subset->y_min = (double)type2_subset.y_min/1000;
3391  cff_subset->x_max = (double)type2_subset.x_max/1000;
3392  cff_subset->y_max = (double)type2_subset.y_max/1000;
3393  cff_subset->ascent = (double)type2_subset.y_max/1000;
3394  cff_subset->descent = (double)type2_subset.y_min/1000;
3395 
3396  cff_subset->data = _cairo_malloc (length);
3397  if (unlikely (cff_subset->data == NULL)) {
3399  goto fail4;
3400  }
3401 
3402  memcpy (cff_subset->data, data, length);
3403  cff_subset->data_length = length;
3404 
3405  _cairo_type2_charstrings_fini (&type2_subset);
3407 
3408  return CAIRO_STATUS_SUCCESS;
3409 
3410  fail4:
3411  free (cff_subset->widths);
3412  fail3:
3413  free (cff_subset->ps_name);
3414  fail2:
3415  _cairo_type2_charstrings_fini (&type2_subset);
3416  fail1:
3418 
3419  return status;
3420 }
3421 
3422 void
3424 {
3425  free (subset->ps_name);
3426  free (subset->widths);
3427  free (subset->data);
3428 }
3429 
3430 #endif /* CAIRO_HAS_FONT_SUBSET */
return _Result< 0 ? -1 :_Result;} #line 1069 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsnwprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1091 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, va_list _ArgList) { return _vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1108 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format, va_list _Args);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format, va_list _ArgList) { return _vsnwprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1133 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_c_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1163 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_c(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1179 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1196 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl __vswprintf_l(wchar_t *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vswprintf_l(_Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1212 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf(wchar_t *const _Buffer, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_l(_Buffer,(size_t) -1, _Format,((void *) 0), _ArgList);} #line 1227 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswprintf(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1243 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1264 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1281 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1283 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_p_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_p((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1312 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_p(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1328 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_l(wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1347 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf(wchar_t const *const _Format, va_list _ArgList) { return _vscwprintf_l(_Format,((void *) 0), _ArgList);} #line 1361 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_p_l(wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_p((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1380 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_p(wchar_t const *const _Format, va_list _ArgList) { return _vscwprintf_p_l(_Format,((void *) 0), _ArgList);} #line 1394 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl __swprintf_l(wchar_t *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__vswprintf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1414 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1435 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf(wchar_t *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__vswprintf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1454 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swprintf(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1474 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "__swprintf_l_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl __swprintf_l(wchar_t *_Buffer, wchar_t const *_Format, _locale_t _Locale,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vswprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl __vswprintf_l(wchar_t *_Buffer, wchar_t const *_Format, _locale_t _Locale, va_list _Args);__declspec(deprecated("This function or variable may be unsafe. Consider using " "swprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _swprintf(wchar_t *_Buffer, wchar_t const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "vswprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vswprintf(wchar_t *_Buffer, wchar_t const *_Format, va_list _Args);__inline int __cdecl _swprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1511 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1532 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1534 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_p_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1562 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_p(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1582 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_c_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1603 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_c(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1623 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1646 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1668 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1690 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1711 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_l(wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1737 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf(wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1755 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_p_l(wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_p_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1774 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_p(wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_p_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1792 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #pragma warning(push) #pragma warning(disable:4141 6054) #pragma warning(pop) #line 1856 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" int __cdecl __stdio_common_vswscanf(unsigned __int64 _Options, wchar_t const *_Buffer, size_t _BufferCount, wchar_t const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vswscanf_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options()), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1897 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswscanf(wchar_t const *_Buffer, wchar_t const *_Format, va_list _ArgList) { return _vswscanf_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 1912 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswscanf_s_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1930 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswscanf_s(wchar_t const *const _Buffer, wchar_t const *const _Format, va_list _ArgList) { return _vswscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 1947 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1949 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwscanf_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1976 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwscanf_s_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1995 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_swscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _swscanf_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2015 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "swscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl swscanf(wchar_t const *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2034 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swscanf_s_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_s_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2054 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swscanf_s(wchar_t const *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2075 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 2077 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwscanf_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2100 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwscanf(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2122 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwscanf_s_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2143 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwscanf_s(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2163 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) typedef __int64 fpos_t;errno_t __cdecl _get_stream_buffer_pointers(FILE *_Stream, char ***_Base, char ***_Pointer, int **_Count);errno_t __cdecl clearerr_s(FILE *_Stream);errno_t __cdecl fopen_s(FILE **_Stream, char const *_FileName, char const *_Mode);size_t __cdecl fread_s(void *_Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);errno_t __cdecl freopen_s(FILE **_Stream, char const *_FileName, char const *_Mode, FILE *_OldStream);char *__cdecl gets_s(char *_Buffer, rsize_t _Size);errno_t __cdecl tmpfile_s(FILE **_Stream);errno_t __cdecl tmpnam_s(char *_Buffer, rsize_t _Size);#line 145 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" void __cdecl clearerr(FILE *_Stream);int __cdecl fclose(FILE *_Stream);int __cdecl _fcloseall(void);FILE *__cdecl _fdopen(int _FileHandle, char const *_Mode);int __cdecl feof(FILE *_Stream);int __cdecl ferror(FILE *_Stream);int __cdecl fflush(FILE *_Stream);int __cdecl fgetc(FILE *_Stream);int __cdecl _fgetchar(void);int __cdecl fgetpos(FILE *_Stream, fpos_t *_Position);char *__cdecl fgets(char *_Buffer, int _MaxCount, FILE *_Stream);int __cdecl _fileno(FILE *_Stream);int __cdecl _flushall(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "fopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl fopen(char const *_FileName, char const *_Mode);int __cdecl fputc(int _Character, FILE *_Stream);int __cdecl _fputchar(int _Character);int __cdecl fputs(char const *_Buffer, FILE *_Stream);size_t __cdecl fread(void *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);__declspec(deprecated("This function or variable may be unsafe. Consider using " "freopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl freopen(char const *_FileName, char const *_Mode, FILE *_Stream);FILE *__cdecl _fsopen(char const *_FileName, char const *_Mode, int _ShFlag);int __cdecl fsetpos(FILE *_Stream, fpos_t const *_Position);int __cdecl fseek(FILE *_Stream, long _Offset, int _Origin);int __cdecl _fseeki64(FILE *_Stream, __int64 _Offset, int _Origin);long __cdecl ftell(FILE *_Stream);__int64 __cdecl _ftelli64(FILE *_Stream);size_t __cdecl fwrite(void const *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl getc(FILE *_Stream);int __cdecl getchar(void);int __cdecl _getmaxstdio(void);int __cdecl _getw(FILE *_Stream);void __cdecl perror(char const *_ErrorMessage);int __cdecl _pclose(FILE *_Stream);FILE *__cdecl _popen(char const *_Command, char const *_Mode);#line 344 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl putc(int _Character, FILE *_Stream);int __cdecl putchar(int _Character);int __cdecl puts(char const *_Buffer);int __cdecl _putw(int _Word, FILE *_Stream);int __cdecl remove(char const *_FileName);int __cdecl rename(char const *_OldFileName, char const *_NewFileName);int __cdecl _unlink(char const *_FileName);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_unlink" ". See online help for details.")) int __cdecl unlink(char const *_FileName);#line 391 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" void __cdecl rewind(FILE *_Stream);int __cdecl _rmtmp(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "setvbuf" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) void __cdecl setbuf(FILE *_Stream, char *_Buffer);int __cdecl _setmaxstdio(int _Maximum);int __cdecl setvbuf(FILE *_Stream, char *_Buffer, int _Mode, size_t _Size);__declspec(allocator) char *__cdecl _tempnam(char const *_DirectoryName, char const *_FilePrefix);__declspec(deprecated("This function or variable may be unsafe. Consider using " "tmpfile_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl tmpfile(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "tmpnam_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl tmpnam(char *_Buffer);int __cdecl ungetc(int _Character, FILE *_Stream);void __cdecl _lock_file(FILE *_Stream);void __cdecl _unlock_file(FILE *_Stream);int __cdecl _fclose_nolock(FILE *_Stream);int __cdecl _fflush_nolock(FILE *_Stream);int __cdecl _fgetc_nolock(FILE *_Stream);int __cdecl _fputc_nolock(int _Character, FILE *_Stream);size_t __cdecl _fread_nolock(void *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);size_t __cdecl _fread_nolock_s(void *_Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl _fseek_nolock(FILE *_Stream, long _Offset, int _Origin);int __cdecl _fseeki64_nolock(FILE *_Stream, __int64 _Offset, int _Origin);long __cdecl _ftell_nolock(FILE *_Stream);__int64 __cdecl _ftelli64_nolock(FILE *_Stream);size_t __cdecl _fwrite_nolock(void const *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl _getc_nolock(FILE *_Stream);int __cdecl _putc_nolock(int _Character, FILE *_Stream);int __cdecl _ungetc_nolock(int _Character, FILE *_Stream);int *__cdecl __p__commode(void);#line 596 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vfprintf(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vfprintf_s(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vfprintf_p(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vfprintf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 648 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfprintf(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_l(_Stream, _Format,((void *) 0), _ArgList);} #line 662 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf_s((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 677 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfprintf_s(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_s_l(_Stream, _Format,((void *) 0), _ArgList);} #line 693 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 695 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_p_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf_p((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 710 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_p(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_p_l(_Stream, _Format,((void *) 0), _ArgList);} #line 724 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 738 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vprintf(char const *const _Format, va_list _ArgList) { return _vfprintf_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 751 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_s_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 765 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vprintf_s(char const *const _Format, va_list _ArgList) { return _vfprintf_s_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 780 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 782 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_p_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 796 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_p(char const *const _Format, va_list _ArgList) { return _vfprintf_p_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 809 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 828 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fprintf(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 846 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl _set_printf_count_output(int _Value);int __cdecl _get_printf_count_output(void);__inline int __cdecl _fprintf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 871 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fprintf_s(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 891 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 893 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_p_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 912 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_p(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 930 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 948 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl printf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 965 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_s_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 983 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl printf_s(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1002 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1004 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_p_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1022 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_p(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1039 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vfscanf(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _Arglist);__inline int __cdecl _vfscanf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfscanf((*__local_stdio_scanf_options()), _Stream, _Format, _Locale, _ArgList);} #line 1070 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfscanf(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfscanf_l(_Stream, _Format,((void *) 0), _ArgList);} #line 1084 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfscanf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Stream, _Format, _Locale, _ArgList);} #line 1101 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfscanf_s(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfscanf_s_l(_Stream, _Format,((void *) 0), _ArgList);} #line 1118 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1120 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscanf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);} #line 1134 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vscanf(char const *const _Format, va_list _ArgList) { return _vfscanf_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);} #line 1147 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscanf_s_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);} #line 1161 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vscanf_s(char const *const _Format, va_list _ArgList) { return _vfscanf_s_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);} #line 1176 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1178 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_fscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _fscanf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1197 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "fscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl fscanf(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1215 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fscanf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1234 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fscanf_s(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1254 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1256 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_scanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _scanf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1274 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "scanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl scanf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1291 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scanf_s_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1309 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl scanf_s(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1328 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1330 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vsprintf(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsprintf_s(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsnprintf_s(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, size_t _MaxCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsprintf_p(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnprintf_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1399 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1415 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsnprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 1), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);return _Result< 0 ? -1 :_Result;} #line 1446 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsprintf_l(char *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vsnprintf_l(_Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1462 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "vsprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl vsprintf(char *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsnprintf_l(_Buffer,(size_t) -1, _Format,((void *) 0), _ArgList);} #line 1477 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_s_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1498 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsprintf_s(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1516 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1526 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_p_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_p((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1547 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_p(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1563 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_s_l(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsnprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1585 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1602 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsnprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1630 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1641 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1659 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf(char const *const _Format, va_list _ArgList) { return _vscprintf_l(_Format,((void *) 0), _ArgList);} #line 1672 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_p_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_p((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1690 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_p(char const *const _Format, va_list _ArgList) { return _vscprintf_p_l(_Format,((void *) 0), _ArgList);} #line 1703 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_c_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1723 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_c(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1739 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_sprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _sprintf_l(char *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1761 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sprintf(char *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1782 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "sprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl sprintf(char *_Buffer, char const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "vsprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl vsprintf(char *_Buffer, char const *_Format, va_list _Args);__inline int __cdecl _sprintf_s_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1810 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sprintf_s(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1832 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1834 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sprintf_p_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1862 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sprintf_p(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1882 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snprintf_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1905 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl snprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=vsnprintf(_Buffer, _BufferCount, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1936 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf(_Buffer, _BufferCount, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1956 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl _snprintf(char *_Buffer, size_t _BufferCount, char const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl _vsnprintf(char *_Buffer, size_t _BufferCount, char const *_Format, va_list _Args);__inline int __cdecl _snprintf_c_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1986 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_c(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2006 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_s_l(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2028 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2049 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2075 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2092 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_p_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_p_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2110 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_p(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_p(_Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2127 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vsscanf(unsigned __int64 _Options, char const *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vsscanf_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 2158 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsscanf(char const *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsscanf_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 2172 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsscanf_s_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 2189 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(push) #pragma warning(disable:6530) __inline int __cdecl vsscanf_s(char const *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 2208 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(pop) #line 2219 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_sscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _sscanf_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2238 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "sscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl sscanf(char const *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2256 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sscanf_s_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_s_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2275 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sscanf_s(char const *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=vsscanf_s(_Buffer, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2297 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 2299 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(push) #pragma warning(disable:6530) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snscanf_l(char const *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2326 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snscanf(char const *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2349 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snscanf_s_l(char const *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2374 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snscanf_s(char const *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2397 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(pop) __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_tempnam" ". See online help for details.")) char *__cdecl tempnam(char const *_Directory, char const *_FilePrefix);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fcloseall" ". See online help for details.")) int __cdecl fcloseall(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fdopen" ". See online help for details.")) FILE *__cdecl fdopen(int _FileHandle, char const *_Format);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fgetchar" ". See online help for details.")) int __cdecl fgetchar(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fileno" ". See online help for details.")) int __cdecl fileno(FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_flushall" ". See online help for details.")) int __cdecl flushall(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fputchar" ". See online help for details.")) int __cdecl fputchar(int _Ch);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_getw" ". See online help for details.")) int __cdecl getw(FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_putw" ". See online help for details.")) int __cdecl putw(int _Ch, FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_rmtmp" ". See online help for details.")) int __cdecl rmtmp(void);#line 2441 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h"__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma once#pragma once#pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) int *__cdecl _errno(void);errno_t __cdecl _set_errno(int _Value);errno_t __cdecl _get_errno(int *_Value);unsigned long *__cdecl __doserrno(void);errno_t __cdecl _set_doserrno(unsigned long _Value);errno_t __cdecl _get_doserrno(unsigned long *_Value);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4514 4820) __pragma(pack(push, 8)) void *__cdecl memchr(void const *_Buf, int _Val, size_t _MaxCount);int __cdecl memcmp(void const *_Buf1, void const *_Buf2, size_t _Size);void *__cdecl memcpy(void *_Dst, void const *_Src, size_t _Size);void *__cdecl memmove(void *_Dst, void const *_Src, size_t _Size);void *__cdecl memset(void *_Dst, int _Val, size_t _Size);char *__cdecl strchr(char const *_Str, int _Val);char *__cdecl strrchr(char const *_Str, int _Ch);char *__cdecl strstr(char const *_Str, char const *_SubStr);wchar_t *__cdecl wcschr(wchar_t const *_Str, wchar_t _Ch);wchar_t *__cdecl wcsrchr(wchar_t const *_Str, wchar_t _Ch);wchar_t *__cdecl wcsstr(wchar_t const *_Str, wchar_t const *_SubStr);__pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) static __inline errno_t __cdecl memcpy_s(void *const _Destination, rsize_t const _DestinationSize, void const *const _Source, rsize_t const _SourceSize) { if(_SourceSize==0) { return 0;} { int _Expr_val=!!(_Destination !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;if(_Source==((void *) 0)||_DestinationSize< _SourceSize) { memset(_Destination, 0, _DestinationSize);{ int _Expr_val=!!(_Source !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_DestinationSize >=_SourceSize);if(!(_Expr_val)) {(*_errno())=34;_invalid_parameter_noinfo();return 34;} } ;return 22 ;} memcpy(_Destination, _Source, _SourceSize);return 0;} static __inline errno_t __cdecl memmove_s(void *const _Destination, rsize_t const _DestinationSize, void const *const _Source, rsize_t const _SourceSize) { if(_SourceSize==0) { return 0;} { int _Expr_val=!!(_Destination !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_Source !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_DestinationSize >=_SourceSize);if(!(_Expr_val)) {(*_errno())=34;_invalid_parameter_noinfo();return 34;} } ;memmove(_Destination, _Source, _SourceSize);return 0;}#pragma warning(pop) __pragma(pack(pop))#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) int __cdecl _memicmp(void const *_Buf1, void const *_Buf2, size_t _Size);int __cdecl _memicmp_l(void const *_Buf1, void const *_Buf2, size_t _Size, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_memccpy" ". See online help for details.")) void *__cdecl memccpy(void *_Dst, void const *_Src, int _Val, size_t _Size);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_memicmp" ". See online help for details.")) int __cdecl memicmp(void const *_Buf1, void const *_Buf2, size_t _Size);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) errno_t __cdecl wcscat_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source);errno_t __cdecl wcscpy_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source);errno_t __cdecl wcsncat_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source, rsize_t _MaxCount);errno_t __cdecl wcsncpy_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source, rsize_t _MaxCount);wchar_t *__cdecl wcstok_s(wchar_t *_String, wchar_t const *_Delimiter, wchar_t **_Context);__declspec(allocator) wchar_t *__cdecl _wcsdup(wchar_t const *_String);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcscat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcscat(wchar_t *_Destination, wchar_t const *_Source);int __cdecl wcscmp(wchar_t const *_String1, wchar_t const *_String2);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcscpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcscpy(wchar_t *_Destination, wchar_t const *_Source);size_t __cdecl wcscspn(wchar_t const *_String, wchar_t const *_Control);size_t __cdecl wcslen(wchar_t const *_String);size_t __cdecl wcsnlen(wchar_t const *_Source, size_t _MaxCount);static __inline size_t __cdecl wcsnlen_s(wchar_t const *_Source, size_t _MaxCount) { return(_Source==0) ? 0 :wcsnlen(_Source, _MaxCount);}__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcsncat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcsncat(wchar_t *_Destination, wchar_t const *_Source, size_t _Count);int __cdecl wcsncmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcsncpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcsncpy(wchar_t *_Destination, wchar_t const *_Source, size_t _Count);wchar_t *__cdecl wcspbrk(wchar_t const *_String, wchar_t const *_Control);size_t __cdecl wcsspn(wchar_t const *_String, wchar_t const *_Control);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcstok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcstok(wchar_t *_String, wchar_t const *_Delimiter, wchar_t **_Context);#line 237 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstring.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcstok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) static __inline wchar_t *__cdecl _wcstok(wchar_t *const _String, wchar_t const *const _Delimiter) { return wcstok(_String, _Delimiter, 0);} __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcserror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcserror(int _ErrorNumber);errno_t __cdecl _wcserror_s(wchar_t *_Buffer, size_t _SizeInWords, int _ErrorNumber);__declspec(deprecated("This function or variable may be unsafe. Consider using " "__wcserror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl __wcserror(wchar_t const *_String);errno_t __cdecl __wcserror_s(wchar_t *_Buffer, size_t _SizeInWords, wchar_t const *_ErrorMessage);int __cdecl _wcsicmp(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcsicmp_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsnicmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsnicmp_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);errno_t __cdecl _wcsnset_s(wchar_t *_Destination, size_t _SizeInWords, wchar_t _Value, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsnset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsnset(wchar_t *_String, wchar_t _Value, size_t _MaxCount);wchar_t *__cdecl _wcsrev(wchar_t *_String);errno_t __cdecl _wcsset_s(wchar_t *_Destination, size_t _SizeInWords, wchar_t _Value);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsset(wchar_t *_String, wchar_t _Value);errno_t __cdecl _wcslwr_s(wchar_t *_String, size_t _SizeInWords);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcslwr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcslwr(wchar_t *_String);errno_t __cdecl _wcslwr_s_l(wchar_t *_String, size_t _SizeInWords, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcslwr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcslwr_l(wchar_t *_String, _locale_t _Locale);errno_t __cdecl _wcsupr_s(wchar_t *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsupr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsupr(wchar_t *_String);errno_t __cdecl _wcsupr_s_l(wchar_t *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsupr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsupr_l(wchar_t *_String, _locale_t _Locale);size_t __cdecl wcsxfrm(wchar_t *_Destination, wchar_t const *_Source, size_t _MaxCount);size_t __cdecl _wcsxfrm_l(wchar_t *_Destination, wchar_t const *_Source, size_t _MaxCount, _locale_t _Locale);int __cdecl wcscoll(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcscoll_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsicoll(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcsicoll_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsncoll(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsncoll_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _wcsnicoll(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsnicoll_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsdup" ". See online help for details.")) wchar_t *__cdecl wcsdup(wchar_t const *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsicmp" ". See online help for details.")) int __cdecl wcsicmp(wchar_t const *_String1, wchar_t const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsnicmp" ". See online help for details.")) int __cdecl wcsnicmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsnset" ". See online help for details.")) wchar_t *__cdecl wcsnset(wchar_t *_String, wchar_t _Value, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsrev" ". See online help for details.")) wchar_t *__cdecl wcsrev(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsset" ". See online help for details.")) wchar_t *__cdecl wcsset(wchar_t *_String, wchar_t _Value);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcslwr" ". See online help for details.")) wchar_t *__cdecl wcslwr(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsupr" ". See online help for details.")) wchar_t *__cdecl wcsupr(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsicoll" ". See online help for details.")) int __cdecl wcsicoll(wchar_t const *_String1, wchar_t const *_String2);__pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) errno_t __cdecl strcpy_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source);errno_t __cdecl strcat_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source);errno_t __cdecl strerror_s(char *_Buffer, size_t _SizeInBytes, int _ErrorNumber);errno_t __cdecl strncat_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source, rsize_t _MaxCount);errno_t __cdecl strncpy_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source, rsize_t _MaxCount);char *__cdecl strtok_s(char *_String, char const *_Delimiter, char **_Context);void *__cdecl _memccpy(void *_Dst, void const *_Src, int _Val, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strcat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strcat(char *_Destination, char const *_Source);int __cdecl strcmp(char const *_Str1, char const *_Str2);int __cdecl _strcmpi(char const *_String1, char const *_String2);int __cdecl strcoll(char const *_String1, char const *_String2);int __cdecl _strcoll_l(char const *_String1, char const *_String2, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strcpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strcpy(char *_Destination, char const *_Source);size_t __cdecl strcspn(char const *_Str, char const *_Control);__declspec(allocator) char *__cdecl _strdup(char const *_Source);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strerror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strerror(char const *_ErrorMessage);errno_t __cdecl _strerror_s(char *_Buffer, size_t _SizeInBytes, char const *_ErrorMessage);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strerror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strerror(int _ErrorMessage);int __cdecl _stricmp(char const *_String1, char const *_String2);int __cdecl _stricoll(char const *_String1, char const *_String2);int __cdecl _stricoll_l(char const *_String1, char const *_String2, _locale_t _Locale);int __cdecl _stricmp_l(char const *_String1, char const *_String2, _locale_t _Locale);size_t __cdecl strlen(char const *_Str);errno_t __cdecl _strlwr_s(char *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strlwr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strlwr(char *_String);errno_t __cdecl _strlwr_s_l(char *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strlwr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strlwr_l(char *_String, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strncat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strncat(char *_Destination, char const *_Source, size_t _Count);int __cdecl strncmp(char const *_Str1, char const *_Str2, size_t _MaxCount);int __cdecl _strnicmp(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strnicmp_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _strnicoll(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strnicoll_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _strncoll(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strncoll_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);size_t __cdecl __strncnt(char const *_String, size_t _Count);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strncpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strncpy(char *_Destination, char const *_Source, size_t _Count);size_t __cdecl strnlen(char const *_String, size_t _MaxCount);static __inline size_t __cdecl strnlen_s(char const *_String, size_t _MaxCount) { return _String==0 ? 0 :strnlen(_String, _MaxCount);} errno_t __cdecl _strnset_s(char *_String, size_t _SizeInBytes, int _Value, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strnset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strnset(char *_Destination, int _Value, size_t _Count);char *__cdecl strpbrk(char const *_Str, char const *_Control);char *__cdecl _strrev(char *_Str);errno_t __cdecl _strset_s(char *_Destination, size_t _DestinationSize, int _Value);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strset(char *_Destination, int _Value);size_t __cdecl strspn(char const *_Str, char const *_Control);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strtok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strtok(char *_String, char const *_Delimiter);errno_t __cdecl _strupr_s(char *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strupr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strupr(char *_String);errno_t __cdecl _strupr_s_l(char *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strupr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strupr_l(char *_String, _locale_t _Locale);size_t __cdecl strxfrm(char *_Destination, char const *_Source, size_t _MaxCount);size_t __cdecl _strxfrm_l(char *_Destination, char const *_Source, size_t _MaxCount, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strdup" ". See online help for details.")) char *__cdecl strdup(char const *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strcmpi" ". See online help for details.")) int __cdecl strcmpi(char const *_String1, char const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_stricmp" ". See online help for details.")) int __cdecl stricmp(char const *_String1, char const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strlwr" ". See online help for details.")) char *__cdecl strlwr(char *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strnicmp" ". See online help for details.")) int __cdecl strnicmp(char const *_String1, char const *_String2, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strnset" ". See online help for details.")) char *__cdecl strnset(char *_String, int _Value, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strrev" ". See online help for details.")) char *__cdecl strrev(char *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strset" ". See online help for details.")) char *__cdecl strset(char *_String, int _Value);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strupr" ". See online help for details.")) char *__cdecl strupr(char *_String);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4514 4820) __pragma(pack(push, 8)) __pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) typedef unsigned short _ino_t;typedef _ino_t ino_t;#line 24 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h" typedef unsigned int _dev_t;typedef _dev_t dev_t;#line 36 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h" typedef long _off_t;typedef _off_t off_t;#line 48 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h"#pragma warning(pop) typedef char *sds;#pragma pack(push, 1) struct sdshdr5 { unsigned char flags;char buf[];};struct sdshdr8 { uint8_t len;uint8_t alloc;unsigned char flags;char buf[];};struct sdshdr16 { uint16_t len;uint16_t alloc;unsigned char flags;char buf[];};struct sdshdr32 { uint32_t len;uint32_t alloc;unsigned char flags;char buf[];};struct sdshdr64 { uint64_t len;uint64_t alloc;unsigned char flags;char buf[];};#pragma pack(pop) static inline size_t sdslen(const sds s) { unsigned char flags=s[-1];switch(flags &7) { case 0 :return((flags) >> 3) ;case 1 :return((struct sdshdr8 *)((s) -(sizeof(struct sdshdr8)))) ->len;case 2 :return((struct sdshdr16 *)((s) -(sizeof(struct sdshdr16)))) ->len;case 3 :return((struct sdshdr32 *)((s) -(sizeof(struct sdshdr32)))) ->len;case 4 :return((struct sdshdr64 *)((s) -(sizeof(struct sdshdr64)))) ->len;} return 0;}static inline size_t sdsavail(const sds s) { unsigned char flags=s[-1];switch(flags &7) { case 0 :{ return 0;} case 1 :{ struct sdshdr8 *sh=(void *)((s) -(sizeof(struct sdshdr8)));;return sh->alloc - sh->len;} case 2 :{ struct sdshdr16 *sh=(void *)((s) -(sizeof(struct sdshdr16)));;return sh->alloc - sh->len;} case 3 :{ struct sdshdr32 *sh=(void *)((s) -(sizeof(struct sdshdr32)));;return sh->alloc - sh->len;} case 4 :{ struct sdshdr64 *sh=(void *)((s) -(sizeof(struct sdshdr64)));;return sh->alloc - sh->len;} } return 0;}static inline void sdssetlen(sds s, size_t newlen) { unsigned char flags=s[-1];switch(flags &7) { case 0 :{ unsigned char *fp=((unsigned char *) s) - 1;*fp=0|(newlen<< 3);} break;case 1 :((struct sdshdr8 *)((s) -(sizeof(struct sdshdr8)))) ->len=(uint8_t) newlen;break;case 2 :((struct sdshdr16 *)((s) -(sizeof(struct sdshdr16)))) ->len=(uint16_t) newlen;break;case 3 :((struct sdshdr32 *)((s) -(sizeof(struct sdshdr32)))) -> len
Definition: CPAL.d:15583
#define strdup
Definition: Utility.h:167
#define cur_pos
#define font
Definition: aptex-macros.h:175
#define width(a)
Definition: aptex-macros.h:198
#define type(a)
Definition: aptex-macros.h:171
#define head
Definition: aptex-macros.h:513
#define count(a)
Definition: aptex-macros.h:781
cairo_status_t _cairo_array_append_multiple(cairo_array_t *array, const void *elements, unsigned int num_elements)
Definition: cairo-array.c:281
void _cairo_array_fini(cairo_array_t *array)
Definition: cairo-array.c:75
cairo_status_t _cairo_array_grow_by(cairo_array_t *array, unsigned int additional)
Definition: cairo-array.c:89
cairo_status_t _cairo_array_allocate(cairo_array_t *array, unsigned int num_elements, void **elements)
Definition: cairo-array.c:311
unsigned int _cairo_array_num_elements(const cairo_array_t *array)
Definition: cairo-array.c:338
void * _cairo_array_index(cairo_array_t *array, unsigned int index)
Definition: cairo-array.c:166
void _cairo_array_truncate(cairo_array_t *array, unsigned int num_elements)
Definition: cairo-array.c:137
void _cairo_array_init(cairo_array_t *array, unsigned int element_size)
Definition: cairo-array.c:58
cairo_status_t _cairo_array_append(cairo_array_t *array, const void *element)
Definition: cairo-array.c:262
#define CAIRO_INT_STATUS_SUCCESS
cairo_bool_t _cairo_cff_scaled_font_is_cid_cff(cairo_scaled_font_t *scaled_font)
void _cairo_cff_fallback_fini(cairo_cff_subset_t *subset)
void _cairo_cff_subset_fini(cairo_cff_subset_t *subset)
struct _cff_header cff_header_t
struct _dict_write_info dict_write_info_t
cairo_status_t(* font_write_t)(cairo_cff_font_t *font)
cairo_status_t _cairo_cff_subset_init(cairo_cff_subset_t *cff_subset, const char *subset_name, cairo_scaled_font_subset_t *font_subset)
struct _cff_index_element cff_index_element_t
cairo_int_status_t(* font_read_t)(cairo_cff_font_t *font)
struct _cairo_cff_font cairo_cff_font_t
struct _cff_dict_operator cff_dict_operator_t
cairo_status_t _cairo_cff_fallback_init(cairo_cff_subset_t *cff_subset, const char *subset_name, cairo_scaled_font_subset_t *font_subset)
cairo_status_t _cairo_error(cairo_status_t status)
Definition: cairo-error.c:65
enum _cairo_int_status cairo_int_status_t
@ CAIRO_INT_STATUS_UNSUPPORTED
#define _cairo_status_is_error(status)
cairo_status_t _cairo_hash_table_insert(cairo_hash_table_t *hash_table, cairo_hash_entry_t *entry)
Definition: cairo-hash.c:455
void _cairo_hash_table_remove(cairo_hash_table_t *hash_table, cairo_hash_entry_t *key)
Definition: cairo-hash.c:520
void _cairo_hash_table_destroy(cairo_hash_table_t *hash_table)
Definition: cairo-hash.c:214
cairo_hash_table_t * _cairo_hash_table_create(cairo_hash_keys_equal_func_t keys_equal)
Definition: cairo-hash.c:163
void * _cairo_hash_table_lookup(cairo_hash_table_t *hash_table, cairo_hash_entry_t *key)
Definition: cairo-hash.c:338
void _cairo_hash_table_foreach(cairo_hash_table_t *hash_table, cairo_hash_callback_func_t hash_callback, void *closure)
Definition: cairo-hash.c:555
#define _cairo_malloc(size)
double _cairo_strtod(const char *nptr, char **endptr)
Definition: cairo-misc.c:830
cairo_int_status_t _cairo_escape_ps_name(char **ps_name)
cairo_int_status_t _cairo_truetype_read_font_name(cairo_scaled_font_t *scaled_font, char **ps_name, char **font_name)
cairo_status_t _cairo_type2_charstrings_init(cairo_type2_charstrings_t *charstrings, cairo_scaled_font_subset_t *font_subset)
void _cairo_type2_charstrings_fini(cairo_type2_charstrings_t *charstrings)
struct _tt_hhea tt_hhea_t
#define TT_TAG_hhea
#define TT_TAG_CFF
#define TT_TAG_hmtx
struct _tt_head tt_head_t
#define TT_TAG_head
int cairo_bool_t
Definition: cairo.h:107
@ CAIRO_STATUS_SUCCESS
Definition: cairo.h:315
@ CAIRO_STATUS_NO_MEMORY
Definition: cairo.h:317
enum _cairo_status cairo_status_t
static void put_unaligned_be32(uint32_t v, unsigned char *p)
Definition: cairoint.h:268
static uint16_t get_unaligned_be16(const unsigned char *p)
Definition: cairoint.h:252
static uint16_t cpu_to_be16(uint16_t v)
Definition: cairoint.h:224
static uint16_t be16_to_cpu(uint16_t v)
Definition: cairoint.h:230
static double _cairo_round(double r)
Definition: cairoint.h:757
#define ARRAY_LENGTH(__array)
Definition: cairoint.h:137
static cairo_status_t cairo_cff_font_subset_font(cairo_cff_font_t *font)
static const int winansi_to_cff_std_string[]
static cairo_status_t cff_index_write(cairo_array_t *index, cairo_array_t *output)
static unsigned char * cff_dict_get_operands(cairo_hash_table_t *dict, unsigned short operator, int *size)
static void _cairo_dict_init_key(cff_dict_operator_t *key, int operator)
#define WEIGHT_OP
#define CHARSTRINGS_OP
#define TYPE2_hstem
#define TYPE2_callsubr
static unsigned char * decode_real(unsigned char *p, double *real)
#define TYPE2_hmoveto
static int operand_length(unsigned char *p)
static cairo_int_status_t cairo_cff_font_generate(cairo_cff_font_t *font, const char **data, unsigned long *length)
static void _cairo_dict_collect(void *entry, void *closure)
static cairo_int_status_t cairo_cff_font_read_strings(cairo_cff_font_t *font)
static void cairo_dict_write_operator(cff_dict_operator_t *op, dict_write_info_t *write_info)
static void cff_dict_fini(cairo_hash_table_t *dict)
static cairo_status_t cairo_cff_font_write_header(cairo_cff_font_t *font)
static cairo_status_t cairo_cff_font_subset_dict_strings(cairo_cff_font_t *font, cairo_hash_table_t *dict)
static cairo_status_t cairo_cff_font_subset_strings(cairo_cff_font_t *font)
static cairo_status_t cairo_cff_font_write_fdselect(cairo_cff_font_t *font)
static void cff_index_fini(cairo_array_t *index)
static cairo_status_t cairo_cff_font_write_name(cairo_cff_font_t *font)
static unsigned char * decode_integer(unsigned char *p, int *integer)
static cairo_status_t cff_index_append(cairo_array_t *index, unsigned char *object, int length)
#define TYPE2_hintmask
static cairo_status_t cff_dict_create_operator(int operator, unsigned char *operand, int size, cff_dict_operator_t **out)
static cairo_int_status_t cairo_cff_font_read_global_subroutines(cairo_cff_font_t *font)
static cairo_status_t cairo_cff_font_write_encoding(cairo_cff_font_t *font)
static cairo_int_status_t _cairo_cff_font_create(cairo_scaled_font_subset_t *scaled_font_subset, cairo_cff_font_t **font_return, const char *subset_name)
static cairo_int_status_t cairo_cff_font_get_gid_for_cid(cairo_cff_font_t *font, unsigned long cid, unsigned long *gid)
static cairo_int_status_t cairo_cff_font_read_name(cairo_cff_font_t *font)
static void cff_index_init(cairo_array_t *index)
static void cff_index_set_object(cairo_array_t *index, int obj_index, unsigned char *object, int length)
static cairo_status_t cairo_cff_font_write_cid_private_dict_and_local_sub(cairo_cff_font_t *font)
static int cairo_cff_font_get_sid_for_winansi_char(cairo_cff_font_t *font, int ch)
#define VERSION_OP
static cairo_int_status_t cairo_cff_font_subset_charstrings_and_subroutines(cairo_cff_font_t *font)
#define TYPE2_vstem
static void cairo_cff_font_set_topdict_operator_to_cur_pos(cairo_cff_font_t *font, int operator)
static cairo_int_status_t cairo_cff_font_read_header(cairo_cff_font_t *font)
static cairo_int_status_t cairo_cff_font_read_fdselect(cairo_cff_font_t *font, unsigned char *p)
static unsigned long decode_index_offset(unsigned char *p, int off_size)
static char * decode_nibble(int n, char *buf)
static cairo_int_status_t _cairo_cff_font_load_cff(cairo_cff_font_t *font)
static cairo_int_status_t _cairo_cff_font_load_opentype_cff(cairo_cff_font_t *font)
static unsigned char * decode_number(unsigned char *p, double *number)
static cairo_int_status_t cairo_cff_font_create_set_widths(cairo_cff_font_t *font)
static cairo_status_t cairo_cff_font_create_cid_fontdict(cairo_cff_font_t *font)
static const font_write_t font_write_type1_funcs[]
#define BASEFONTNAME_OP
static void _cff_dict_entry_pluck(void *_entry, void *dict)
static cairo_status_t cairo_cff_font_set_ros_strings(cairo_cff_font_t *font)
static cairo_int_status_t cairo_cff_font_read_top_dict(cairo_cff_font_t *font)
#define FULLNAME_OP
static cairo_status_t cairo_cff_font_write_type1_private_dict_and_local_sub(cairo_cff_font_t *font)
#define ROS_OP
static cairo_int_status_t _cairo_cff_font_fallback_create(cairo_scaled_font_subset_t *scaled_font_subset, cairo_cff_font_t **font_return, const char *subset_name)
static cairo_status_t cairo_cff_font_write_top_dict(cairo_cff_font_t *font)
#define TYPE2_rmoveto
#define CHARSET_OP
static unsigned char * type2_decode_integer(unsigned char *p, int *integer)
#define TYPE2_vstemhm
#define FONTMATRIX_OP
#define TYPE2_vmoveto
#define TYPE2_cntrmask
static cairo_bool_t check_fontdata_is_cff(const unsigned char *data, long length)
static cairo_status_t cairo_cff_font_write_charstrings(cairo_cff_font_t *font)
#define FDARRAY_OP
static void cff_dict_remove(cairo_hash_table_t *dict, unsigned short operator)
static cairo_status_t cairo_cff_font_write_cid_charset(cairo_cff_font_t *font)
static cairo_int_status_t cairo_cff_font_read_cid_fontdict(cairo_cff_font_t *font, unsigned char *ptr)
#define COPYRIGHT_OP
static cairo_status_t cairo_cff_parse_charstring(cairo_cff_font_t *font, unsigned char *charstring, int length, int glyph_id, cairo_bool_t need_width)
#define FAMILYNAME_OP
static cairo_status_t cairo_cff_find_width_and_subroutines_used(cairo_cff_font_t *font, unsigned char *charstring, int length, int glyph_id, int subset_id)
static cairo_int_status_t cairo_cff_font_fallback_generate(cairo_cff_font_t *font, cairo_type2_charstrings_t *type2_subset, const char **data, unsigned long *length)
static cairo_status_t cairo_cff_font_subset_dict_string(cairo_cff_font_t *font, cairo_hash_table_t *dict, int operator)
static cairo_int_status_t cairo_cff_font_read_font(cairo_cff_font_t *font)
static unsigned char * encode_index_offset(unsigned char *p, int offset_size, unsigned long offset)
#define TYPE2_endchar
static cairo_status_t cff_dict_init(cairo_hash_table_t **dict)
static cairo_status_t cairo_cff_font_subset_fontdict(cairo_cff_font_t *font)
static unsigned char * encode_integer_max(unsigned char *p, int i)
static cairo_status_t cairo_cff_font_write_local_sub(cairo_cff_font_t *font, int dict_num, cairo_hash_table_t *private_dict, cairo_array_t *local_sub_index, cairo_bool_t *local_subs_used)
static unsigned char * decode_operator(unsigned char *p, unsigned short *operator)
#define FONTBBOX_OP
static cairo_bool_t _cairo_cff_dict_equal(const void *key_a, const void *key_b)
static const int dict_strings[]
static cairo_status_t cff_dict_write(cairo_hash_table_t *dict, cairo_array_t *output)
static cairo_status_t cff_dict_set_operands(cairo_hash_table_t *dict, unsigned short operator, unsigned char *operand, int size)
#define CIDCOUNT_OP
static cairo_status_t cairo_cff_font_write_private_dict(cairo_cff_font_t *font, int dict_num, cairo_hash_table_t *parent_dict, cairo_hash_table_t *private_dict)
static const font_read_t font_read_funcs[]
static cairo_status_t cairo_cff_font_write_cid_fontdict(cairo_cff_font_t *font)
static cairo_status_t cairo_cff_font_write_strings(cairo_cff_font_t *font)
#define UNIQUEID_OP
static unsigned char * encode_integer(unsigned char *p, int i)
static cairo_status_t cff_index_append_copy(cairo_array_t *index, const unsigned char *object, unsigned int length)
#define PRIVATE_OP
static cairo_int_status_t cairo_cff_font_read_private_dict(cairo_cff_font_t *font, cairo_hash_table_t *private_dict, cairo_array_t *local_sub_index, int *local_sub_bias, cairo_bool_t **local_subs_used, double *default_width, double *nominal_width, unsigned char *ptr, int size)
static cairo_status_t cairo_cff_font_write_subset(cairo_cff_font_t *font)
#define ENCODING_OP
#define NUM_STD_STRINGS
static cairo_status_t cairo_cff_font_write_type1_charset(cairo_cff_font_t *font)
#define TYPE2_callgsubr
#define FONTNAME_OP
#define TYPE2_hstemhm
#define NOMINALWIDTH_OP
static cairo_status_t cff_dict_read(cairo_hash_table_t *dict, unsigned char *p, int dict_size)
#define LOCAL_SUB_OP
#define MAX_SUBROUTINE_NESTING
static int cff_dict_get_location(cairo_hash_table_t *dict, unsigned short operator, int *size)
#define NOTICE_OP
#define XUID_OP
#define TYPE2_return
#define POSTSCRIPT_OP
#define FDSELECT_OP
#define DEFAULTWIDTH_OP
static void cairo_cff_font_read_font_metrics(cairo_cff_font_t *font, cairo_hash_table_t *top_dict)
static cairo_status_t cairo_cff_font_write_global_subrs(cairo_cff_font_t *font)
static void cairo_cff_font_destroy(cairo_cff_font_t *font)
static cairo_int_status_t cff_index_read(cairo_array_t *index, unsigned char **ptr, unsigned char *end_ptr)
static cairo_status_t cairo_cff_font_add_euro_charset_string(cairo_cff_font_t *font)
static const font_write_t font_write_cid_funcs[]
#define n
Definition: t4ht.c:1290
@ FALSE
Definition: dd.h:101
@ TRUE
Definition: dd.h:102
#define free(a)
Definition: decNumber.cpp:310
double real
Definition: dvips.h:66
static int xx[600]
Definition: psspecial.c:35
static int yy[600]
Definition: psspecial.c:35
struct rect data
Definition: dvipdfm.c:64
int x_max
int y_min
int y_max
int x_min
FcElement element
Definition: fcxml.c:418
static FIELD_PTR begin
Definition: genind.c:37
#define c(n)
Definition: gpos-common.c:150
byte * data_end
Definition: gsftopk.c:484
#define memcpy(d, s, n)
Definition: gsftopk.c:64
FILE * out
Definition: hbf2gf.c:286
#define byte
Definition: in_pcx.cpp:28
assert(pcxLoadImage24((char *)((void *) 0), fp, pinfo, hdr))
#define unlikely(x)
Definition: jbig2arith.cc:116
void * object
Definition: jmemsys.h:48
#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
sizeof(AF_ModuleRec)
FT_UInt sid
Definition: cffcmap.c:138
const char const char ** ordering
Definition: cffdrivr.c:697
unsigned short uint16_t
Definition: stdint.h:79
unsigned char uint8_t
Definition: stdint.h:78
voidp calloc()
#define buf
pdf_obj * entry
Definition: pdfdoc.c:64
char * closure
Definition: font.h:85
#define fabs(x)
Definition: cpascal.h:211
#define output
Definition: cpascal.h:54
#define floor(x)
Definition: cpascal.h:52
#define length(c)
Definition: ctangleboot.c:65
union hdr header
Definition: pbmtomacp.c:291
#define snprintf
Definition: snprintf.c:41
static int format
Definition: pbmclean.c:15
int integer
Definition: pbmtopk.c:38
unsigned short word
Definition: picttoppm.c:64
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
#define index(s, c)
Definition: plain2.h:351
static int32_t last
Definition: ppagelist.c:29
static int32_t first
Definition: ppagelist.c:29
static int size
Definition: ppmlabel.c:24
int g
Definition: ppmqvga.c:68
static int offset
Definition: ppmtogif.c:642
#define status
#define glyph_index()
static backend_t backend[]
Definition: main.c:103
#define registry(L)
Definition: minilua.c:416
#define uint32_t
Definition: stdint.in.h:168
#define int16_t
Definition: stdint.in.h:160
unsigned char * data
cairo_hash_table_t ** fd_dict