projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "fix issue with text size with negative line spacing" into devel/master
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
internal
/
text
/
layouts
/
layout-engine.cpp
diff --git
a/dali-toolkit/internal/text/layouts/layout-engine.cpp
b/dali-toolkit/internal/text/layouts/layout-engine.cpp
index
8c8ea94
..
53030e2
100644
(file)
--- a/
dali-toolkit/internal/text/layouts/layout-engine.cpp
+++ b/
dali-toolkit/internal/text/layouts/layout-engine.cpp
@@
-37,11
+37,18
@@
namespace Toolkit
{
namespace Text
{
{
namespace Text
{
-float GetLineHeight(const LineRun lineRun)
+float GetLineHeight(const LineRun lineRun
, bool isLastLine
)
{
// The line height is the addition of the line ascender, the line descender and the line spacing.
// However, the line descender has a negative value, hence the subtraction.
{
// The line height is the addition of the line ascender, the line descender and the line spacing.
// However, the line descender has a negative value, hence the subtraction.
- return lineRun.ascender - lineRun.descender + lineRun.lineSpacing;
+ // In case this is the only/last line then line spacing should be ignored.
+ float lineHeight = lineRun.ascender - lineRun.descender;
+
+ if(!isLastLine || lineRun.lineSpacing > 0)
+ {
+ lineHeight += lineRun.lineSpacing;
+ }
+ return lineHeight;
}
namespace Layout
}
namespace Layout
@@
-1297,7
+1304,7
@@
struct Engine::Impl
layoutSize.width = layoutParameters.boundingBox.width;
if(layoutSize.height < Math::MACHINE_EPSILON_1000)
{
layoutSize.width = layoutParameters.boundingBox.width;
if(layoutSize.height < Math::MACHINE_EPSILON_1000)
{
- layoutSize.height += GetLineHeight(*lineRun);
+ layoutSize.height += GetLineHeight(*lineRun
, true
);
}
const Vector<BidirectionalLineInfoRun>& bidirectionalLinesInfo = layoutParameters.textModel->mLogicalModel->mBidirectionalLineInfo;
}
const Vector<BidirectionalLineInfoRun>& bidirectionalLinesInfo = layoutParameters.textModel->mLogicalModel->mBidirectionalLineInfo;
@@
-1401,7
+1408,7
@@
struct Engine::Impl
layoutSize.width = lineRun.width;
}
layoutSize.width = lineRun.width;
}
- layoutSize.height += GetLineHeight(lineRun);
+ layoutSize.height += GetLineHeight(lineRun
, isLastLine
);
}
/**
}
/**
@@
-1449,7
+1456,7
@@
struct Engine::Impl
lineRun.lineSpacing = GetLineSpacing(lineRun.ascender + -lineRun.descender);
lineRun.lineSpacing = GetLineSpacing(lineRun.ascender + -lineRun.descender);
- layoutSize.height += GetLineHeight(lineRun);
+ layoutSize.height += GetLineHeight(lineRun
, true
);
}
/**
}
/**
@@
-1466,14
+1473,15
@@
struct Engine::Impl
it != endIt;
++it)
{
it != endIt;
++it)
{
- const LineRun& line = *it;
+ const LineRun& line = *it;
+ bool isLastLine = (it + 1 == endIt);
if(line.width > layoutSize.width)
{
layoutSize.width = line.width;
}
if(line.width > layoutSize.width)
{
layoutSize.width = line.width;
}
- layoutSize.height += GetLineHeight(line);
+ layoutSize.height += GetLineHeight(line
, isLastLine
);
}
}
}
}