static void adjust_font_size(GtkWidget *widget, gpointer data, gdouble factor) { VteTerminal *terminal; gdouble scale; glong char_width, char_height; gint columns, rows, owidth, oheight; /* Read the screen dimensions in cells. */ terminal = VTE_TERMINAL(widget); columns = vte_terminal_get_column_count(terminal); rows = vte_terminal_get_row_count(terminal); /* Take into account padding and border overhead. */ gtk_window_get_size(GTK_WINDOW(data), &owidth, &oheight); char_width = vte_terminal_get_char_width (terminal); char_height = vte_terminal_get_char_height (terminal); owidth -= char_width * columns; oheight -= char_height * rows; scale = vte_terminal_get_font_scale(terminal); vte_terminal_set_font_scale(terminal, scale * factor); /* This above call will have changed the char size! */ char_width = vte_terminal_get_char_width (terminal); char_height = vte_terminal_get_char_height (terminal); gtk_window_resize(GTK_WINDOW(data), columns * char_width + owidth, rows * char_height + oheight); }
void term_set_font_scale(GtkWidget *win, VteTerminal *term, gdouble mult) { gdouble s; glong width, height; width = vte_terminal_get_column_count(term); height = vte_terminal_get_row_count(term); s = vte_terminal_get_font_scale(term); s *= mult; vte_terminal_set_font_scale(term, s); term_set_size(win, term, width, height); vte_terminal_set_geometry_hints_for_window(VTE_TERMINAL(term), GTK_WINDOW(win)); }
gdouble terminal::get_font_scale() { if ( m_terminal != NULL ) return(vte_terminal_get_font_scale(m_terminal)); }