diff options
-rw-r--r-- | src/frame.h | 3 | ||||
-rw-r--r-- | src/render.c | 9 | ||||
-rw-r--r-- | src/wrap.c | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/frame.h b/src/frame.h index 1535761..2645060 100644 --- a/src/frame.h +++ b/src/frame.h @@ -106,6 +106,9 @@ struct frame /* True if the aspect ratio of this frame should be maintained */ int is_image; + + /* True if wrapping failed for this box */ + int trouble; }; diff --git a/src/render.c b/src/render.c index 594bed0..d0a3696 100644 --- a/src/render.c +++ b/src/render.c @@ -309,6 +309,15 @@ static int render_sc(cairo_t *cr, struct frame *fr, ImageStore *is, return 1; } + if ( fr->trouble ) { + cairo_new_path(cr); + cairo_rectangle(cr, 0.0, 0.0, fr->w, fr->h); + cairo_set_source_rgb(cr, 1.0, 0.0, 0.0); + cairo_set_line_width(cr, 2.0); + cairo_stroke(cr); + printf("SC: '%s'\n", fr->sc); + } + /* Actually render the lines */ cairo_translate(cr, fr->lop.pad_l, fr->lop.pad_t); render_lines(fr, cr, is, isz); @@ -1033,6 +1033,7 @@ static void knuth_suboptimal_fit(struct wrap_line *boxes, double line_length, if ( boxes->boxes[j].width > line_length ) { fprintf(stderr, "ERROR: Box %i too long (%i %f)\n", j, boxes->boxes[j].width, line_length); + fr->trouble = 1; reject = 1; } } @@ -1284,6 +1285,7 @@ int wrap_contents(struct frame *fr, PangoContext *pc, fr->n_lines = 0; fr->max_lines = 32; fr->lines = NULL; + fr->trouble = 0; alloc_lines(fr); /* Split text into paragraphs */ |