Skip to content

Commit 58cd840

Browse files
committed
#3068 Experience names with emojis are displayed incompletely
1 parent 126659e commit 58cd840

File tree

1 file changed

+17
-26
lines changed

1 file changed

+17
-26
lines changed

indra/llrender/llfontgl.cpp

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,26 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
282282

283283
std::pair<EFontGlyphType, S32> bitmap_entry = std::make_pair(EFontGlyphType::Grayscale, -1);
284284
U32 glyph_count = 0;
285+
auto draw_queued_glyphs = [&]()
286+
{
287+
if (glyph_count)
288+
{
289+
gGL.begin(LLRender::TRIANGLES);
290+
{
291+
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 6);
292+
}
293+
gGL.end();
294+
glyph_count = 0;
295+
}
296+
};
297+
285298
for (i = begin_offset; i < begin_offset + length; i++)
286299
{
287300
llwchar wch = wstr[i];
288301

289302
const LLFontGlyphInfo* fgi = next_glyph;
290303
next_glyph = NULL;
291-
if(!fgi)
304+
if (!fgi)
292305
{
293306
fgi = mFontFreetype->getGlyphInfo(wch, (!use_color) ? EFontGlyphType::Grayscale : EFontGlyphType::Color);
294307
}
@@ -303,15 +316,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
303316
{
304317
// Actually draw the queued glyphs before switching their texture;
305318
// otherwise the queued glyphs will be taken from wrong textures.
306-
if (glyph_count > 0)
307-
{
308-
gGL.begin(LLRender::TRIANGLES);
309-
{
310-
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 6);
311-
}
312-
gGL.end();
313-
glyph_count = 0;
314-
}
319+
draw_queued_glyphs();
315320

316321
bitmap_entry = next_bitmap_entry;
317322
LLImageGL* font_image = font_bitmap_cache->getImageGL(bitmap_entry.first, bitmap_entry.second);
@@ -336,16 +341,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
336341
(F32)ll_round(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth,
337342
(F32)ll_round(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight);
338343

339-
if (glyph_count >= GLYPH_BATCH_SIZE)
340-
{
341-
gGL.begin(LLRender::TRIANGLES);
342-
{
343-
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 6);
344-
}
345-
gGL.end();
346-
347-
glyph_count = 0;
348-
}
344+
draw_queued_glyphs();
349345

350346
const LLColor4U& col =
351347
bitmap_entry.first == EFontGlyphType::Grayscale ? text_color
@@ -376,12 +372,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
376372
cur_render_y = cur_y;
377373
}
378374

379-
gGL.begin(LLRender::TRIANGLES);
380-
{
381-
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 6);
382-
}
383-
gGL.end();
384-
375+
draw_queued_glyphs();
385376

386377
if (right_x)
387378
{

0 commit comments

Comments
 (0)