Description: 1. Even if Paragraph Style > Asian Typography > Apply list of forbidden characters is unticked, the list of forbidden characters (set in Tools > Options > Languages and Locales > Asian Layout) is always applied. 2. The bug persists even if the list of forbidden characters is edited to remove offending characters. 3. Documents that work in LibreOffice 24.2 are affected in 25.8 (versions between haven't been tested). Steps to Reproduce: 1. Create an A4 Writer document. 2. Enable Asian Typography via Tools > Options > Languages and Locales > General > tick checkbox for "Asian" beneath "Default Languages for Documents", and select "Chinese (traditional) from the dropdown menu. 3. Set font size of paragraph style to 14pt and page margins to "normal". 4. Edit paragraph style > Asian Typography > untick "Allow hanging punctuation", but leave "Apply list of forbidden characters to the beginning and end of lines" on. (VERY IMPORTANT: "Allow hanging punctuation" MUST be unticked, or Writer will allow punctuation marks to trail into the margins, ruining the effects described below.) 5. Paste the following text: 茲鑒於人類一家,對於人人固有尊嚴及其平等不移權利之承認確係世界自由、正義與和平之基礎;復鑒於人權之忽視及侮蔑恆釀成野蠻暴行,致使人心震憤,而自由言論、自由信仰、得免憂懼、得免貧困之世界業經宣示為一般人民之最高企望 6. At the start of line three, there should be the glyph "憤" followed by a fullwidth comma ",". In addition, a gap is observed at the end of line 2, suggesting that the "憤" glyph has been moved to the start of line 3 in order to prevent a leading comma. 7. Edit paragraph style > Asian Typography > untick "Apply list of forbidden characters to the beginning and end of lines". 8. The phenomenon described in 6. is still observed. 9. Tools > Options > Languages and Locales > Asian Layout > under "first and last characters", uncheck the "default" checkbox following the dropdown menu, and delete all content in "Not at start of line". This is the list of forbidden characters described in the dialog of paragraph styles. 10. The phenomenon described in 6. is still observed. To bring back the default list of forbidden characters, check "default", switch languages in the dropdown menu, and switch back again. Actual Results: The phenomenon described in 6. is always observed, regardless of the settings. Expected Results: In both 8. and 10., the glyph "憤" on the start of line 3 should jump back to the end of line 2, filling the gap, leaving the fullwidth comma "," as a leading comma. Reproducible: Always User Profile Reset: Yes Additional Info: Version: 25.8.3.2 (X86_64) Build ID: 8ca8d55c161d602844f5428fa4b58097424e324e CPU threads: 8; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Raster; VCL: win Locale: zh-TW (zh_TW); UI: en-US Calc: threaded Additional information: - Bug not tested on versions between 24.2 and 25.8.3 - Bug not tested on operating systems other than Windows 11 24H2 and Windows 11 25H2
Created attachment 204161 [details] Demonstration of the bug, with styles set.
reproduce Version: 25.8.3.2 (X86_64) Build ID: 8ca8d55c161d602844f5428fa4b58097424e324e CPU threads: 4; OS: Linux 6.12; UI render: default; VCL: gtk3 Locale: ja-JP (ja_JP.UTF-8); UI: en-US Calc: threaded and in Version: 25.2.7.2 (X86_64) / LibreOffice Community Build ID: 5cbfd1ab6520636bb5f7b99185aa69bd7456825d CPU threads: 8; OS: Windows 11 X86_64 (10.0 build 26200); UI render: Skia/Vulkan; VCL: win Locale: ja-JP (ja_JP); UI: ja-JP Calc: CL threaded not in Version: 24.8.7.2 (X86_64) / LibreOffice Community Build ID: e07d0a63a46349d29051da79b1fde8160bab2a89 CPU threads: 8; OS: Windows 11 X86_64 (10.0 build 26200); UI render: Skia/Vulkan; VCL: win Locale: ja-JP (ja_JP); UI: ja-JP Calc: CL threaded similar issue https://ask.libreoffice.org/t/topic/130797 bibisected with win64-25.8 commit 5a03d511f46ecc05aab35bb29e714b46f5638b1b author Jonathan Clark tdf#130592 i18npool: Fix incorrect line breaking in mixed CJK+Latin *** adding CC: Jonathan Clark Please, take a look?
diff --git a/i18npool/source/breakiterator/breakiterator_cjk.cxx b/i18npool/source/breakiterator/breakiterator_cjk.cxx index f9b1b7e46199..a6b7fff28b0f 100644 --- a/i18npool/source/breakiterator/breakiterator_cjk.cxx +++ b/i18npool/source/breakiterator/breakiterator_cjk.cxx @@ -108,6 +108,13 @@ LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak( // tdf#130592: Fall back to the ICU breakiterator after applying CJK-specific rules auto stBreak = BreakIterator_Unicode::getLineBreak(Text, nStartPos, rLocale, nMinBreakPos, hOptions, bOptions); + if (!bOptions.applyForbiddenRules && stBreak.breakIndex < nStartPos) + { + stBreak.breakIndex = nStartPos; + stBreak.breakType = BreakType::WORDBOUNDARY; + return stBreak; + } + if (stBreak.breakIndex == nStartPos) { // Located break is valid under both iterators @@ -116,7 +123,7 @@ LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak( // CJK break is not valid; restart search from the next candidate sal_Int32 nNextCandidate = stBreak.breakIndex; - while (bOptions.allowPunctuationOutsideMargin && nStartPos > stBreak.breakIndex) + while (!bOptions.allowPunctuationOutsideMargin && nStartPos > stBreak.breakIndex) { if (hangingCharacters.indexOf(Text[nStartPos]) != -1) {
https://gerrit.libreoffice.org/c/core/+/198442
Saburo Yoshida committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/b643c5c0ace3af80e2126a05f4df366d4a3166b3 tdf#169590 i18npool: Fix incorrect line breaking in CJK It will be available in 26.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Saburo Yoshida committed a patch related to this issue. It has been pushed to "libreoffice-25-8": https://git.libreoffice.org/core/commit/02fb87b389f0a4db74b149c790ea1b83af177dd4 tdf#169590 i18npool: Fix incorrect line breaking in CJK It will be available in 25.8.6. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Saburo Yoshida committed a patch related to this issue. It has been pushed to "libreoffice-26-2": https://git.libreoffice.org/core/commit/2af7e0aa417bbb83a2180d581f153f09dc95ac82 tdf#169590 i18npool: Fix incorrect line breaking in CJK It will be available in 26.2.1. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.