How do I set the number of visible lines in a Gtk::TextView?
问题 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 scroll but I'd like the text view to remain 2 lines tall. How do I do this? 回答1: 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