- default:
- if (removeattr(wd->type) == word_Normal)
- printf("%ls", wd->text);
- else if (removeattr(wd->type) == word_WhiteSpace)
- printf(" ");
- else if (removeattr(wd->type) == word_Quote)
- printf(wd->aux == quote_Open ? "`" : "'");
- break;
- }
-#endif
- if (removeattr(wd->type) == word_WhiteSpace)
- spaces++;
- if (wd == ldata->last)
- break;
- wd = wd->next;
- }
-
- if (spaces) {
- ldata->space_adjust = (wid - len) / spaces;
- /*
- * This tells us how much the space width needs to
- * change from _min_spacewidth. But we want to store
- * its difference from the _natural_ space width, to
- * make the text rendering easier.
- */
- ldata->space_adjust += ctx.minspacewidth;
- ldata->space_adjust -= spacewidth;
- /*
- * Special case: on the last line of a paragraph, we
- * never stretch spaces.
- */
- if (ldata->space_adjust > 0 && !p->next)
- ldata->space_adjust = 0;
- } else {
- ldata->space_adjust = 0;
- }
+ ldata->hshortfall = wid - len;
+ ldata->nspaces = spaces;
+ /*
+ * This tells us how much the space width needs to
+ * change from _min_spacewidth. But we want to store
+ * its difference from the _natural_ space width, to
+ * make the text rendering easier.
+ */
+ ldata->hshortfall += ctx.minspacewidth * spaces;
+ ldata->hshortfall -= spacewidth * spaces;
+ /*
+ * Special case: on the last line of a paragraph, we
+ * never stretch spaces.
+ */
+ if (ldata->hshortfall > 0 && !p->next)
+ ldata->hshortfall = 0;