string_width.c 436 B

12345678910111213141516171819
  1. /*
  2. * Return the width of a string in the font used in GTK controls. Used
  3. * as a means of picking a sensible size for dialog boxes and pieces
  4. * of them, in a way that should adapt sensibly to changes in font and
  5. * resolution.
  6. */
  7. #include <gtk/gtk.h>
  8. #include "putty.h"
  9. #include "gtkcompat.h"
  10. #include "gtkmisc.h"
  11. int string_width(const char *text)
  12. {
  13. int ret;
  14. get_label_text_dimensions(text, &ret, NULL);
  15. return ret;
  16. }