Support the \W{...}\i\c{...} combination used in the NASM manual.
[sgt/halibut] / bk_paper.c
index e6e17f7..2e05028 100644 (file)
 /*
  * TODO in future work:
  * 
- *  - the index should not refer to the contents, if an indexable
- *    term crops up in a section title!
- * 
- *  - include the version IDs.
- * 
  *  - linearised PDF, perhaps?
  * 
  *  - compression of output files. For the actual text display,
@@ -75,6 +70,7 @@
  *     * 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
@@ -571,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);
@@ -1600,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.
@@ -1742,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;