From a94a923240ba6e9928010432e1e815ea69edd6b7 Mon Sep 17 00:00:00 2001
From: Alissa Sabre <none@none>
Date: Thu, 15 Dec 2011 15:19:50 -0500
Subject: [PATCH] storm-1723: fix character display when a lot of different
 characters are used

---
 doc/contributions.txt       |  1 +
 indra/llrender/llfontgl.cpp | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/doc/contributions.txt b/doc/contributions.txt
index 274632a8040..d7d1ab6a708 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -159,6 +159,7 @@ Alissa Sabre
 	VWR-12620
 	VWR-12789
 	SNOW-322
+    STORM-1723
 Alliez Mysterio
 Angus Boyd
 	VWR-592
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index 607473d4166..82e8227ffe5 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -304,6 +304,18 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 		S32 next_bitmap_num = fgi->mBitmapNum;
 		if (next_bitmap_num != bitmap_num)
 		{
+			// Actually draw the queued glyphs before switching their texture;
+			// otherwise the queued glyphs will be taken from wrong textures.
+			if (glyph_count > 0)
+			{
+				gGL.begin(LLRender::QUADS);
+				{
+					gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
+				}
+				gGL.end();
+				glyph_count = 0;
+			}
+
 			bitmap_num = next_bitmap_num;
 			LLImageGL *font_image = font_bitmap_cache->getImageGL(bitmap_num);
 			gGL.getTexUnit(0)->bind(font_image);
-- 
GitLab