I want to draw two strings on the same line: one is left-justified, the second is right-justified.
/* Left string */
r.x0 = 10; r.y0 = 0;
r.x1 = ???; r.y1 = 39;
GUI_DispStringInRect(leftStr, &r, GUI_TA_LEFT | GUI_TA_VCENTER);
/* Right string */
r.x0 = r.x1 + 1;
r.x1 = 320 - 10 - 1;
GUI_DispStringInRect(rightStr, &r, GUI_TA_RIGHT | GUI_TA_VCENTER);
The width of the left string isn't known at compile time, so I can't assign the exact value to r.x1, before drawing the left string.
So the question: how to know the width in pixel of the left string?
/* Left string */
r.x0 = 10; r.y0 = 0;
r.x1 = ???; r.y1 = 39;
GUI_DispStringInRect(leftStr, &r, GUI_TA_LEFT | GUI_TA_VCENTER);
/* Right string */
r.x0 = r.x1 + 1;
r.x1 = 320 - 10 - 1;
GUI_DispStringInRect(rightStr, &r, GUI_TA_RIGHT | GUI_TA_VCENTER);
The width of the left string isn't known at compile time, so I can't assign the exact value to r.x1, before drawing the left string.
So the question: how to know the width in pixel of the left string?
The post was edited 1 time, last by giusloq ().