Getting font metrics without GUI (console mode)
问题 Let's say some images have to be generated by a Qt console program and that font metrics are needed by internal algorithms (they use the text width/height as input to compute the position where the drawing should occur). This program has to be runable on a Linux without any GUI (runlevel-3, basically a cluster without any display server). Problem: QFontMetrics are only available when running a Qt application in GUI mode. Any workaround to get string metrics without any display server ? 回答1: