- // find a string that will fit inside the area for text
- int max_length = width() - getBevelWidth() * 2;
- if (max_length <= 0) {
- t = ""; // can't fit anything
- } else {
- size_t text_len = t.size();
- int length;
-
- do {
- t.resize(text_len);
- length = ft.measureString(t);
- } while (length > max_length && text_len-- > 0);