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)  

otfinfo.cc
Go to the documentation of this file.
1 /* otfinfo.cc -- driver for reporting information about OpenType fonts
2  *
3  * Copyright (c) 2003-2019 Eddie Kohler
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the Free
7  * Software Foundation; either version 2 of the License, or (at your option)
8  * any later version. This program is distributed in the hope that it will be
9  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11  * Public License for more details.
12  */
13 
14 #ifdef HAVE_CONFIG_H
15 # include <config.h>
16 #endif
17 #include <efont/psres.hh>
18 #include <efont/otfcmap.hh>
19 #include <efont/otfgsub.hh>
20 #include <efont/otfgpos.hh>
21 #include <efont/otfname.hh>
22 #include <efont/otfos2.hh>
23 #include <efont/otfpost.hh>
24 #include <efont/cff.hh>
25 #include <lcdf/clp.h>
26 #include <lcdf/error.hh>
27 #include <lcdf/straccum.hh>
28 #include <stdlib.h>
29 #include <string.h>
30 #include <stdio.h>
31 #include <stdarg.h>
32 #include <ctype.h>
33 #include <errno.h>
34 #include <algorithm>
35 #include <utility>
36 #ifdef HAVE_UNISTD_H
37 # include <unistd.h>
38 #endif
39 #if defined(_MSDOS) || defined(_WIN32)
40 # include <fcntl.h>
41 # include <io.h>
42 #endif
43 
44 using namespace Efont;
45 
46 #define VERSION_OPT 301
47 #define HELP_OPT 302
48 #define QUIET_OPT 303
49 #define VERBOSE_OPT 304
50 #define SCRIPT_OPT 305
51 
52 #define QUERY_SCRIPTS_OPT 320
53 #define QUERY_FEATURES_OPT 321
54 #define QUERY_OPTICAL_SIZE_OPT 322
55 #define QUERY_POSTSCRIPT_NAME_OPT 323
56 #define QUERY_GLYPHS_OPT 324
57 #define QUERY_FVERSION_OPT 325
58 #define TABLES_OPT 326
59 #define QUERY_FAMILY_OPT 327
60 #define INFO_OPT 328
61 #define DUMP_TABLE_OPT 329
62 #define QUERY_UNICODE_OPT 330
63 
64 const Clp_Option options[] = {
65  { "script", 0, SCRIPT_OPT, Clp_ValString, 0 },
66  { "quiet", 'q', QUIET_OPT, 0, Clp_Negate },
67  { "verbose", 'V', VERBOSE_OPT, 0, Clp_Negate },
68  { "features", 'f', QUERY_FEATURES_OPT, 0, 0 },
69  { "scripts", 's', QUERY_SCRIPTS_OPT, 0, 0 },
70  { "size", 0, QUERY_OPTICAL_SIZE_OPT, 0, 0 },
71  { "optical-size", 'z', QUERY_OPTICAL_SIZE_OPT, 0, 0 },
72  { "postscript-name", 'p', QUERY_POSTSCRIPT_NAME_OPT, 0, 0 },
73  { "family", 'a', QUERY_FAMILY_OPT, 0, 0 },
74  { "font-version", 'v', QUERY_FVERSION_OPT, 0, 0 },
75  { "info", 'i', INFO_OPT, 0, 0 },
76  { "glyphs", 'g', QUERY_GLYPHS_OPT, 0, 0 },
77  { "tables", 't', TABLES_OPT, 0, 0 },
78  { "dump-table", 'T', DUMP_TABLE_OPT, Clp_ValString, 0 },
79  { "unicode", 'u', QUERY_UNICODE_OPT, 0, 0 },
80  { "help", 'h', HELP_OPT, 0, 0 },
81  { "version", 0, VERSION_OPT, 0, 0 },
82 };
83 
84 
85 static const char *program_name;
86 
88 
89 bool verbose = false;
90 bool quiet = false;
91 
92 
93 void
95 {
96  va_list val;
98  if (!error_message)
99  errh->message("Usage: %s [OPTION]... FONT", program_name);
100  else
102  errh->message("Type %s --help for more information.", program_name);
103  exit(1);
104 }
105 
106 void
108 {
109  FileErrorHandler uerrh(stdout);
110  uerrh.message("\
111 %<Otfinfo%> reports information about an OpenType font to standard output.\n\
112 Options specify what information to print.\n\
113 \n\
114 Usage: %s [-sfzpg | OPTIONS] [OTFFILES...]\n\n",
115  program_name);
116  uerrh.message("\
117 Query options:\n\
118  -s, --scripts Report font%,s supported scripts.\n\
119  -f, --features Report font%,s GSUB/GPOS features.\n\
120  -z, --optical-size Report font%,s optical size information.\n\
121  -p, --postscript-name Report font%,s PostScript name.\n\
122  -a, --family Report font%,s family name.\n\
123  -v, --font-version Report font%,s version information.\n\
124  -i, --info Report font%,s names and designer/vendor info.\n\
125  -g, --glyphs Report font%,s glyph names.\n\
126  -t, --tables Report font%,s OpenType tables.\n\
127  -T, --dump-table NAME Output font%,s %<NAME%> table.\n\
128 \n\
129 Other options:\n\
130  --script=SCRIPT[.LANG] Set script used for --features [latn].\n\
131  -V, --verbose Print progress information to standard error.\n\
132  -h, --help Print this message and exit.\n\
133  -q, --quiet Do not generate any error messages.\n\
134  --version Print version number and exit.\n\
135 \n\
136 Report bugs to <ekohler@gmail.com>.\n");
137 }
138 
139 String
141 {
142  FILE *f;
143  int f_errno = 0;
144  if (!filename || filename == "-") {
145  filename = "<stdin>";
146  f = stdin;
147 #if defined(_MSDOS) || defined(_WIN32)
148  // Set the file mode to binary
149  _setmode(_fileno(f), _O_BINARY);
150 #endif
151  } else {
152  f = fopen(filename.c_str(), "rb");
153  f_errno = errno;
154  }
155 
157  if (!f) {
158  errh->xmessage(error_anno, strerror(f_errno));
159  return String();
160  }
161 
162  StringAccum sa;
163  int amt;
164  do {
165  if (char *x = sa.reserve(8192)) {
166  amt = fread(x, 1, 8192, f);
167  sa.adjust_length(amt);
168  } else
169  amt = 0;
170  } while (amt != 0);
171  if (!feof(f) || ferror(f))
172  errh->xmessage(error_anno, strerror(errno));
173  if (f != stdin)
174  fclose(f);
175  return sa.take_string();
176 }
177 
178 String
180 {
181  if (!s || s == "-")
182  return String::make_stable("<stdin>");
183  else
184  return s;
185 }
186 
187 static void
189 {
191  script_list.language_systems(script, langsys, errh);
192  for (int i = 0; i < script.size(); i++) {
193  String what = script[i].text();
194  const char *s = script[i].script_description();
195  String where = (s ? s : "<unknown script>");
196  if (!langsys[i].null()) {
197  what += String(".") + langsys[i].text();
198  s = langsys[i].language_description();
199  where += String("/") + (s ? s : "<unknown language>");
200  }
201  if (what.length() < 8)
202  output.push_back(what + String("\t\t") + where);
203  else
204  output.push_back(what + String("\t") + where);
205  }
206 }
207 
208 static void
210 {
212  if (String gsub_table = otf.table("GSUB")) {
213  OpenType::Gsub gsub(gsub_table, &otf, errh);
215  }
216  if (String gpos_table = otf.table("GPOS")) {
217  OpenType::Gpos gpos(gpos_table, errh);
219  }
220 
221  if (results.size()) {
222  std::sort(results.begin(), results.end());
223  String *unique_result = std::unique(results.begin(), results.end());
224  for (String *sp = results.begin(); sp < unique_result; sp++)
225  result_errh->message("%s", sp->c_str());
226  }
227 }
228 
229 static void
231 {
232  int required_fid;
233  Vector<int> fids;
234  // collect features applying to this script
235  script_list.features(script, langsys, required_fid, fids, errh);
236  for (int i = -1; i < fids.size(); i++) {
237  int fid = (i < 0 ? required_fid : fids[i]);
238  if (fid >= 0) {
239  OpenType::Tag tag = feature_list.tag(fid);
240  const char *s = tag.feature_description();
241  output.push_back(tag.text() + String("\t") + (s ? s : "<unknown feature>"));
242  }
243  }
244 }
245 
246 static void
248 {
250  if (String gsub_table = otf.table("GSUB")) {
251  OpenType::Gsub gsub(gsub_table, &otf, errh);
253  }
254  if (String gpos_table = otf.table("GPOS")) {
255  OpenType::Gpos gpos(gpos_table, errh);
257  }
258 
259  if (results.size()) {
260  std::sort(results.begin(), results.end());
261  String *unique_result = std::unique(results.begin(), results.end());
262  for (String *sp = results.begin(); sp < unique_result; sp++)
263  result_errh->message("%s", sp->c_str());
264  }
265 }
266 
267 static bool
269 {
270  int before_nerrors = errh->nerrors();
271  try {
272  String gpos_table = otf.table("GPOS");
273  if (!gpos_table)
274  return false;
275 
276  OpenType::Gpos gpos(gpos_table, errh);
277  OpenType::Name name(otf.table("name"), errh);
278 
279  // extract 'size' feature
280  int required_fid;
281  Vector<int> fids;
282  gpos.script_list().features(script, langsys, required_fid, fids, errh);
283 
284  int size_fid = gpos.feature_list().find(OpenType::Tag("size"), fids);
285  if (size_fid < 0)
286  return false;
287 
288  // old Adobe fonts implement an old, incorrect idea
289  // of what the FeatureParams offset means.
290  OpenType::Data size_data = gpos.feature_list().size_params(size_fid, name, errh);
291  if (!size_data.length())
292  return false;
293 
294  StringAccum sa;
295  sa << "design size " << (size_data.u16(0) / 10.) << " pt";
296  if (size_data.u16(2) != 0) {
297  sa << ", size range (" << (size_data.u16(6) / 10.) << " pt, "
298  << (size_data.u16(8) / 10.) << " pt], "
299  << "subfamily ID " << size_data.u16(2);
300  if (String n = name.english_name(size_data.u16(4)))
301  sa << ", subfamily name " << n;
302  }
303 
304  result_errh->message("%s", sa.c_str());
305  return true;
306 
307  } catch (OpenType::Error) {
308  return errh->nerrors() != before_nerrors;
309  }
310 }
311 
312 static void
314 {
315  int before_nerrors = errh->nerrors();
316  try {
317  if (do_query_optical_size_size(otf, errh, result_errh))
318  return;
319 
320  String os2_table = otf.table("OS/2");
321  if (!os2_table)
322  throw OpenType::Error();
323 
324  OpenType::Os2 os2(os2_table, errh);
325  if (!os2.ok() || !os2.has_optical_point_size())
326  throw OpenType::Error();
327 
328  StringAccum sa;
329  sa << "size range [" << os2.lower_optical_point_size() << ", " << os2.upper_optical_point_size() << ")";
330  result_errh->message("%s", sa.c_str());
331 
332  } catch (OpenType::Error) {
333  if (errh->nerrors() == before_nerrors)
334  result_errh->message("no optical size information");
335  }
336 }
337 
338 static void
340 {
341  int before_nerrors = errh->nerrors();
342  String family_name = "no family name information";
343 
344  if (String name_table = otf.table("name")) {
346  if (name.ok())
347  family_name = name.english_name(OpenType::Name::N_FAMILY);
348  }
349 
350  if (errh->nerrors() == before_nerrors)
351  result_errh->message("%s", family_name.c_str());
352 }
353 
354 static void
356 {
357  int before_nerrors = errh->nerrors();
358  String postscript_name = "no PostScript name information";
359 
360  if (String name_table = otf.table("name")) {
362  if (name.ok())
363  postscript_name = name.english_name(OpenType::Name::N_POSTSCRIPT);
364  }
365 
366  if (errh->nerrors() == before_nerrors)
367  result_errh->message("%s", postscript_name.c_str());
368 }
369 
370 static void
372 {
373  int before_nerrors = errh->nerrors();
374  String version = "no version information";
375 
376  if (String name_table = otf.table("name")) {
378  if (name.ok())
379  version = name.english_name(OpenType::Name::N_VERSION);
380  }
381 
382  if (errh->nerrors() == before_nerrors)
383  result_errh->message("%s", version.c_str());
384 }
385 
386 static void
388 {
389  int before_nerrors = errh->nerrors();
390  StringAccum sa;
391 
392  if (String name_table = otf.table("name")) {
394  if (name.ok()) {
395  if (String s = name.english_name(OpenType::Name::N_FAMILY))
396  sa << "Family: " << s << "\n";
397  if (String s = name.english_name(OpenType::Name::N_SUBFAMILY))
398  sa << "Subfamily: " << s << "\n";
399  if (String s = name.english_name(OpenType::Name::N_FULLNAME))
400  sa << "Full name: " << s << "\n";
401  if (String s = name.english_name(OpenType::Name::N_POSTSCRIPT))
402  sa << "PostScript name: " << s << "\n";
403  if (String s = name.english_name(OpenType::Name::N_POSTSCRIPT_CID))
404  sa << "PostScript CID name: " << s << "\n";
405  if (String s = name.english_name(OpenType::Name::N_PREF_FAMILY))
406  sa << "Preferred family: " << s << "\n";
407  if (String s = name.english_name(OpenType::Name::N_PREF_SUBFAMILY))
408  sa << "Preferred subfamily: " << s << "\n";
409  if (String s = name.english_name(OpenType::Name::N_MAC_COMPAT_FULLNAME))
410  sa << "Mac font menu name: " << s << "\n";
411  if (String s = name.english_name(OpenType::Name::N_VERSION))
412  sa << "Version: " << s << "\n";
413  if (String s = name.english_name(OpenType::Name::N_UNIQUEID))
414  sa << "Unique ID: " << s << "\n";
415  if (String s = name.english_name(OpenType::Name::N_DESCRIPTION))
416  sa << "Description: " << s << "\n";
417  if (String s = name.english_name(OpenType::Name::N_DESIGNER))
418  sa << "Designer: " << s << "\n";
419  if (String s = name.english_name(OpenType::Name::N_DESIGNER_URL))
420  sa << "Designer URL: " << s << "\n";
421  if (String s = name.english_name(OpenType::Name::N_MANUFACTURER))
422  sa << "Manufacturer: " << s << "\n";
423  if (String s = name.english_name(OpenType::Name::N_VENDOR_URL))
424  sa << "Vendor URL: " << s << "\n";
425  if (String s = name.english_name(OpenType::Name::N_TRADEMARK))
426  sa << "Trademark: " << s << "\n";
427  if (String s = name.english_name(OpenType::Name::N_COPYRIGHT))
428  sa << "Copyright: " << s << "\n";
429  if (String s = name.english_name(OpenType::Name::N_LICENSE_URL))
430  sa << "License URL: " << s << "\n";
431  if (String s = name.english_name(OpenType::Name::N_LICENSE_DESCRIPTION))
432  sa << "License Description: " << s << "\n";
433  if (String s = name.english_name(OpenType::Name::N_SAMPLE_TEXT))
434  sa << "Sample text: " << s << "\n";
435  }
436  }
437 
438  if (String os2_table = otf.table("OS/2")) {
439  OpenType::Os2 os2(os2_table, errh);
440  if (os2.ok()) {
441  if (String s = os2.vendor_id()) {
442  while (s.length() && (s.back() == ' ' || s.back() == 0))
443  s = s.substring(s.begin(), s.end() - 1);
444  if (s)
445  sa << "Vendor ID: " << s << "\n";
446  }
447  }
448  }
449 
450  if (sa || errh->nerrors() == before_nerrors)
451  result_errh->message("%s", (sa ? sa.c_str() : "no information"));
452 }
453 
454 static void
456 {
457  try {
458  // get font
459  Cff cff(otf.table("CFF"), otf.units_per_em(), errh);
460  if (!cff.ok())
461  return;
462 
463  Cff::FontParent *fp = cff.font(PermString(), errh);
464  if (!fp || !fp->ok())
465  return;
466  Cff::Font *font = dynamic_cast<Cff::Font *>(fp);
467  if (!font) {
468  errh->error("CID-keyed fonts not supported");
469  return;
470  }
471 
472  // save glyph names
473  font->glyph_names(glyph_names);
474  } catch (OpenType::Error) {
475  }
476 }
477 
478 static void
480 {
481  try {
482  // get font
483  OpenType::Post post(otf.table("post"), errh);
484  if (!post.ok())
485  return;
486 
487  // save glyph names
488  post.glyph_names(glyph_names);
489  } catch (OpenType::Error) {
490  }
491 }
492 
493 static void
495 {
496  int before_nerrors = errh->nerrors();
497  Vector<PermString> glyph_names;
498  if (otf.table("CFF"))
499  do_query_glyphs_cff(otf, errh, glyph_names);
500  else if (otf.table("post"))
501  do_query_glyphs_post(otf, errh, glyph_names);
502  for (PermString* s = glyph_names.begin(); s != glyph_names.end(); ++s)
503  result_errh->message("%s", s->c_str());
504  if (glyph_names.empty() && errh->nerrors() == before_nerrors)
505  errh->message("no glyph name information");
506 }
507 
508 static void
510 {
511  Vector<PermString> glyph_names;
512  if (otf.table("CFF"))
513  do_query_glyphs_cff(otf, errh, glyph_names);
514  else if (otf.table("post"))
515  do_query_glyphs_post(otf, errh, glyph_names);
516 
517  try {
518  OpenType::Cmap cmap(otf.table("cmap"), errh);
519  if (!cmap.ok())
520  throw OpenType::Error();
521 
523  cmap.unmap_all(u2g);
524  std::sort(u2g.begin(), u2g.end());
525  for (std::pair<uint32_t, int>* it = u2g.begin(); it != u2g.end(); ++it) {
526  char name[10];
527  if (it->first < 0x10000)
528  sprintf(name, "uni%04X", it->first);
529  else
530  sprintf(name, "u%X", it->first);
531  if (it->second < glyph_names.size())
532  result_errh->message("%s %d %s\n", name, it->second, glyph_names[it->second].c_str());
533  else
534  result_errh->message("%s %d\n", name, it->second);
535  }
536  } catch (OpenType::Error) {
537  }
538 }
539 
540 static void
542 {
543  int before_nerrors = errh->nerrors();
544  try {
545  int n = otf.ntables();
546 
547  for (int i = 0; i < n; i++)
548  if (OpenType::Tag tag = otf.table_tag(i)) {
549  String s = otf.table(tag);
550  result_errh->message("%7u %s\n", s.length(), tag.text().c_str());
551  }
552  } catch (OpenType::Error) {
553  if (errh->nerrors() == before_nerrors)
554  result_errh->message("corrupted tables");
555  }
556 }
557 
558 static void
560 {
561  int before_nerrors = errh->nerrors();
562  try {
563  if (otf.has_table(tag)) {
564  String s = otf.table(tag);
565  int written = fwrite(s.data(), 1, s.length(), stdout);
566  if (written != s.length())
567  errh->error("%s", strerror(errno));
568  } else
569  errh->message("no %<%s%> table", tag.text().c_str());
570  } catch (OpenType::Error) {
571  if (errh->nerrors() == before_nerrors)
572  errh->message("corrupted tables");
573  }
574 }
575 
576 int
577 main(int argc, char *argv[])
578 {
579  Clp_Parser *clp =
580  Clp_NewParser(argc, (const char * const *)argv, sizeof(options) / sizeof(options[0]), options);
582 
584  Vector<const char *> input_files;
585  OpenType::Tag dump_table;
586  int query = 0;
587 
588  while (1) {
589  int opt = Clp_Next(clp);
590  switch (opt) {
591 
592  case SCRIPT_OPT: {
593  if (!script.null())
594  usage_error(errh, "--script already specified");
595  String arg = clp->vstr;
596  int period = arg.find_left('.');
597  OpenType::Tag scr(period <= 0 ? arg : arg.substring(0, period));
598  if (scr.valid() && period > 0) {
599  OpenType::Tag lang(arg.substring(period + 1));
600  if (lang.valid()) {
601  script = scr;
602  langsys = lang;
603  } else
604  usage_error(errh, "bad language tag");
605  } else if (scr.valid())
606  script = scr;
607  else
608  usage_error(errh, "bad script tag");
609  break;
610  }
611 
612  case QUERY_SCRIPTS_OPT:
613  case QUERY_FEATURES_OPT:
616  case QUERY_GLYPHS_OPT:
617  case QUERY_FAMILY_OPT:
618  case QUERY_FVERSION_OPT:
619  case QUERY_UNICODE_OPT:
620  case TABLES_OPT:
621  case INFO_OPT:
622  if (query)
623  usage_error(errh, "supply exactly one query type option");
624  query = opt;
625  break;
626 
627  case DUMP_TABLE_OPT:
628  if (query)
629  usage_error(errh, "supply exactly one query type option");
630  if (!(dump_table = OpenType::Tag(clp->vstr)))
631  usage_error(errh, "bad table name");
632  query = opt;
633  break;
634 
635  case QUIET_OPT:
636  if (clp->negated)
638  else
639  errh = new SilentErrorHandler;
640  break;
641 
642  case VERBOSE_OPT:
643  verbose = !clp->negated;
644  break;
645 
646  case VERSION_OPT:
647  printf("otfinfo (LCDF typetools) %s\n", VERSION);
648  printf("Copyright (C) 2003-2019 Eddie Kohler\n\
649 This is free software; see the source for copying conditions.\n\
650 There is NO warranty, not even for merchantability or fitness for a\n\
651 particular purpose.\n");
652  exit(0);
653  break;
654 
655  case HELP_OPT:
656  usage();
657  exit(0);
658  break;
659 
660  case Clp_NotOption:
661  input_files.push_back(clp->vstr);
662  break;
663 
664  case Clp_Done:
665  goto done;
666 
667  case Clp_BadOption:
668  usage_error(errh, 0);
669  break;
670 
671  default:
672  break;
673 
674  }
675  }
676 
677  done:
678  if (!query)
679  usage_error(errh, "supply exactly one query option");
680  if (!input_files.size())
681  input_files.push_back("-");
682  if (script.null())
683  script = Efont::OpenType::Tag("latn");
684 
685  FileErrorHandler stdout_errh(stdout);
686  for (const char **input_filep = input_files.begin(); input_filep != input_files.end(); input_filep++) {
687  int before_nerrors = errh->nerrors();
688  String font_data = read_file(*input_filep, errh);
689  if (errh->nerrors() != before_nerrors)
690  continue;
691 
692  String input_file = printable_filename(*input_filep);
694  OpenType::Font otf(font_data, &cerrh);
695  if (!otf.ok())
696  continue;
697 
698  PrefixErrorHandler stdout_cerrh(&stdout_errh, input_file + ":");
699  ErrorHandler *result_errh = (input_files.size() > 1 ? static_cast<ErrorHandler *>(&stdout_cerrh) : static_cast<ErrorHandler *>(&stdout_errh));
700  if (query == QUERY_SCRIPTS_OPT)
701  do_query_scripts(otf, &cerrh, result_errh);
702  else if (query == QUERY_FEATURES_OPT)
703  do_query_features(otf, &cerrh, result_errh);
704  else if (query == QUERY_OPTICAL_SIZE_OPT)
705  do_query_optical_size(otf, &cerrh, result_errh);
706  else if (query == QUERY_POSTSCRIPT_NAME_OPT)
707  do_query_postscript_name(otf, &cerrh, result_errh);
708  else if (query == QUERY_GLYPHS_OPT)
709  do_query_glyphs(otf, &cerrh, result_errh);
710  else if (query == QUERY_UNICODE_OPT)
711  do_query_unicode(otf, &cerrh, result_errh);
712  else if (query == QUERY_FAMILY_OPT)
713  do_query_family_name(otf, &cerrh, result_errh);
714  else if (query == QUERY_FVERSION_OPT)
715  do_query_font_version(otf, &cerrh, result_errh);
716  else if (query == TABLES_OPT)
717  do_tables(otf, &cerrh, result_errh);
718  else if (query == DUMP_TABLE_OPT)
719  do_dump_table(otf, dump_table, &cerrh);
720  else if (query == INFO_OPT)
721  do_info(otf, &cerrh, result_errh);
722  }
723 
724  Clp_DeleteParser(clp);
725  return (errh->nerrors() == 0 ? 0 : 1);
726 }
#define name
static uint16_t u16(const unsigned char *s)
Definition: otfdata.hh:116
int length() const
Definition: otfdata.hh:73
String size_params(int fid, const Name &name, ErrorHandler *=0) const
Definition: otf.cc:573
Tag tag(int fid) const
Definition: otf.cc:533
int find(Tag, const Vector< int > &fids) const
Definition: otf.cc:611
Tag table_tag(int i) const
Definition: otf.cc:154
int ntables() const
Definition: otf.cc:112
unsigned units_per_em() const
Definition: otf.hh:62
String table(Tag tag) const
Definition: otf.cc:121
bool has_table(Tag tag) const
Definition: otf.cc:133
bool ok() const
Definition: otf.hh:54
const ScriptList & script_list() const
Definition: otfgpos.hh:15
const FeatureList & feature_list() const
Definition: otfgpos.hh:16
const FeatureList & feature_list() const
Definition: otfgsub.hh:16
const ScriptList & script_list() const
Definition: otfgsub.hh:15
int language_systems(Vector< Tag > &scripts, Vector< Tag > &langsys, ErrorHandler *=0) const
Definition: otf.cc:448
int features(Tag script, Tag langsys, int &required_fid, Vector< int > &fids, ErrorHandler *=0, bool clear_fids=true) const
Definition: otf.cc:474
String text() const
Definition: otf.cc:315
bool null() const
Definition: otf.hh:24
bool valid() const
Definition: otf.cc:305
const char * script_description() const
Definition: otfdescrip.cc:700
Error reporting class.
Definition: error.hh:86
static const char e_warning[]
Definition: error.hh:116
int error(const char *fmt,...)
Print an error message (level el_error).
Definition: error.cc:818
int nerrors() const
Return the number of errors reported via this handler.
Definition: error.hh:282
int xmessage(const String &str)
Print an annotated error message.
Definition: error.cc:891
static const char e_error[]
Definition: error.hh:115
static ErrorHandler * static_initialize(ErrorHandler *errh)
Initialize the ErrorHandler implementation.
Definition: error.cc:1019
static String make_landmark_anno(const String &x)
Return a landmark annotation equal to x.
Definition: error.hh:535
void message(const char *fmt,...)
Print an informational message (level el_info).
Definition: error.cc:799
static ErrorHandler * default_handler()
Return the default ErrorHandler.
Definition: error.hh:155
An ErrorHandler that prints error messages to a given file.
Definition: error.hh:640
A stackable ErrorHandler that adds a default landmark to error messages.
Definition: error.hh:830
A stackable ErrorHandler that adds a prefix to error messages.
Definition: error.hh:799
An ErrorHandler that does not report messages.
Definition: error.hh:592
Efficiently build up Strings from pieces.
Definition: straccum.hh:21
void adjust_length(int delta)
Adjust the StringAccum's length.
Definition: straccum.hh:416
String take_string()
Return a String object with this StringAccum's contents.
Definition: straccum.cc:197
const char * c_str()
Null-terminate this StringAccum and return its data.
Definition: straccum.cc:122
char * reserve(int n)
Reserve space for at least n characters.
Definition: straccum.hh:391
Definition: vector.hh:17
iterator begin()
Definition: vector.hh:48
void push_back(const T &x)
Definition: vector.hh:102
size_type size() const
Definition: vector.hh:54
bool empty() const
Definition: vector.hh:57
iterator end()
Definition: vector.hh:50
#define n
Definition: t4ht.c:1290
#define fopen
Definition: xxstdio.h:21
#define fread
Definition: xxstdio.h:25
int printf()
Flexible error handling classes.
const FcChar8 lang[6]
Definition: fcfreetype.c:56
TT_OS2 * os2
Definition: ftlib.c:50
mpz_t * f
Definition: gen-fib.c:34
#define s
Definition: afcover.h:80
@ VERSION
Definition: genrb.cpp:69
char String
Definition: tttypes.h:35
small capitals from c petite p scientific i
Definition: afcover.h:80
CFF_Font cff
Definition: cffdrivr.c:701
void exit()
T1_FIELD_DICT_FONTDICT family_name
Definition: t1tokens.h:30
int errno
void warning(char msg[])
Definition: utils.c:72
#define fclose
Definition: debug.h:100
#define Error
Definition: type1.c:126
static char * strerror(int errnum)
Definition: error.c:56
#define error_message
Definition: ctangleboot.c:74
Code related to b fwrite(a, sizeof(char), b, stdout) @d C_printf(c
#define post
Definition: tie.c:144
#define sprintf
Definition: snprintf.c:44
Clp_Parser * Clp_NewParser(int argc, const char *const *argv, int nopt, const Clp_Option *opt)
Create a new Clp_Parser.
Definition: clp.c:502
int Clp_Next(Clp_Parser *clp)
Parse and return the next argument from clp.
Definition: clp.c:1850
void Clp_DeleteParser(Clp_Parser *clp)
Destroy a Clp_Parser object.
Definition: clp.c:578
const char * Clp_ProgramName(Clp_Parser *clp)
Return clp's program name.
Definition: clp.c:1420
#define Clp_Negate
Option flag: option may be negated.
Definition: clp.h:139
#define Clp_BadOption
Clp_Next value: argument was an erroneous option.
Definition: clp.h:197
#define Clp_NotOption
Clp_Next value: argument was not an option.
Definition: clp.h:191
#define Clp_ValString
Option value is an arbitrary string.
Definition: clp.h:59
#define Clp_Done
Clp_Next value: there are no more arguments.
Definition: clp.h:194
#define _O_BINARY
Definition: lfs.c:127
hb_tag_t Tag
Definition: luaharfbuzz.h:17
float x
Definition: cordic.py:15
#define version
Definition: nup.c:10
#define QUERY_OPTICAL_SIZE_OPT
Definition: otfinfo.cc:54
#define HELP_OPT
Definition: otfinfo.cc:47
#define QUERY_FVERSION_OPT
Definition: otfinfo.cc:57
int main(int argc, char *argv[])
Definition: otfinfo.cc:577
static void do_query_features(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
Definition: otfinfo.cc:247
#define QUERY_UNICODE_OPT
Definition: otfinfo.cc:62
static void do_query_glyphs_cff(const OpenType::Font &otf, ErrorHandler *errh, Vector< PermString > &glyph_names)
Definition: otfinfo.cc:455
void usage()
Definition: otfinfo.cc:107
#define QUERY_FAMILY_OPT
Definition: otfinfo.cc:59
#define QUIET_OPT
Definition: otfinfo.cc:48
#define QUERY_FEATURES_OPT
Definition: otfinfo.cc:53
#define TABLES_OPT
Definition: otfinfo.cc:58
static void do_info(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
Definition: otfinfo.cc:387
#define VERBOSE_OPT
Definition: otfinfo.cc:49
String read_file(String filename, ErrorHandler *errh, bool warning=false)
Definition: otfinfo.cc:140
static void do_query_glyphs(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
Definition: otfinfo.cc:494
#define QUERY_SCRIPTS_OPT
Definition: otfinfo.cc:52
String printable_filename(const String &s)
Definition: otfinfo.cc:179
static bool do_query_optical_size_size(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
Definition: otfinfo.cc:268
static Efont::OpenType::Tag script
Definition: otfinfo.cc:87
static void collect_feature_descriptions(const OpenType::ScriptList &script_list, const OpenType::FeatureList &feature_list, Vector< String > &output, ErrorHandler *errh)
Definition: otfinfo.cc:230
static Efont::OpenType::Tag langsys
Definition: otfinfo.cc:87
static void do_query_postscript_name(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
Definition: otfinfo.cc:355
#define SCRIPT_OPT
Definition: otfinfo.cc:50
static void do_query_font_version(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
Definition: otfinfo.cc:371
static void do_query_unicode(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
Definition: otfinfo.cc:509
#define QUERY_GLYPHS_OPT
Definition: otfinfo.cc:56
static void do_tables(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
Definition: otfinfo.cc:541
#define DUMP_TABLE_OPT
Definition: otfinfo.cc:61
#define VERSION_OPT
Definition: otfinfo.cc:46
bool verbose
Definition: otfinfo.cc:89
#define INFO_OPT
Definition: otfinfo.cc:60
static void collect_script_descriptions(const OpenType::ScriptList &script_list, Vector< String > &output, ErrorHandler *errh)
Definition: otfinfo.cc:188
static void do_query_family_name(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
Definition: otfinfo.cc:339
#define QUERY_POSTSCRIPT_NAME_OPT
Definition: otfinfo.cc:55
static void do_query_scripts(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
Definition: otfinfo.cc:209
static void do_query_glyphs_post(const OpenType::Font &otf, ErrorHandler *errh, Vector< PermString > &glyph_names)
Definition: otfinfo.cc:479
bool quiet
Definition: otfinfo.cc:90
static const char * program_name
Definition: otfinfo.cc:85
static void do_dump_table(const OpenType::Font &otf, OpenType::Tag tag, ErrorHandler *errh)
Definition: otfinfo.cc:559
static void do_query_optical_size(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
Definition: otfinfo.cc:313
void usage_error(ErrorHandler *errh, const char *error_message,...)
Definition: otfinfo.cc:94
char * filename[256]
Definition: pbmtopk.c:46
void results()
#define fp
static ErrorHandler * errh
Definition: main.cc:71
static int sort(lua_State *L)
Definition: ltablib.c:411
Click's StringAccum class, used to construct Strings efficiently from pieces.
Option description.
Definition: clp.h:41
Command line parser.
Definition: clp.h:234
int negated
Definition: clp.h:237
const char * vstr
Definition: clp.h:240
A string of characters.
Definition: t1part.c:49
const char * c_str() const
Null-terminate the string.
Definition: string.hh:256
String substring(const char *begin, const char *end) const
Return a substring of the current string starting at begin and ending before end.
Definition: string.hh:371
static String make_stable(const char *s, int len=-1)
Return a String that directly references the first len characters of s.
Definition: string.cc:263
int find_left(char c, int start=0) const
Search for a character in a string.
Definition: string.cc:495
Definition: pbmfont.h:11
Definition: ttf.h:443
Definition: output.h:18
Definition: ttf.h:449
Definition: xmlparse.c:179
Definition: strexpr.c:21
#define FILE
Definition: t1stdio.h:34
#define feof(f)
Definition: t1stdio.h:109
#define ferror(f)
Definition: t1stdio.h:110
val
Definition: tex4ht.c:3227
#define sp
Definition: stack.c:11
TT_CharMap cmap
Definition: ttf2pfb.c:163
static TTF_NAME * name_table
Definition: ttf.c:71
#define va_start(pvar)
Definition: varargs.h:30
char * va_list
Definition: varargs.h:22
#define argv
Definition: xmain.c:270
#define argc
Definition: xmain.c:269