+void Label_recalcPosition(entity me)
+{
+ float spaceAvail;
+ spaceAvail = 1 - me.keepspaceLeft - me.keepspaceRight;
+
+ float spaceUsed;
+ spaceUsed = draw_TextWidth(me.text, me.allowColors, me.realFontSize);
+
+ if(spaceUsed <= spaceAvail)
+ {
+ me.realOrigin_x = me.align * (spaceAvail - spaceUsed) + me.keepspaceLeft;
+ me.condenseFactor = 1;
+ }
+ else if(me.allowCut || me.allowWrap)
+ {
+ me.realOrigin_x = me.keepspaceLeft;
+ me.condenseFactor = 1;
+ }
+ else
+ {
+ me.realOrigin_x = me.keepspaceLeft;
+ me.condenseFactor = spaceAvail / spaceUsed;
+ dprint(sprintf(_("NOTE: label text %s too wide for label, condensed by factor %f\n"), me.text, me.condenseFactor));
+ }
+ me.recalcPos = 0;
+}