From 78dc4132aa18671d81deb67b0cbcde5369c4d103 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 18 Jan 2011 18:03:40 +0100 Subject: [PATCH] fix display of the welcome text --- qcsrc/menu/item/label.c | 37 +++++++++++++++++++++++++++- qcsrc/menu/xonotic/dialog_firstrun.c | 5 ++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/qcsrc/menu/item/label.c b/qcsrc/menu/item/label.c index c9f6a5b629..e91668dba9 100644 --- a/qcsrc/menu/item/label.c +++ b/qcsrc/menu/item/label.c @@ -74,9 +74,44 @@ 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); + if(substring(me.text, 0, 3) == "Wel") + print(ftos(me.realOrigin_y), " ", me.text, "\n"); } void Label_configureLabel(entity me, string txt, float sz, float algn) { diff --git a/qcsrc/menu/xonotic/dialog_firstrun.c b/qcsrc/menu/xonotic/dialog_firstrun.c index 6ad9351b1c..9ab7eb6da5 100644 --- a/qcsrc/menu/xonotic/dialog_firstrun.c +++ b/qcsrc/menu/xonotic/dialog_firstrun.c @@ -28,11 +28,12 @@ void XonoticFirstRunDialog_fill(entity me) { entity e; entity label, box; + me.TR(me); - me.TD(me, 3, 3, e = makeXonoticTextLabel(0, _("Welcome to Xonotic, please select your language preference and enter your player name to get started. You can change these options later through the menu system."))); + me.TD(me, 2, 3, e = makeXonoticTextLabel(0, _("Welcome to Xonotic, please select your language preference and enter your player name to get started. You can change these options later through the menu system."))); e.allowWrap = 1; me.TR(me); - me.TR(me); + me.TR(me); me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Text language:"))); me.TR(me); -- 2.39.2