diff options
Diffstat (limited to 'linden/indra/llrender/llfontgl.cpp')
-rw-r--r-- | linden/indra/llrender/llfontgl.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/linden/indra/llrender/llfontgl.cpp b/linden/indra/llrender/llfontgl.cpp index 2774e8d..2740c6c 100644 --- a/linden/indra/llrender/llfontgl.cpp +++ b/linden/indra/llrender/llfontgl.cpp | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "llfontgl.h" | 33 | #include "llfontgl.h" |
34 | #include "llgl.h" | 34 | #include "llgl.h" |
35 | #include "v4color.h" | 35 | #include "v4color.h" |
36 | #include "llstl.h" | ||
36 | 37 | ||
37 | const S32 BOLD_OFFSET = 1; | 38 | const S32 BOLD_OFFSET = 1; |
38 | 39 | ||
@@ -155,7 +156,7 @@ LLString LLFontGL::getFontPathSystem() | |||
155 | // Try to figure out where the system's font files are stored. | 156 | // Try to figure out where the system's font files are stored. |
156 | char *system_root = NULL; | 157 | char *system_root = NULL; |
157 | #if LL_WINDOWS | 158 | #if LL_WINDOWS |
158 | system_root = getenv("SystemRoot"); | 159 | system_root = getenv("SystemRoot"); /* Flawfinder: ignore */ |
159 | if (!system_root) | 160 | if (!system_root) |
160 | { | 161 | { |
161 | llwarns << "SystemRoot not found, attempting to load fonts from default path." << llendl; | 162 | llwarns << "SystemRoot not found, attempting to load fonts from default path." << llendl; |
@@ -647,7 +648,7 @@ S32 LLFontGL::render(const LLWString &wstr, | |||
647 | case LEFT: | 648 | case LEFT: |
648 | break; | 649 | break; |
649 | case RIGHT: | 650 | case RIGHT: |
650 | cur_x -= (F32)getWidth(wstr.c_str(), 0, length) * sScaleX; | 651 | cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), 0, length) * sScaleX)); |
651 | break; | 652 | break; |
652 | case HCENTER: | 653 | case HCENTER: |
653 | cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), 0, length) * sScaleX)) / 2; | 654 | cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), 0, length) * sScaleX)) / 2; |
@@ -672,12 +673,13 @@ S32 LLFontGL::render(const LLWString &wstr, | |||
672 | 673 | ||
673 | 674 | ||
674 | BOOL draw_ellipses = FALSE; | 675 | BOOL draw_ellipses = FALSE; |
675 | if (use_ellipses) | 676 | if (use_ellipses && halign == LEFT) |
676 | { | 677 | { |
677 | // check for too long of a string | 678 | // check for too long of a string |
678 | if (getWidthF32(wstr.c_str(), 0, max_chars) > scaled_max_pixels) | 679 | if (getWidthF32(wstr.c_str(), 0, max_chars) > scaled_max_pixels) |
679 | { | 680 | { |
680 | const LLWString dots(utf8str_to_wstring(LLString("..."))); | 681 | // use four dots for ellipsis width to generate padding |
682 | const LLWString dots(utf8str_to_wstring(LLString("...."))); | ||
681 | scaled_max_pixels = llmax(0, scaled_max_pixels - llround(getWidthF32(dots.c_str()))); | 683 | scaled_max_pixels = llmax(0, scaled_max_pixels - llround(getWidthF32(dots.c_str()))); |
682 | draw_ellipses = TRUE; | 684 | draw_ellipses = TRUE; |
683 | } | 685 | } |
@@ -1330,7 +1332,7 @@ LLString LLFontGL::nameFromFont(const LLFontGL* fontp) | |||
1330 | { | 1332 | { |
1331 | if (fontp == sSansSerifHuge) | 1333 | if (fontp == sSansSerifHuge) |
1332 | { | 1334 | { |
1333 | return LLString("SansSerifHude"); | 1335 | return LLString("SansSerifHuge"); |
1334 | } | 1336 | } |
1335 | else if (fontp == sSansSerifSmall) | 1337 | else if (fontp == sSansSerifSmall) |
1336 | { | 1338 | { |