diff options
author | Mark Hung <marklm9@gmail.com> | 2022-05-01 14:07:01 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2022-05-13 01:32:22 +0200 |
commit | fb8eb0ad9c3a5957a6e131490a7a8c97e5353ba2 (patch) | |
tree | 006cf8b8ebc761142c56ff629a83168924976798 /sw/source/core/text/itrtxt.cxx | |
parent | 9391e9fb99a87e71897e29da79eba084682fdaa5 (diff) |
tdf#104930 aligning CTL text with hanging baseline.
1. SwTextSizeInfo::GetHangingBaseline() calls SwFont::GetHangingBaseline() to obtain the hanging baseline value. Only CTL script handled, it always return 0 for other two scripts. Eventually Outdev::GetFontMetric() and TextMetric::GetHangingBaseline() are called to obtain the hanging baseline value from vcl.
2. SwTextFormatter::CalcAscent() sets the baseline value for the portion via SwTextSizeInfo::GetHangingBaseline().
3. SwTextFormatter::InsertPortion() sets the maximum baseline value for the whole line.
4. SwTextCursor::AdjustBaseLine() calculates the new baseline in case hanging baseline is available.
Change-Id: I1aae7a34dfc953227b7873fc8e3af5cc7e2fbbff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133668
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'sw/source/core/text/itrtxt.cxx')
-rw-r--r-- | sw/source/core/text/itrtxt.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx index 8fb8334a83fa..53e084b03736 100644 --- a/sw/source/core/text/itrtxt.cxx +++ b/sw/source/core/text/itrtxt.cxx @@ -289,7 +289,14 @@ SwTwips SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine, [[fallthrough]]; case SvxParaVertAlignItem::Align::Baseline : // base line - nOfst = nOfst + rLine.GetAscent(); + if (pPor && pPor->GetHangingBaseline()) + { + nOfst += rLine.GetAscent() // Romn baseline of the line. + - rLine.GetHangingBaseline() // Hanging baseline of the line. + + pPor->GetHangingBaseline(); // Romn baseline of the portion. + } + else + nOfst = nOfst + rLine.GetAscent(); break; } } |