Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tales of MajEyal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
K'van
Tales of MajEyal
Commits
fb0f9fb3
Commit
fb0f9fb3
authored
10 years ago
by
Alex Ksandra
Browse files
Options
Downloads
Patches
Plain Diff
Made liberal use of simpler Font.size
parent
dc1d03e1
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
game/engines/default/engine/utils.lua
+6
-5
6 additions, 5 deletions
game/engines/default/engine/utils.lua
with
6 additions
and
5 deletions
game/engines/default/engine/utils.lua
+
6
−
5
View file @
fb0f9fb3
...
...
@@ -718,7 +718,8 @@ function string.removeUIDCodes(str)
end
function
string
.
splitLine
(
str
,
max_width
,
font
)
local
space_w
=
font
:
size
(
" "
)
local
fontoldsize
=
font
.
simplesize
or
font
.
size
local
space_w
=
fontoldsize
(
font
,
" "
)
local
lines
=
{}
local
cur_line
,
cur_size
=
""
,
0
local
v
...
...
@@ -726,7 +727,7 @@ function string.splitLine(str, max_width, font)
for
i
=
1
,
#
ls
do
local
v
=
ls
[
i
]
local
shortv
=
v
:
lpegSub
(
"#"
*
(
Puid
+
Pcolorcodefull
+
Pcolorname
+
Pfontstyle
+
Pextra
)
*
"#"
,
""
)
local
w
,
h
=
font
:
size
(
shortv
)
local
w
,
h
=
font
old
size
(
font
,
shortv
)
if
cur_size
+
space_w
+
w
<
max_width
then
cur_line
=
cur_line
..
(
cur_size
==
0
and
""
or
" "
)
..
v
...
...
@@ -977,10 +978,10 @@ function tstring:maxWidth(font)
local
old_style
=
font
:
getStyle
()
local
line_max
=
0
local
v
local
w
,
h
=
font
:
size
(
""
)
local
w
,
h
=
font
old
size
(
font
,
""
)
for
i
=
1
,
#
self
do
v
=
self
[
i
]
if
type
(
v
)
==
"string"
then
line_max
=
line_max
+
font
:
size
(
v
)
+
1
if
type
(
v
)
==
"string"
then
line_max
=
line_max
+
font
old
size
(
font
,
v
)
+
1
elseif
type
(
v
)
==
"table"
then
if
v
[
1
]
==
"uid"
then
line_max
=
line_max
+
h
-- UID surface is same as font size
elseif
v
[
1
]
==
"font"
and
v
[
2
]
==
"bold"
then
font
:
setStyle
(
"bold"
)
elseif
v
[
1
]
==
"font"
and
v
[
2
]
==
"normal"
then
font
:
setStyle
(
"normal"
)
end
...
...
@@ -1061,7 +1062,7 @@ function tstring:toTString() return self end
function
tstring
:
format
()
return
self
end
function
tstring
:
splitLines
(
max_width
,
font
)
local
space_w
=
font
:
size
(
" "
)
local
space_w
=
font
old
size
(
font
,
" "
)
local
ret
=
tstring
{}
local
cur_size
=
0
local
max_w
=
0
...
...
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