From 92373d9718b2e7ab3242d806bd930df718618064 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Fri, 1 Feb 2019 19:30:08 -0200 Subject: [PATCH] Working on new print component. --- src/dialogs/print/begin.c | 72 +----------------------------------------------------------------------- src/dialogs/print/private.h | 7 ++++--- 2 files changed, 5 insertions(+), 74 deletions(-) diff --git a/src/dialogs/print/begin.c b/src/dialogs/print/begin.c index 3530555..0e21498 100644 --- a/src/dialogs/print/begin.c +++ b/src/dialogs/print/begin.c @@ -68,77 +68,7 @@ trace("Font size: %d",(int) valid); cairo_set_font_size(cr,valid); + // Set view size - /* - - gchar * font = get_string_from_config("print",FONT_CONFIG,DEFAULT_FONT); - - trace("%s: operation=%p context=%p font=\"%s\"",__FUNCTION__,prt,context,font); - - // Setup font - if(*font) - { - PangoFontDescription * descr = pango_font_description_from_string(font); - if(descr) - { - cairo_select_font_face(cr, pango_font_description_get_family(descr), - CAIRO_FONT_SLANT_NORMAL, - pango_font_description_get_weight(descr) == PANGO_WEIGHT_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL); - -#ifdef AUTO_FONT_SIZE - { - double width = gtk_print_context_get_width(context); -#if GTK_CHECK_VERSION(3,0,0) - double cols = (double) info->cols; -#else - double cols = (double) (info->cols+5); -#endif // GTK(3,0,0) - double current = width / cols; - double valid = current; - - do - { - valid = current; - current = valid +1.0; - cairo_set_font_size(cr,current); - cairo_font_extents(cr,&extents); - } - while( (cols * extents.max_x_advance) < width ); - - trace("Font size: %d",(int) valid); - cairo_set_font_size(cr,valid); - - } -#endif // AUTO_FONT_SIZE - - pango_font_description_free(descr); - } - } - g_free(font); - - info->font.scaled = cairo_get_scaled_font(cr); - cairo_scaled_font_reference(info->font.scaled); - cairo_scaled_font_extents(info->font.scaled,&extents); - - info->font.height = extents.height; - info->font.descent = extents.descent; - info->font.width = extents.max_x_advance; - - info->width = ((double) info->cols) * extents.max_x_advance; - info->height = ((double) info->rows) * (extents.height + extents.descent); - - // Center image - info->left = (gtk_print_context_get_width(context)-info->width)/2; - if(info->left < 2) - info->left = 2; - - // Setup page size - info->lpp = (gtk_print_context_get_height(context) / (extents.height + extents.descent)); - info->pages = (info->rows / info->lpp)+1; - - trace("%d lines per page, %d pages to print",info->lpp,info->pages); - - gtk_print_operation_set_n_pages(prt,info->pages); - */ } diff --git a/src/dialogs/print/private.h b/src/dialogs/print/private.h index e2b275b..7599e21 100644 --- a/src/dialogs/print/private.h +++ b/src/dialogs/print/private.h @@ -51,17 +51,18 @@ struct { size_t width; ///< @brief Maximun text width (in characters) - + size_t rows; ///< @brief Number of text rows. + size_t pages; ///< @brief Number of pages. } text; - struct { + struct + { gchar * name; v3270FontInfo info; } font; gboolean show_selection; - }; /*--[ Prototypes ]-----------------------------------------------------------------------------------*/ -- libgit2 0.21.2