Support the \W{...}\i\c{...} combination used in the NASM manual.
[sgt/halibut] / bk_paper.c
index 1a948a7..2e05028 100644 (file)
  *     * we need to parse the font to extract its metrics
  *     * then we pass the font bodily to both PS and PDF so it can
  *      be included in the output file
+ * 
+ *  - character substitution for better typography?
+ *     * fi, fl, ffi, ffl ligatures
+ *     * use real ellipsis rather than ...
+ *     * a hyphen in a word by itself might prefer to be an en-dash
+ *     * (Americans might even want a convenient way to use an
+ *      em-dash)
+ *     * DON'T DO ANY OF THE ABOVE WITHIN \c OR \cw!
+ *     * substituting `minus' for `hyphen' in the standard encoding
+ *      is probably preferable in Courier, though certainly not in
+ *      the main text font
+ *     * if I do do this lot, I'm rather inclined to at least try
+ *      to think up a configurable way to do it so that Americans
+ *      can do em-dash tricks without my intervention and other
+ *      people can do other odd things too.
  */
 
 #include <assert.h>
@@ -552,6 +567,9 @@ void *paper_pre_backend(paragraph *sourceform, keywordlist *keywords,
            paper_idx *pi = (paper_idx *)entry->backend_data;
            para_data *text, *pages;
 
+           if (!pi->words)
+               continue;
+
            text = make_para_data(para_Normal, 0, 0,
                                  conf->base_width - conf->index_colwidth,
                                  NULL, NULL, entry->text, conf);
@@ -1581,8 +1599,10 @@ static int render_string(page_data *page, font_data *font, int fontsize,
     while (*str) {
        glyph = font->bmp[*str];
 
-       if (glyph == 0xFFFF)
+       if (glyph == 0xFFFF) {
+           str++;
            continue;                  /* nothing more we can do here */
+       }
 
        /*
         * Find which subfont this character is going in.
@@ -1723,7 +1743,10 @@ static int render_text(page_data *page, para_data *pdata, line_data *ldata,
             * referenced by an index entry.
             */
          case word_IndexRef:
-           {
+           /*
+            * We don't create index references in contents entries.
+            */
+           if (!pdata->contents_entry) {
                indextag *tag;
                int i;