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
8ff4df04
Commit
8ff4df04
authored
Sep 21, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stretch-overflow biw works with rotation and alignment.
parent
a98bcb50
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
3 deletions
+11
-3
src/data/field/text.cpp
src/data/field/text.cpp
+1
-1
src/data/field/text.hpp
src/data/field/text.hpp
+6
-1
src/render/text/viewer.cpp
src/render/text/viewer.cpp
+3
-0
src/util/alignment.cpp
src/util/alignment.cpp
+1
-1
No files found.
src/data/field/text.cpp
View file @
8ff4df04
...
...
@@ -61,7 +61,7 @@ TextStyle::TextStyle(const TextFieldP& field)
double
TextStyle
::
getStretch
()
const
{
if
(
content_width
>
0
&&
((
alignment
()
&
ALIGN_STRETCH
)
||
(
alignment
()
&
ALIGN_STRETCH_OVERFLOW
)))
{
double
factor
=
(
width
-
padding_left
-
padding_right
)
/
content_width
;
double
factor
=
(
sideways
(
angle
)
?
height
:
width
-
padding_left
-
padding_right
)
/
content_width
;
if
(
alignment
()
==
ALIGN_STRETCH
||
factor
<
1.0
)
{
return
factor
;
}
...
...
src/data/field/text.hpp
View file @
8ff4df04
...
...
@@ -82,7 +82,12 @@ class TextStyle : public Style {
/// The rotation to use when drawing
inline
Rotation
getRotation
()
const
{
return
Rotation
(
angle
,
getRect
(),
1.0
,
getStretch
());
double
stretch
=
getStretch
();
if
(
sideways
(
angle
))
{
return
Rotation
(
angle
,
getRect
(),
stretch
,
1
/
stretch
);
}
else
{
return
Rotation
(
angle
,
getRect
(),
1.0
,
stretch
);
}
}
/// The rotation to use when determining content layout, does not include the stretch factor
inline
Rotation
getRotationNoStretch
()
const
{
...
...
src/render/text/viewer.cpp
View file @
8ff4df04
...
...
@@ -753,6 +753,9 @@ void TextViewer::alignParagraph(size_t start_line, size_t end_line, const vector
c
+=
s
.
x
+
hdelta
*
i
/
count
;
if
(
j
<
l
.
end_or_soft
&&
chars
[
j
++
].
break_after
==
BREAK_SPACE
)
i
++
;
}
}
else
if
(
style
.
alignment
&
ALIGN_STRETCH_OVERFLOW
&&
width
>=
s
.
width
)
{
// stretching, don't center or align right
justifying
=
false
;
}
else
{
// simple alignment
justifying
=
false
;
...
...
src/util/alignment.cpp
View file @
8ff4df04
...
...
@@ -44,10 +44,10 @@ Alignment from_string(const String& s) {
if
(
s
.
find
(
_
(
"justify-overflow"
))
!=
String
::
npos
)
al
=
ALIGN_JUSTIFY_OVERFLOW
|
(
al
&
~
ALIGN_JUSTIFY_OVERFLOW
);
if
(
s
.
find
(
_
(
"shrink-overflow"
))
!=
String
::
npos
)
al
=
ALIGN_STRETCH_OVERFLOW
|
(
al
&
~
ALIGN_STRETCH_OVERFLOW
);
// compatability
if
(
s
.
find
(
_
(
"stretch-overflow"
))
!=
String
::
npos
)
al
=
ALIGN_STRETCH_OVERFLOW
|
(
al
&
~
ALIGN_STRETCH_OVERFLOW
);
else
if
(
s
.
find
(
_
(
"stretch"
))
!=
String
::
npos
)
al
=
ALIGN_STRETCH
;
if
(
s
.
find
(
_
(
"top"
))
!=
String
::
npos
)
al
=
ALIGN_TOP
|
(
al
&
~
ALIGN_VERTICAL
);
if
(
s
.
find
(
_
(
"middle"
))
!=
String
::
npos
)
al
=
ALIGN_MIDDLE
|
(
al
&
~
ALIGN_VERTICAL
);
if
(
s
.
find
(
_
(
"bottom"
))
!=
String
::
npos
)
al
=
ALIGN_BOTTOM
|
(
al
&
~
ALIGN_VERTICAL
);
if
(
s
.
find
(
_
(
"stretch"
))
!=
String
::
npos
)
al
=
ALIGN_STRETCH
;
return
static_cast
<
Alignment
>
(
al
);
}
...
...
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