I have a Gtk::TextView that I would always like to have two lines of text visible, regardless of the font size. Obviously if more than two lines were entered then the box would
This is very difficult. For example, what will you do if two font sizes are mixed in one line?
One way to do it is to create a Pango layout of one letter and find out its height. This is an untested simplification of some code I wrote in C one time; but it shouldn't be too much trouble to convert it to C++ and GTKmm:
PangoLayout *cell = gtk_widget_create_pango_layout(textview, "X");
int line_height;
pango_layout_get_pixel_extents(cell, NULL, &line_height);
g_object_unref(cell);
gtk_widget_set_size_request(textview, -1, line_height);