X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fitem%2Flabel.c;h=85df8a7179d1b909da51bd0e20e96b0862d0a587;hb=1ecbcab6230a6b7b58eb1c5dfddb887b390c937e;hp=c9f6a5b629b19c42218a45a3d1e5f3291f8701ba;hpb=95296aec9692be3f48141461ba3eadbe80bb5faf;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/item/label.c b/qcsrc/menu/item/label.c index c9f6a5b62..85df8a717 100644 --- a/qcsrc/menu/item/label.c +++ b/qcsrc/menu/item/label.c @@ -74,9 +74,42 @@ void Label_resizeNotify(entity me, vector relOrigin, vector relSize, vector absO me.keepspaceLeft = me.marginLeft * me.realFontSize_x; if(me.marginRight) me.keepspaceRight = me.marginRight * me.realFontSize_x; - me.realOrigin_y = 0.5 * (1 - me.realFontSize_y); me.recalcPosition(me); + + float lines; + + vector dfs; + vector fs; + + // set up variables to draw in condensed size, but use hinting for original size + fs = me.realFontSize; + fs_x *= me.condenseFactor; + + dfs = draw_fontscale; + draw_fontscale_x *= me.condenseFactor; + + if(me.allowCut) // FIXME allowCut incompatible with align != 0 + lines = 1; + else if(me.allowWrap) // FIXME allowWrap incompatible with align != 0 + { + getWrappedLine_remaining = me.text; + lines = 0; + while(getWrappedLine_remaining) + { + if (me.allowColors) + getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight), fs, draw_TextWidth_WithColors); + else + getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight), fs, draw_TextWidth_WithoutColors); + ++lines; + } + } + else + lines = 1; + + draw_fontscale = dfs; + + me.realOrigin_y = 0.5 * (1 - lines * me.realFontSize_y); } void Label_configureLabel(entity me, string txt, float sz, float algn) { @@ -136,5 +169,7 @@ void Label_draw(entity me) draw_fontscale = dfs; } + + SUPER(Label).draw(me); } #endif