Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
85cbf2ee
Commit
85cbf2ee
authored
4 years ago
by
Andrey Kleshchev
Browse files
Options
Downloads
Patches
Plain Diff
SL-12478 long names are not beautiful in Name Tags
According to revised behavior names should always fit into single line
parent
4ac0ab2a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/newview/llhudnametag.cpp
+8
-5
8 additions, 5 deletions
indra/newview/llhudnametag.cpp
with
8 additions
and
5 deletions
indra/newview/llhudnametag.cpp
+
8
−
5
View file @
85cbf2ee
...
@@ -439,17 +439,19 @@ void LLHUDNameTag::addLine(const std::string &text_utf8,
...
@@ -439,17 +439,19 @@ void LLHUDNameTag::addLine(const std::string &text_utf8,
U32
line_length
=
0
;
U32
line_length
=
0
;
if
(
use_ellipses
)
if
(
use_ellipses
)
{
{
// "QualityAssuranceAssuresQuality 1" will end up like "QualityAssuranceAssuresQual..."
// "QualityAssuranceAssuresQuality1" will end up like "QualityAssuranceAssuresQual..."
// "QualityAssurance AssuresQuality 1" will be split into two lines "QualityAssurance" and "AssuresQuality 1"
// "QualityAssuranceAssuresQuality QualityAssuranceAssuresQuality" will end up like "QualityAssuranceAssuresQual..."
// "QualityAssurance AssuresQuality1" will end up as "QualityAssurance AssuresQua..." because we are enforcing single line
do
do
{
{
S32
segment_length
=
font
->
maxDrawableChars
(
iter
->
substr
(
line_length
).
c_str
(),
max_pixels
,
wline
.
length
(),
LLFontGL
::
ONLY_WORD_BOUNDARIES
);
S32
segment_length
=
font
->
maxDrawableChars
(
iter
->
substr
(
line_length
).
c_str
(),
max_pixels
,
wline
.
length
(),
LLFontGL
::
ANYWHERE
);
if
(
segment_length
==
0
)
if
(
segment_length
+
line_length
<
wline
.
length
())
// since we only draw one string, line_length should be 0
{
{
//
First word in segment (not nessesary firs
t
l
in
e) does not fit
, need to draw "...".
//
token does does not fi
t in
to signle line
, need to draw "...".
// Use four dots for ellipsis width to generate padding
// Use four dots for ellipsis width to generate padding
const
LLWString
dots_pad
(
utf8str_to_wstring
(
std
::
string
(
"...."
)));
const
LLWString
dots_pad
(
utf8str_to_wstring
(
std
::
string
(
"...."
)));
S32
elipses_width
=
font
->
getWidthF32
(
dots_pad
.
c_str
());
S32
elipses_width
=
font
->
getWidthF32
(
dots_pad
.
c_str
());
// truncated string length
segment_length
=
font
->
maxDrawableChars
(
iter
->
substr
(
line_length
).
c_str
(),
max_pixels
-
elipses_width
,
wline
.
length
(),
LLFontGL
::
ANYWHERE
);
segment_length
=
font
->
maxDrawableChars
(
iter
->
substr
(
line_length
).
c_str
(),
max_pixels
-
elipses_width
,
wline
.
length
(),
LLFontGL
::
ANYWHERE
);
const
LLWString
dots
(
utf8str_to_wstring
(
std
::
string
(
"..."
)));
const
LLWString
dots
(
utf8str_to_wstring
(
std
::
string
(
"..."
)));
LLHUDTextSegment
segment
(
iter
->
substr
(
line_length
,
segment_length
)
+
dots
,
style
,
color
,
font
);
LLHUDTextSegment
segment
(
iter
->
substr
(
line_length
,
segment_length
)
+
dots
,
style
,
color
,
font
);
...
@@ -458,6 +460,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8,
...
@@ -458,6 +460,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8,
}
}
else
else
{
{
// token fits fully into string
LLHUDTextSegment
segment
(
iter
->
substr
(
line_length
,
segment_length
),
style
,
color
,
font
);
LLHUDTextSegment
segment
(
iter
->
substr
(
line_length
,
segment_length
),
style
,
color
,
font
);
mTextSegments
.
push_back
(
segment
);
mTextSegments
.
push_back
(
segment
);
line_length
+=
segment_length
;
line_length
+=
segment_length
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment