return (u < 0 || u > 0xFFFF ? NOGLYPH : fi->bmp[u]);
}
+void listfonts(void) {
+ font_info const *fi;
+
+ init_std_fonts();
+ for (fi = all_fonts; fi; fi = fi->next)
+ printf("%s\n", fi->name);
+}
+
static font_data *make_std_font(font_list *fontlist, char const *name)
{
font_info const *fi;
\IM{-C} \c{-C} command-line option
\IM{--input-charset} \c{--input-charset} command-line option
\IM{--list-charsets} \c{--list-charsets} command-line option
+\IM{--list-fonts} \c{--list-fonts} command-line option
\IM{--help} \c{--help} command-line option
\IM{--version} \c{--version} command-line option
\IM{--licence} \c{--licence} command-line option
\dd Makes Halibut list character sets known to it.
+\dt \cw{--list-fonts}
+
+\dd Makes Halibut list fonts known to it, either intrinsically or
+by being passed as input files.
+
\dt \cw{--precise}
\dd Makes Halibut report the column number as well as the line
various kinds of text. Directives for setting the font normally take
three font names, the first of which is used for normal text, the
second for emphasised text, and the third for code. Any fonts which
-aren't specified are left unchanged. Fonts are named using their
-PostScript names.
+aren't specified are left unchanged.
Halibut intrinsically knows about some fonts, and these fonts are also
-built into all PDF and most PostScript implementations. These are:
-
-\b \cw{Times-Roman}
-
-\b \cw{Times-Italic}
-
-\b \cw{Times-Bold}
-
-\b \cw{Times-BoldItalic}
-
-\b \cw{Helvetica}
-
-\b \cw{Helvetica-Oblique}
-
-\b \cw{Helvetica-Bold}
-
-\b \cw{Helvetica-BoldOblique}
-
-\b \cw{Courier}
-
-\b \cw{Courier-Oblique}
-
-\b \cw{Courier-Bold}
-
-\b \cw{Courier-BoldOblique}
-
+built into all PDF and most PostScript implementations.
These fonts can be used without further formality. To use any other
font, Halibut needs at least to know its measurements, which are
provided in an \i{Adobe Font Metrics} (\I{AFM files}AFM) file.
line. If a PFA or PFB file is specified, the corresponding AFM file
must come first.
+Fonts are specified using their PostScript names. Running Halibut with
+the \i\cw{\-\-list-fonts} option causes it to display the PostScript
+names of all the fonts it intrinsically knows about, along with any
+fonts the were supplied as input files.
+
\ii{Font sizes} are specified in PostScript \i{points} (72 to the inch).
\dt \I{\cw{\\cfg\{paper-title-fonts\}}}\cw{\\cfg\{paper-title-fonts\}\{}\e{normal-font}\cw{\}}[\cw{\{}\e{emph-font}\cw{\}}[\cw{\{}\e{code-font}\cw{\}}]]
\dd List character sets known to Halibut.
+\dt \i\cw{--list-fonts}
+
+\dd List fonts known to Halibut, both those it intrinsically knows about
+and those found in its input files.
+
\dt \i\cw{--help}
\dd Print a brief help message and exit immediately. (Don't confuse
* bk_paper.c
*/
void *paper_pre_backend(paragraph *, keywordlist *, indexdata *);
+void listfonts(void);
/*
* bk_ps.c
" -Cfoo:bar:baz append \\cfg{foo}{bar}{baz} to input",
" --input-charset=cs change default input file charset",
" --list-charsets display supported character set names",
+ " --list-fonts display supported font names",
" --precise report column numbers in error messages",
" --help display this text",
" --version display version number",
{ "StartFontMetrics", 16, &read_afm_file },
{ "\x00\x01\x00\x00", 4, &read_sfnt_file },
{ "true", 4, &read_sfnt_file },
+ { "OTTO", 4, &read_sfnt_file },
};
paragraph *read_input(input *in, indexdata *idx) {
int nogo;
int errs;
int reportcols;
+ int list_fonts;
int input_charset;
int debug;
int backendbits, prebackbits;
nfiles = 0;
nogo = errs = FALSE;
reportcols = 0;
+ list_fonts = 0;
input_charset = CS_ASCII;
debug = 0;
backendbits = 0;
} else if (!strcmp(opt, "-list-charsets")) {
listcharsets();
nogo = TRUE;
+ } else if (!strcmp(opt, "-list-fonts")) {
+ list_fonts = TRUE;
} else if (!strcmp(opt, "-precise")) {
reportcols = 1;
} else {
/*
* Do the work.
*/
- if (nfiles == 0) {
+ if (nfiles == 0 && !list_fonts) {
error(err_noinput);
usage();
exit(EXIT_FAILURE);
idx = make_index();
sourceform = read_input(&in, idx);
+ if (list_fonts) {
+ listfonts();
+ exit(EXIT_SUCCESS);
+ }
if (!sourceform)
exit(EXIT_FAILURE);