editeng/source/editeng/impedit3.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 01c95615899fbcf33b49b2833e709dec9de71632
Author:     Jonathan Clark <jonat...@libreoffice.org>
AuthorDate: Wed Sep 10 18:51:25 2025 -0600
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Sep 12 13:56:15 2025 +0200

    tdf#168263 editeng: Fix wrong max ascent for text without ruby
    
    Editeng must adjust the maximum ascent of lines to accommodate ruby
    characters. This adjustment is only necessary when ruby characters are
    actually used, and the intention was to only apply the adjustment in
    that case. Unfortunately, due to an implementation error, this
    adjustment was instead performed for any line containing formatting.
    
    Change-Id: Ibd4ea3cda8b40c95f41f1d84b47155455a20a1cf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190784
    Reviewed-by: Jonathan Clark <jonat...@libreoffice.org>
    Tested-by: Jenkins
    (cherry picked from commit f166009a3b62e680c993d033a97e4a24a65ceaa1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190846
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index c8e47018e5d7..84e85dcc1a9e 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -646,6 +646,16 @@ void ImpEditEngine::populateRubyInfo(ParaPortion& 
rParaPortion, EditLine* pLine)
     for (sal_Int32 nP = pLine->GetStartPortion(); pNextRubyAttr && nP <= 
pLine->GetEndPortion();
          ++nP)
     {
+        const auto* pRuby = static_cast<const 
SvxRubyItem*>(pNextRubyAttr->GetItem());
+        if (pRuby->GetText().isEmpty())
+        {
+            // Skip processing blank ruby spans
+            pNextRubyAttr
+                = 
rParaPortion.GetNode()->GetCharAttribs().FindNextAttrib(EE_CHAR_RUBY, nTextPos);
+            pTPRubyStart = nullptr;
+            continue;
+        }
+
         SeekCursor(pNode, nTextPos, aTmpFont);
 
         TextPortion& rTP = rParaPortion.GetTextPortions()[nP];
@@ -673,7 +683,6 @@ void ImpEditEngine::populateRubyInfo(ParaPortion& 
rParaPortion, EditLine* pLine)
             auto pRubyInfo = std::make_unique<RubyPortionInfo>();
 
             // Get ruby text width
-            const auto* pRuby = static_cast<const 
SvxRubyItem*>(pNextRubyAttr->GetItem());
 
             // TODO: Style support is unimplemented. For now, use a hard-coded 
50% scale
             aRubyStartFont.SetFontSize(aRubyStartFont.GetFontSize() / 2);

Reply via email to