Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
3cb34e10
Commit
3cb34e10
authored
Dec 19, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed alignment of empty text
parent
0f33f760
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
src/render/text/viewer.cpp
src/render/text/viewer.cpp
+11
-2
src/render/text/viewer.hpp
src/render/text/viewer.hpp
+1
-1
No files found.
src/render/text/viewer.cpp
View file @
3cb34e10
...
@@ -128,7 +128,7 @@ void TextViewer::prepare(RotatedDC& dc, const String& text, const TextStyle& sty
...
@@ -128,7 +128,7 @@ void TextViewer::prepare(RotatedDC& dc, const String& text, const TextStyle& sty
// not prepared yet
// not prepared yet
Rotater
r
(
dc
,
style
.
getRotation
());
Rotater
r
(
dc
,
style
.
getRotation
());
prepareElements
(
text
,
style
,
ctx
);
prepareElements
(
text
,
style
,
ctx
);
prepareLines
(
dc
,
text
,
style
);
prepareLines
(
dc
,
text
,
style
,
ctx
);
}
}
}
}
void
TextViewer
::
reset
()
{
void
TextViewer
::
reset
()
{
...
@@ -243,13 +243,22 @@ void TextViewer::prepareElements(const String& text, const TextStyle& style, Con
...
@@ -243,13 +243,22 @@ void TextViewer::prepareElements(const String& text, const TextStyle& style, Con
// ----------------------------------------------------------------------------- : Layout
// ----------------------------------------------------------------------------- : Layout
void
TextViewer
::
prepareLines
(
RotatedDC
&
dc
,
const
String
&
text
,
const
TextStyle
&
style
)
{
void
TextViewer
::
prepareLines
(
RotatedDC
&
dc
,
const
String
&
text
,
const
TextStyle
&
style
,
Context
&
ctx
)
{
scale
=
1
;
scale
=
1
;
// find character sizes
// find character sizes
vector
<
CharInfo
>
chars
;
vector
<
CharInfo
>
chars
;
elements
.
getCharInfo
(
dc
,
scale
,
0
,
text
.
size
(),
chars
);
elements
.
getCharInfo
(
dc
,
scale
,
0
,
text
.
size
(),
chars
);
// try to layout
// try to layout
prepareLinesScale
(
dc
,
chars
,
style
,
false
);
prepareLinesScale
(
dc
,
chars
,
style
,
false
);
// no text, find a dummy height for the single line we have
if
(
lines
.
size
()
==
1
&&
lines
[
0
].
width
()
<
0.0001
)
{
if
(
style
.
always_symbol
&&
style
.
symbol_font
.
valid
())
{
lines
[
0
].
line_height
=
style
.
symbol_font
.
font
->
defaultSymbolSize
(
ctx
,
style
.
symbol_font
.
size
).
height
;
}
else
{
dc
.
SetFont
(
style
.
font
.
font
);
lines
[
0
].
line_height
=
dc
.
GetTextExtent
(
_
(
" "
)).
height
;
}
}
// align
// align
alignLines
(
dc
,
chars
,
style
);
alignLines
(
dc
,
chars
,
style
);
}
}
...
...
src/render/text/viewer.hpp
View file @
3cb34e10
...
@@ -104,7 +104,7 @@ class TextViewer {
...
@@ -104,7 +104,7 @@ class TextViewer {
vector
<
Line
>
lines
;
///< The lines in the text box
vector
<
Line
>
lines
;
///< The lines in the text box
/// Prepare the lines, layout the text
/// Prepare the lines, layout the text
void
prepareLines
(
RotatedDC
&
dc
,
const
String
&
text
,
const
TextStyle
&
style
);
void
prepareLines
(
RotatedDC
&
dc
,
const
String
&
text
,
const
TextStyle
&
style
,
Context
&
ctx
);
/// Prepare the lines, layout the text; at a specific scale
/// Prepare the lines, layout the text; at a specific scale
bool
prepareLinesScale
(
RotatedDC
&
dc
,
const
vector
<
CharInfo
>&
chars
,
const
TextStyle
&
style
,
bool
stop_if_too_long
);
bool
prepareLinesScale
(
RotatedDC
&
dc
,
const
vector
<
CharInfo
>&
chars
,
const
TextStyle
&
style
,
bool
stop_if_too_long
);
/// Align the lines within the textbox
/// Align the lines within the textbox
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment