commit e0350ca3bb91fb9ff9a91e048ab68ce059cd7f66 from: Sven M. Hallberg date: Fri Aug 12 16:19:32 2022 UTC use -X for text extraction including font diagnostics This removes the original use of outfn2/stream2 (corresponding to Xfile in main, i.e. the argument to -X) and reuses it for being verbose about fonts. This leaves -x as showing only the text and fixes our tests. It looks to me like the original outfn2 path is a less refined version of the outfn version, though it could be the other way around. Sumit told me that one of the two could go away at some point. Unfortunately, I cannot find the original message. We can readjust this as needed. commit - 684a3c707589742d0776267e54d2bde5015cb62c commit + e0350ca3bb91fb9ff9a91e048ab68ce059cd7f66 blob - 07edfd51ed5a272b0951e621c72f98eb4a5fd7ff blob + df1ba9ef34971e75abc9f44ab9410f97200c1ea8 --- pdf.c +++ pdf.c @@ -2174,9 +2174,6 @@ text_extract(struct Env *aux, const char *outfn, const curr = aux->txthead; for (int i = 0; i < aux->ntextobjs; i++) { - if (outfn2) - fwrite((const void *)curr->tstr->text, (int) curr->tstr->nchars, 1, stream2); - tt_text = curr->tstr->tobj; for (int j = 0; j < tt_text->seq->used; j++) { struct textstr *tstr = NULL; @@ -2196,14 +2193,16 @@ text_extract(struct Env *aux, const char *outfn, const } assert(tstr != NULL); - if (outfn) { + if (outfn2) { Fontinfo_T *ft = lookup_font(&txte->node->ts, aux); if (ft) - pp_fontinfo(stream, &txte->node->ts, ft); + pp_fontinfo(stream2, &txte->node->ts, ft); else - fputs("\nMissing Font Info!!\n", stream); - fwrite(tstr->text, 1, (size_t)tstr->nchars, stream); + fputs("\nMissing Font Info!!\n", stream2); + fwrite(tstr->text, 1, (size_t)tstr->nchars, stream2); } + if (outfn) + fwrite(tstr->text, 1, (size_t)tstr->nchars, stream); } curr = curr->next;