I'm using a Pango inside a Cairo context inside a GTK window. How can I calculate how many text lines and columns would fit inside the area?
Lines are easy; you can render a sample line of text in a PangoLayout and call pango_layout_get_pixel_extents()
on it, then do the required math to figure out how many of those would fit vertically in your GtkWindow.
Columns are not so easy (and whatever number you calculate won't mean much) unless you are using a monospaced font. If your font is monospaced, then use the same method as for lines.