From 21bfcc1463b1a5896c9ef744cf87344840553093 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Wed, 12 Feb 2025 20:25:04 +0300 Subject: [PATCH] Fix bug #71108 Fix the calculation of line breaks in the East-Asian text --- word/Editor/Run.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/word/Editor/Run.js b/word/Editor/Run.js index 6e370aa2f0..ec49bf2112 100644 --- a/word/Editor/Run.js +++ b/word/Editor/Run.js @@ -3706,6 +3706,8 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) var oSectionPr = undefined; let isSkipFillRange = false; + + let textPr = this.Get_CompiledPr(false); // TODO: Сделать возможность показывать инструкцию var isHiddenCFPart = PRS.ComplexFields.isHiddenComplexFieldPart(); @@ -3831,6 +3833,8 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) let LetterLen = Item.GetWidth(); let isLigature = Item.IsLigature(); let GraphemeLen = isLigature ? Item.GetLigatureWidth() : LetterLen; + + let isBreakAfter = Item.IsSpaceAfter() || textPr.RFonts.Hint === AscWord.fonthint_EastAsia; if (FirstItemOnLine && (X + SpaceLen + WordLen + GraphemeLen > XEnd @@ -3951,12 +3955,12 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) } // Если текущий символ с переносом, например, дефис, тогда на нем заканчивается слово - if (Item.IsSpaceAfter() + if (isBreakAfter || (PRS.canPlaceAutoHyphenAfter(Item) && X + SpaceLen + LetterLen + PRS.getAutoHyphenWidth(Item, this) <= XEnd && (FirstItemOnLine || PRS.checkHyphenationZone(X + SpaceLen)))) { - if (!Item.IsSpaceAfter()) + if (!isBreakAfter) PRS.lastAutoHyphen = Item; // Добавляем длину пробелов до слова и ширину самого слова. @@ -3993,12 +3997,12 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) // Мы убираемся в пределах данной строки. Прибавляем ширину буквы к ширине слова WordLen += LetterLen; - if (Item.IsSpaceAfter() + if (isBreakAfter || (PRS.canPlaceAutoHyphenAfter(Item) && fitOnLine && (FirstItemOnLine || PRS.checkHyphenationZone(X + SpaceLen)))) { - if (!Item.IsSpaceAfter()) + if (!isBreakAfter) PRS.lastAutoHyphen = Item; // Добавляем длину пробелов до слова и ширину самого слова.