From 79ec59e6bc7201017fc13a20c6e33380adca1660 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 19 May 2019 10:58:57 -0400 Subject: [PATCH] Calculate bndLabelWidth for multiline strings. --- blendish.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/blendish.h b/blendish.h index ae67238..81b6f1d 100644 --- a/blendish.h +++ b/blendish.h @@ -1907,7 +1907,9 @@ float bndLabelWidth(NVGcontext *ctx, int iconid, const char *label) { if (label && (bnd_font >= 0)) { nvgFontFaceId(ctx, bnd_font); nvgFontSize(ctx, BND_LABEL_FONT_SIZE); - w += nvgTextBounds(ctx, 1, 1, label, NULL, NULL); + float bounds[4]; + nvgTextBoxBounds(ctx, 1, 1, INFINITY, label, NULL, bounds); + w += bounds[2]; } return w; }