Commit ed3e5b279bb7e61423c481ed5d3b878190e5a822
1 parent
0bd2c878
Exists in
master
and in
5 other branches
Incluindo ajuste automatico de fonte
Showing
1 changed file
with
11 additions
and
13 deletions
Show diff stats
src/pw3270/print.c
@@ -42,20 +42,16 @@ | @@ -42,20 +42,16 @@ | ||
42 | PW3270_SRC src; | 42 | PW3270_SRC src; |
43 | 43 | ||
44 | H3270 * session; | 44 | H3270 * session; |
45 | -/* | ||
46 | - gchar * font; | ||
47 | - guint fontsize; | ||
48 | - cairo_font_weight_t fontweight; | ||
49 | -*/ | 45 | + |
50 | int baddr; | 46 | int baddr; |
51 | int rows; | 47 | int rows; |
52 | - int cols; | 48 | + int cols; /**< Max line width */ |
53 | int pages; | 49 | int pages; |
54 | - int lpp; /**< Lines per page */ | 50 | + int lpp; /**< Lines per page */ |
55 | cairo_font_extents_t extents; | 51 | cairo_font_extents_t extents; |
56 | double left; | 52 | double left; |
57 | - double width; /**< Report width */ | ||
58 | - double height; /**< Report height (all pages) */ | 53 | + double width; /**< Report width */ |
54 | + double height; /**< Report height (all pages) */ | ||
59 | cairo_scaled_font_t * font_scaled; | 55 | cairo_scaled_font_t * font_scaled; |
60 | 56 | ||
61 | gchar **text; | 57 | gchar **text; |
@@ -94,7 +90,7 @@ | @@ -94,7 +90,7 @@ | ||
94 | 90 | ||
95 | // Setup font | 91 | // Setup font |
96 | 92 | ||
97 | - if(font) | 93 | + if(*font) |
98 | { | 94 | { |
99 | PangoFontDescription * descr = pango_font_description_from_string(font); | 95 | PangoFontDescription * descr = pango_font_description_from_string(font); |
100 | if(descr) | 96 | if(descr) |
@@ -103,12 +99,12 @@ | @@ -103,12 +99,12 @@ | ||
103 | CAIRO_FONT_SLANT_NORMAL, | 99 | CAIRO_FONT_SLANT_NORMAL, |
104 | pango_font_description_get_weight(descr) == PANGO_WEIGHT_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL); | 100 | pango_font_description_get_weight(descr) == PANGO_WEIGHT_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL); |
105 | 101 | ||
106 | - cairo_set_font_size(cr,gtk_print_context_get_width(context)/80); | 102 | + cairo_set_font_size(cr,gtk_print_context_get_width(context)/info->cols); |
107 | 103 | ||
108 | pango_font_description_free(descr); | 104 | pango_font_description_free(descr); |
109 | } | 105 | } |
110 | - g_free(font); | ||
111 | } | 106 | } |
107 | + g_free(font); | ||
112 | 108 | ||
113 | info->font_scaled = cairo_get_scaled_font(cr); | 109 | info->font_scaled = cairo_get_scaled_font(cr); |
114 | cairo_scaled_font_reference(info->font_scaled); | 110 | cairo_scaled_font_reference(info->font_scaled); |
@@ -449,7 +445,8 @@ static gchar * enum_to_string(GType type, guint enum_value) | @@ -449,7 +445,8 @@ static gchar * enum_to_string(GType type, guint enum_value) | ||
449 | GtkPageSetup * setup = gtk_page_setup_new(); | 445 | GtkPageSetup * setup = gtk_page_setup_new(); |
450 | 446 | ||
451 | *info = g_new0(PRINT_INFO,1); | 447 | *info = g_new0(PRINT_INFO,1); |
452 | - (*info)->session = v3270_get_session(widget); | 448 | + (*info)->session = v3270_get_session(widget); |
449 | + (*info)->cols = 80; | ||
453 | 450 | ||
454 | // Basic setup | 451 | // Basic setup |
455 | gtk_print_operation_set_allow_async(print,TRUE); | 452 | gtk_print_operation_set_allow_async(print,TRUE); |
@@ -671,6 +668,7 @@ static gchar * enum_to_string(GType type, guint enum_value) | @@ -671,6 +668,7 @@ static gchar * enum_to_string(GType type, guint enum_value) | ||
671 | lib3270_get_screen_size(info->session,&info->rows,&info->cols); | 668 | lib3270_get_screen_size(info->session,&info->rows,&info->cols); |
672 | 669 | ||
673 | info->src = src; | 670 | info->src = src; |
671 | + | ||
674 | g_signal_connect(print,"begin_print",G_CALLBACK(begin_print),info); | 672 | g_signal_connect(print,"begin_print",G_CALLBACK(begin_print),info); |
675 | g_signal_connect(print,"draw_page",G_CALLBACK(draw_screen),info); | 673 | g_signal_connect(print,"draw_page",G_CALLBACK(draw_screen),info); |
676 | 674 |