From 3a597af700e55e2017c85220b2b97cc9f3aef9aa Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Wed, 18 Jan 2012 16:30:53 -0800
Subject: [PATCH] EXP-1513 FIX Underscore ( _ ) fails to show in first chat
 entry in Local Chat fixed font metrics rounding error and made corrective
 adjustments in layout

---
 indra/llrender/llfontgl.cpp                    | 18 +++++++++---------
 indra/llui/llmenugl.cpp                        |  8 ++++----
 indra/llui/llscrolllistcell.cpp                |  2 +-
 indra/newview/llfloatermediasettings.cpp       |  6 ++++++
 indra/newview/llfloatermediasettings.h         |  1 +
 indra/newview/llfloatertools.cpp               |  5 ++++-
 indra/newview/llhudrender.cpp                  |  2 +-
 indra/newview/llhudtext.cpp                    |  6 ++----
 indra/newview/llpanelgrouproles.cpp            |  5 ++++-
 indra/newview/llpanelvoiceeffect.cpp           |  1 -
 .../default/xui/en/floater_about_land.xml      |  2 +-
 .../default/xui/en/floater_test_textbox.xml    | 15 ++++++---------
 .../skins/default/xui/en/inspect_object.xml    |  1 +
 .../default/xui/en/panel_navigation_bar.xml    |  5 +++--
 .../default/xui/en/panel_preferences_sound.xml |  2 +-
 .../skins/default/xui/en/widgets/button.xml    |  2 +-
 .../skins/default/xui/en/widgets/check_box.xml |  2 +-
 17 files changed, 46 insertions(+), 37 deletions(-)

diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index 82e8227ffe..12f86cf599 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -218,13 +218,13 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 	switch (valign)
 	{
 	case TOP:
-		cur_y -= mFontFreetype->getAscenderHeight();
+		cur_y -= getAscenderHeight();
 		break;
 	case BOTTOM:
-		cur_y += mFontFreetype->getDescenderHeight();
+		cur_y += getDescenderHeight();
 		break;
 	case VCENTER:
-		cur_y -= (mFontFreetype->getAscenderHeight() - mFontFreetype->getDescenderHeight()) / 2.f;
+		cur_y -= (getAscenderHeight() - getDescenderHeight()) / 2.f;
 		break;
 	case BASELINE:
 		// Baseline, do nothing.
@@ -390,12 +390,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 	//FIXME: add underline as glyph?
 	if (style_to_add & UNDERLINE)
 	{
-		F32 descender = mFontFreetype->getDescenderHeight();
+		F32 descender = (F32)llfloor(mFontFreetype->getDescenderHeight());
 
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		gGL.begin(LLRender::LINES);
-		gGL.vertex2f(start_x, cur_y - (descender));
-		gGL.vertex2f(cur_x, cur_y - (descender));
+		gGL.vertex2f(start_x, cur_y - descender);
+		gGL.vertex2f(cur_x, cur_y - descender);
 		gGL.end();
 	}
 
@@ -446,17 +446,17 @@ S32 LLFontGL::renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y
 // font metrics - override for LLFontFreetype that returns units of virtual pixels
 F32 LLFontGL::getLineHeight() const
 { 
-	return (F32)llround(mFontFreetype->getLineHeight() / sScaleY); 
+	return (F32)llceil(mFontFreetype->getLineHeight() / sScaleY); 
 }
 
 F32 LLFontGL::getAscenderHeight() const
 { 
-	return (F32)llround(mFontFreetype->getAscenderHeight() / sScaleY); 
+	return (F32)llceil(mFontFreetype->getAscenderHeight() / sScaleY); 
 }
 
 F32 LLFontGL::getDescenderHeight() const
 { 
-	return (F32)llround(mFontFreetype->getDescenderHeight() / sScaleY); 
+	return (F32)llceil(mFontFreetype->getDescenderHeight() / sScaleY); 
 }
 
 S32 LLFontGL::getWidth(const std::string& utf8text) const
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 95ecbb1c94..c624ae2e92 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -508,19 +508,19 @@ void LLMenuItemGL::draw( void )
 	{
 		if( !mDrawBoolLabel.empty() )
 		{
-			mFont->render( mDrawBoolLabel.getWString(), 0, (F32)LEFT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
+			mFont->render( mDrawBoolLabel.getWString(), 0, (F32)LEFT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color,
 						   LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 		}
-		mFont->render( mLabel.getWString(), 0, (F32)LEFT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
+		mFont->render( mLabel.getWString(), 0, (F32)LEFT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color,
 					   LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 		if( !mDrawAccelLabel.empty() )
 		{
-			mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
+			mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color,
 						   LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 		}
 		if( !mDrawBranchLabel.empty() )
 		{
-			mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
+			mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color,
 						   LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 		}
 	}
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 9d25c7180d..b087602a56 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -329,7 +329,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
 		break;
 	}
 	mFont->render(mText.getWString(), 0, 
-					start_x, 2.f,
+					start_x, 0.f,
 					display_color,
 					mFontAlignment,
 					LLFontGL::BOTTOM, 
diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp
index 895e16adef..4f2a6ec1b7 100644
--- a/indra/newview/llfloatermediasettings.cpp
+++ b/indra/newview/llfloatermediasettings.cpp
@@ -312,3 +312,9 @@ bool LLFloaterMediaSettings::haveValuesChanged() const
 	return values_changed;
 }
 
+bool LLFloaterMediaSettings::instanceExists()
+{
+	return LLFloaterReg::findTypedInstance<LLFloaterMediaSettings>("media_settings");
+}
+
+
diff --git a/indra/newview/llfloatermediasettings.h b/indra/newview/llfloatermediasettings.h
index ecc55d2cbc..1d25530986 100644
--- a/indra/newview/llfloatermediasettings.h
+++ b/indra/newview/llfloatermediasettings.h
@@ -45,6 +45,7 @@ public:
 	/*virtual*/ void onClose(bool app_quitting);
 
 	static LLFloaterMediaSettings* getInstance();
+	static bool instanceExists();
 	static void apply();
 	static void initValues( const LLSD& media_settings , bool editable);
 	static void clearValues( bool editable);
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index bd5b5f4eb0..0d37d0857e 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -1144,7 +1144,7 @@ void LLFloaterTools::updateLandImpacts()
 	childSetTextArg("remaining_capacity", "[CAPACITY_STRING]", remaining_capacity_str);
 
 	// Update land impacts info in the weights floater
-	LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::getTypedInstance<LLFloaterObjectWeights>("object_weights");
+	LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::findTypedInstance<LLFloaterObjectWeights>("object_weights");
 	if(object_weights_floater)
 	{
 		object_weights_floater->updateLandImpacts(parcel);
@@ -1153,6 +1153,8 @@ void LLFloaterTools::updateLandImpacts()
 
 void LLFloaterTools::getMediaState()
 {
+	if (!LLFloaterMediaSettings::instanceExists()) return;
+
 	LLObjectSelectionHandle selected_objects =LLSelectMgr::getInstance()->getSelection();
 	LLViewerObject* first_object = selected_objects->getFirstObject();
 	LLTextBox* media_info = getChild<LLTextBox>("media_info");
@@ -1234,6 +1236,7 @@ void LLFloaterTools::getMediaState()
 		}
 	} func;
 	
+	
 	// check if all faces have media(or, all dont have media)
 	LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo = selected_objects->getSelectedTEValue( &func, bool_has_media );
 	
diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp
index 122711a86d..dff310ecf9 100644
--- a/indra/newview/llhudrender.cpp
+++ b/indra/newview/llhudrender.cpp
@@ -138,7 +138,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
 	LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f));
 	F32 right_x;
 	
-	font.render(wstr, 0, 0, 0, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x);
+	font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x);
 
 	LLUI::popMatrix();
 	gGL.popMatrix();
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 24a876c59a..f116c8ee6e 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -227,7 +227,7 @@ void LLHUDText::renderText()
 			 segment_iter != mTextSegments.end(); ++segment_iter )
 		{
 			const LLFontGL* fontp = segment_iter->mFont;
-			y_offset -= fontp->getLineHeight();
+			y_offset -= fontp->getLineHeight() - 1;
 
 			U8 style = segment_iter->mStyle;
 			LLFontGL::ShadowType shadow = LLFontGL::DROP_SHADOW;
@@ -480,8 +480,6 @@ void LLHUDText::updateSize()
 	F32 width = 0.f;
 
 	S32 max_lines = getMaxLines();
-	//S32 lines = (max_lines < 0) ? (S32)mTextSegments.size() : llmin((S32)mTextSegments.size(), max_lines);
-	//F32 height = (F32)mFontp->getLineHeight() * (lines + mLabelSegments.size());
 
 	S32 start_segment;
 	if (max_lines < 0) start_segment = 0;
@@ -491,7 +489,7 @@ void LLHUDText::updateSize()
 	while (iter != mTextSegments.end())
 	{
 		const LLFontGL* fontp = iter->mFont;
-		height += fontp->getLineHeight();
+		height += fontp->getLineHeight() - 1;
 		width = llmax(width, llmin(iter->getWidth(fontp), HUD_TEXT_MAX_WIDTH));
 		++iter;
 	}
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index fbe331c7ab..f825ee3215 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -749,7 +749,10 @@ LLPanelGroupMembersSubTab::LLPanelGroupMembersSubTab()
 
 LLPanelGroupMembersSubTab::~LLPanelGroupMembersSubTab()
 {
-	gSavedSettings.setString("GroupMembersSortOrder", mMembersList->getSortColumnName());
+	if (mMembersList)
+	{
+		gSavedSettings.setString("GroupMembersSortOrder", mMembersList->getSortColumnName());
+	}
 }
 
 BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
diff --git a/indra/newview/llpanelvoiceeffect.cpp b/indra/newview/llpanelvoiceeffect.cpp
index 4bbfec8ab7..5fec6d967d 100644
--- a/indra/newview/llpanelvoiceeffect.cpp
+++ b/indra/newview/llpanelvoiceeffect.cpp
@@ -123,7 +123,6 @@ void LLPanelVoiceEffect::update(bool list_updated)
 	if (mVoiceEffectCombo)
 	{
 		LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
-		llassert(effect_interface);
 		if (!effect_interface) return;
 		if (list_updated)
 		{
diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml
index d198cd65a8..28538f7852 100644
--- a/indra/newview/skins/default/xui/en/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/en/floater_about_land.xml
@@ -192,7 +192,7 @@
              type="string"
              length="1"
              follows="left|top"
-             height="20"
+             height="18"
              layout="topleft"
              left_pad="2"
              valign="center" 
diff --git a/indra/newview/skins/default/xui/en/floater_test_textbox.xml b/indra/newview/skins/default/xui/en/floater_test_textbox.xml
index 2df9bb35fe..3d1bc0edae 100644
--- a/indra/newview/skins/default/xui/en/floater_test_textbox.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_textbox.xml
@@ -14,15 +14,12 @@
      height="90"
      layout="topleft"
      left="10"
+     valign="bottom"
+     clip="true"
      top_pad="30"
      width="300">
-        First line of multiple lines
-Second line of multiple lines
-Third line of multiple lines
-Fourth line of multiple lines
-Fifth line of multiple lines
-    </text>
-  <text
+___</text>
+  <!--<text
     clip_partial="true"
     top_pad="10"
     left="10"
@@ -153,7 +150,7 @@ Fifth line of multiple lines
     The 华文细黑 brown fox ヒラキjumped over the lazy dog.
   </text>
   
-<!-- next column -->
+--><!-- next column --><!--
   <text_editor
  height="50"
  follows="top|left|bottom"
@@ -250,5 +247,5 @@ with
 multiple lines
 and too many lines
 to actually fit
-  </text>
+  </text>-->
 </floater>
diff --git a/indra/newview/skins/default/xui/en/inspect_object.xml b/indra/newview/skins/default/xui/en/inspect_object.xml
index 8d14c974b4..b122e1bcff 100644
--- a/indra/newview/skins/default/xui/en/inspect_object.xml
+++ b/indra/newview/skins/default/xui/en/inspect_object.xml
@@ -90,6 +90,7 @@ L$30,000
    follows="all"
    font="SansSerifSmall"
    height="13"
+   clip="false"
    name="object_media_url"
    width="207"
    left_pad="2"
diff --git a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml
index 4bf420b79f..bb942f2c81 100644
--- a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml
@@ -174,13 +174,14 @@
              width="311">
             <label
              follows="left|top"
-             height="15"
+             height="13"
              layout="topleft"
              left="10"
              name="favorites_bar_label"
              text_color="LtGray"
              tool_tip="Drag Landmarks here for quick access to your favorite places in Second Life!"
-             top="12"
+             top="13"
+	     valign="bottom"
              width="102">
               Favorites Bar
             </label>
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml
index 1f92244eb9..b71586aab1 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml
@@ -63,7 +63,7 @@
       layout="topleft"
       left_pad="0"
       name="mute_chb_label"
-      top_delta="0"
+      top_delta="-1"
       width="150"
       wrap="true">
       Mute when minimized
diff --git a/indra/newview/skins/default/xui/en/widgets/button.xml b/indra/newview/skins/default/xui/en/widgets/button.xml
index e2baba92a3..589117fe4c 100644
--- a/indra/newview/skins/default/xui/en/widgets/button.xml
+++ b/indra/newview/skins/default/xui/en/widgets/button.xml
@@ -21,7 +21,7 @@
         font="SansSerifSmall"
         hover_glow_amount="0.15"
         halign="center"
-        pad_bottom="3" 
+        pad_bottom="2" 
         height="23"
         scale_image="true"
         handle_right_mouse="true"
diff --git a/indra/newview/skins/default/xui/en/widgets/check_box.xml b/indra/newview/skins/default/xui/en/widgets/check_box.xml
index cca64fad2a..8947024e45 100644
--- a/indra/newview/skins/default/xui/en/widgets/check_box.xml
+++ b/indra/newview/skins/default/xui/en/widgets/check_box.xml
@@ -10,7 +10,7 @@
                         text_readonly_color="LabelDisabledColor"/>
   <check_box.check_button name="CheckboxCtrl Button"
                           left="2"
-                          bottom="2"
+                          bottom="1"
                           width="13"
                           height="13" 
                           commit_on_return="false"
-- 
GitLab