@@ -709,12 +709,11 @@ protected: | |||||
void textBox(float x, float y, float breakRowWidth, const char* string, const char* end); | void textBox(float x, float y, float breakRowWidth, const char* string, const char* end); | ||||
/** | /** | ||||
Measures the specified text string. Parameter bounds should be a pointer to float[4], | |||||
if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax] | |||||
Measures the specified text string. The bounds value are [xmin,ymin, xmax,ymax]. | |||||
Returns the horizontal advance of the measured text (i.e. where the next character should drawn). | Returns the horizontal advance of the measured text (i.e. where the next character should drawn). | ||||
Measured values are returned in local coordinate space. | Measured values are returned in local coordinate space. | ||||
*/ | */ | ||||
float textBounds(float x, float y, const char* string, const char* end, float* bounds); | |||||
float textBounds(float x, float y, const char* string, const char* end, Rectangle<float>& bounds); | |||||
/** | /** | ||||
Measures the specified multi-text string. Parameter bounds should be a pointer to float[4], | Measures the specified multi-text string. Parameter bounds should be a pointer to float[4], | ||||
@@ -544,9 +544,12 @@ void NanoWidget::textBox(float x, float y, float breakRowWidth, const char* stri | |||||
nvgTextBox(fContext, x, y, breakRowWidth, string, end); | nvgTextBox(fContext, x, y, breakRowWidth, string, end); | ||||
} | } | ||||
float NanoWidget::textBounds(float x, float y, const char* string, const char* end, float* bounds) | |||||
float NanoWidget::textBounds(float x, float y, const char* string, const char* end, Rectangle<float>& bounds) | |||||
{ | { | ||||
return nvgTextBounds(fContext, x, y, string, end, bounds); | |||||
float b[4]; | |||||
const float ret = nvgTextBounds(fContext, x, y, string, end, b); | |||||
bounds = Rectangle<float>(b[0], b[1], b[2], b[3]); | |||||
return ret; | |||||
} | } | ||||
void NanoWidget::textBoxBounds(float x, float y, float breakRowWidth, const char* string, const char* end, float* bounds) | void NanoWidget::textBoxBounds(float x, float y, float breakRowWidth, const char* string, const char* end, float* bounds) | ||||