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 | 42 | PW3270_SRC src; |
43 | 43 | |
44 | 44 | H3270 * session; |
45 | -/* | |
46 | - gchar * font; | |
47 | - guint fontsize; | |
48 | - cairo_font_weight_t fontweight; | |
49 | -*/ | |
45 | + | |
50 | 46 | int baddr; |
51 | 47 | int rows; |
52 | - int cols; | |
48 | + int cols; /**< Max line width */ | |
53 | 49 | int pages; |
54 | - int lpp; /**< Lines per page */ | |
50 | + int lpp; /**< Lines per page */ | |
55 | 51 | cairo_font_extents_t extents; |
56 | 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 | 55 | cairo_scaled_font_t * font_scaled; |
60 | 56 | |
61 | 57 | gchar **text; |
... | ... | @@ -94,7 +90,7 @@ |
94 | 90 | |
95 | 91 | // Setup font |
96 | 92 | |
97 | - if(font) | |
93 | + if(*font) | |
98 | 94 | { |
99 | 95 | PangoFontDescription * descr = pango_font_description_from_string(font); |
100 | 96 | if(descr) |
... | ... | @@ -103,12 +99,12 @@ |
103 | 99 | CAIRO_FONT_SLANT_NORMAL, |
104 | 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 | 104 | pango_font_description_free(descr); |
109 | 105 | } |
110 | - g_free(font); | |
111 | 106 | } |
107 | + g_free(font); | |
112 | 108 | |
113 | 109 | info->font_scaled = cairo_get_scaled_font(cr); |
114 | 110 | cairo_scaled_font_reference(info->font_scaled); |
... | ... | @@ -449,7 +445,8 @@ static gchar * enum_to_string(GType type, guint enum_value) |
449 | 445 | GtkPageSetup * setup = gtk_page_setup_new(); |
450 | 446 | |
451 | 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 | 451 | // Basic setup |
455 | 452 | gtk_print_operation_set_allow_async(print,TRUE); |
... | ... | @@ -671,6 +668,7 @@ static gchar * enum_to_string(GType type, guint enum_value) |
671 | 668 | lib3270_get_screen_size(info->session,&info->rows,&info->cols); |
672 | 669 | |
673 | 670 | info->src = src; |
671 | + | |
674 | 672 | g_signal_connect(print,"begin_print",G_CALLBACK(begin_print),info); |
675 | 673 | g_signal_connect(print,"draw_page",G_CALLBACK(draw_screen),info); |
676 | 674 | ... | ... |