Bug 163720 - Smart justify: wrong justification of hyphen, which doesn't appear in exported PDF
Summary: Smart justify: wrong justification of hyphen, which doesn't appear in exporte...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL: https://ask.libreoffice.org/t/hyphena...
Whiteboard: target:25.2.0 target:24.8.4 target:24...
Keywords:
Depends on:
Blocks: DOCX-Paragraph Hyphenation
  Show dependency treegraph
 
Reported: 2024-11-01 16:09 UTC by Mike Kaganski
Modified: 2024-11-08 15:27 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
An Italian text with smart justification (2.75 KB, application/vnd.oasis.opendocument.text)
2024-11-01 16:09 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2024-11-01 16:09:39 UTC
Created attachment 197344 [details]
An Italian text with smart justification

Ref: https://ask.libreoffice.org/t/hyphenation-does-not-appear-in-pdf/39411/3

Prerequisite: Italian dictionaries (more specifically, hyphenation).
Open the attachment. In 24.8.2, and in current master, the first line has "così" hyphenated as "co-sì", with "sì" on the second line, and the dash outside of the right margin. This is wrong, because we don't support (yet) hanging punctuation at all, and this is just a manifestation of a bug.

Exporting the document to PDF makes the dash disappear from the PDF.
Comment 1 László Németh 2024-11-07 11:40:18 UTC
@Mike, RobotRabbitMan, Mrciccio84 (from https://ask.libreoffice.org/t/hyphenation-does-not-appear-in-pdf/39411) and all: thanks for the bug report and feedback! 

Proposed fix: https://gerrit.libreoffice.org/c/core/+/176207
Comment 2 László Németh 2024-11-07 12:13:57 UTC
More information: The problem resulted only with the transitional OOXML (now called as Word 2010–365 .docx) format, because this is the format, where MS Office uses its new space shrinking justification algorithm.

A possible workaround for LO 24.2 and later to save the document in Word 2007 format, but this means complete loss of the space shrinking interoperability, resulting different paragraph line count, page count etc., than in MSO 2010 and later (not mentioning the other possible differences in the layout).

Because the problem is related only to the single portion lines, it's easy to fix the problem by adding an extra line portion to the line. Likely because of storing the hidden editing metadata RFIDs in hidden text portions, you don't need to modify the format of the words (italic, underline, etc. or adding a text and format it as hidden text). It's enough to insert a soft hyphen in a neutral position, e.g. in the end of a word inside the line by pressing Ctrl+- or Insert->Formatting Mark->Soft Hyphen. Definitely this workaround is not comfortable for longer text, so the suggested solution is updating for the next bug fix release of LO 24.8, which will contain the solution.
Comment 3 Commit Notification 2024-11-07 19:35:51 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/42533c94ec1a52c49b2587e53ab55e67fc4a449a

tdf#163720 sw smart justify: fix hyphenated single portion lines

It will be available in 25.2.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.
Comment 4 László Németh 2024-11-07 19:37:38 UTC
Commit description:

tdf#163720 sw smart justify: fix hyphenated single portion lines

Hyphen length wasn't calculated in single portion lines at shrinking,
because the width of the overhanging line without the hyphen overwrote
the calculated correct line width. This resulted less shrinking, than
needed, also lost hyphen in the PDF export.

Regression from commit 22eac3145ca62d15b47d95f4df60ce38d4f5aa46
"tdf#162220 sw smart justify: fix shrinking for single portion lines".

Follow-up to commit 17eaebee279772b6062ae3448012133897fc71bb
"tdf#119908 sw smart justify: fix justification by shrinking".
Comment 5 Commit Notification 2024-11-08 11:20:29 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/42d76a89f2730626446cc3bc85cbbaab49bbcb9d

tdf#163720 sw smart justify: fix hyphenated single portion lines

It will be available in 24.8.4.

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.
Comment 6 Commit Notification 2024-11-08 15:27:13 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-24-8-3":

https://git.libreoffice.org/core/commit/0ebce798ecd07e86a25aa8b8023dbd3174c3335d

tdf#163720 sw smart justify: fix hyphenated single portion lines

It will be available in 24.8.3.

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.