Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
netrunner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Odilitime
netrunner
Commits
94762ad3
Commit
94762ad3
authored
7 years ago
by
Odilitime
Browse files
Options
Downloads
Patches
Plain Diff
size() call
parent
a807fae0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/graphics/components/TextComponent.cpp
+13
-0
13 additions, 0 deletions
src/graphics/components/TextComponent.cpp
src/graphics/components/TextComponent.h
+1
-0
1 addition, 0 deletions
src/graphics/components/TextComponent.h
with
14 additions
and
0 deletions
src/graphics/components/TextComponent.cpp
+
13
−
0
View file @
94762ad3
...
...
@@ -285,3 +285,16 @@ void TextComponent::sanitize(std::string &str) {
found
++
;
}
}
std
::
unique_ptr
<
std
::
pair
<
int
,
int
>>
TextComponent
::
size
()
const
{
const
std
::
shared_ptr
<
TextRasterizer
>
textRasterizer
=
rasterizerCache
->
loadFont
(
fontSize
,
bold
);
rasterizationRequest
request
;
request
.
text
=
text
;
// startX needs to be relative to the parent x
request
.
startX
=
x
;
request
.
availableWidth
=
windowWidth
;
request
.
sourceStartX
=
rasterStartX
;
request
.
sourceStartY
=
rasterStartY
;
request
.
noWrap
=
noWrap
;
return
textRasterizer
->
size
(
request
);
}
This diff is collapsed.
Click to expand it.
src/graphics/components/TextComponent.h
+
1
−
0
View file @
94762ad3
...
...
@@ -30,6 +30,7 @@ public:
void
resize
(
const
int
passedWindowWidth
,
const
int
passedWindowHeight
);
// compatible adapter
void
resize
(
const
int
passedWindowWidth
,
const
int
passedWindowHeight
,
const
int
passedAvailableWidth
);
// more detailed control
void
sanitize
(
std
::
string
&
str
);
std
::
unique_ptr
<
std
::
pair
<
int
,
int
>>
size
()
const
;
// input needed stuff
int
rasterStartX
=
0
;
// start reading text source at and place at destination 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