+ ui_px offset = 0;
+ if( alignment != k_text_alignment_left )
+ {
+ const char *pch = str;
+ for(;;)
+ {
+ offset += (ui_glyph_spacing_x*scale)/4;
+ if( !(*pch) || *pch == '\n' )
+ break;
+ pch ++;
+ }
+
+ if( alignment == k_text_alignment_right )
+ text_cursor[0] = ctx->cursor[0]+ctx->cursor[2]-offset;
+ else
+ text_cursor[0] = (ctx->cursor[0]+(ctx->cursor[2]/2))-(offset/2);
+ }
+