From 2d95403284aae8e96998c49268305f77535be160 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 13 Dec 2006 07:10:47 +0000 Subject: adjusted the print margin for page number. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1421 ee746299-78ed-0310-b773-934348b2243d --- src/printing.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/printing.c') diff --git a/src/printing.c b/src/printing.c index 595d8244..49dfc497 100644 --- a/src/printing.c +++ b/src/printing.c @@ -149,7 +149,6 @@ static gint layout_set_headers(PangoLayout *layout, MsgPrintInfo *mpinfo, desc = pango_font_description_from_string(prefs_common_get()->textfont); size = pango_font_description_get_size(desc); - g_print("size = %d (%g)\n", size, (gdouble)size / PANGO_SCALE); pango_font_description_free(desc); desc = gtkut_get_default_font_desc(); pango_font_description_set_size(desc, size); @@ -207,9 +206,9 @@ static gint message_count_page(MsgPrintInfo *mpinfo, GtkPrintContext *context, pango_layout_get_size(layout, NULL, &layout_h); line_h = (gdouble)layout_h / PANGO_SCALE + SPACING; print_data->line_h = line_h; - lines_per_page = height / line_h; + lines_per_page = (height - line_h) / line_h; print_data->lines_per_page = lines_per_page; - body_h = height - hdr_h; + body_h = height - hdr_h - line_h; if (body_h < 0) body_h = 0.0; lines_left = body_h / line_h; @@ -314,6 +313,7 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context, gdouble width, height; gint layout_h; PangoFontDescription *desc; + gint font_size; gchar buf[BUFFSIZE]; gint count = 0; @@ -358,6 +358,7 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context, pango_layout_set_attributes(layout, NULL); desc = pango_font_description_from_string(prefs_common_get()->textfont); + font_size = pango_font_description_get_size(desc); pango_layout_set_font_description(layout, desc); pango_font_description_free(desc); @@ -406,12 +407,13 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context, g_print("count = %d\n", count); desc = gtkut_get_default_font_desc(); + pango_font_description_set_size(desc, font_size); pango_layout_set_font_description(layout, desc); pango_font_description_free(desc); g_snprintf(buf, sizeof(buf), "- %d -", pinfo->page_nr_per_msg + 1); pango_layout_set_text(layout, buf, -1); pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER); - cairo_move_to(cr, 0, height); + cairo_move_to(cr, 0, height - (gdouble)font_size / PANGO_SCALE); pango_cairo_show_layout(cr, layout); g_object_unref(layout); -- cgit v1.2.3