Page 1 of 1

Posted: 22 Aug 2016, 02:47
by sm_jamieson
Could there please be a way of determining the display size of a text string (in pixels or percent) ?
If you want to center a text string or create a box just large enough to contain a text string, these dimensions are vital.

Take the sdkFillText function:

sdkFillText (TRectF rect, AnsiCharPtr text, TColorUsine textColor, float fontSize, LongBool isBold=FALSE, LongBool isWordWrap=FALSE, TTextAlign alignHorizontal=taCenter, TTextAlign alignVertical=taCenter, LongBool isVertical=FALSE)

You can specify the font size, but there is no way to know how long the entire string will be when it is rendered.

What is needed is something like:

sdkTextDisplayWIdth(text, fontSize, isBold)
and
sdkTextDisplayHeight(text, fontSize, isBold)


A bit like what you can do with java and fontMetrics, etc.

Thanks,
Simon.

Posted: 14 Sep 2016, 08:13
by senso
I'll try to implement it in the HH3 sdk