diff options
author | Thomas White <taw@bitwiz.org.uk> | 2013-08-12 23:38:11 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2013-08-13 00:06:45 +0200 |
commit | 1ebc8e62eb33a95ac258ca4cfab0151157bc7d28 (patch) | |
tree | a77e85ce676b2ff2d8c7b6a88ad84d675bbe3e79 /src/render.c | |
parent | 069b007faae7bbc7bfecc5c5232cc54ef52fafbb (diff) |
Fix draw_outline()
Diffstat (limited to 'src/render.c')
-rw-r--r-- | src/render.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/render.c b/src/render.c index d00357a..ede41b5 100644 --- a/src/render.c +++ b/src/render.c @@ -97,9 +97,15 @@ static void render_image_box(cairo_t *cr, struct wrap_box *box, ImageStore *is, static void draw_outline(cairo_t *cr, struct wrap_box *box) { char tmp[32]; + double asc, desc; - cairo_rectangle(cr, 0.0, 0.0, pango_units_to_double(box->width), - pango_units_to_double(box->height)); + if ( box->type == WRAP_BOX_SENTINEL ) return; + + asc = pango_units_to_double(box->ascent); + desc = pango_units_to_double(box->height) - asc; + + cairo_rectangle(cr, 0.0, -asc, pango_units_to_double(box->width), + asc + desc); cairo_set_source_rgb(cr, 1.0, 0.0, 0.0); cairo_set_line_width(cr, 0.1); cairo_stroke(cr); @@ -108,7 +114,7 @@ static void draw_outline(cairo_t *cr, struct wrap_box *box) cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size(cr, 10.0); - cairo_move_to(cr, 0.0, 0.0); + cairo_move_to(cr, 0.0, desc); cairo_set_source_rgb(cr, 0.0, 0.0, 0.7); cairo_show_text(cr, tmp); } |