Bug 132599 - Option to stop words hyphenating across pages
Summary: Option to stop words hyphenating across pages
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: László Németh
URL:
Whiteboard: target:24.8.0
Keywords:
Depends on:
Blocks: Hyphenation 160518
  Show dependency treegraph
 
Reported: 2020-05-01 19:14 UTC by R. Green
Modified: 2024-04-11 15:43 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
LibreOffice doc. showing inter-pahe hyphens (24.24 KB, application/vnd.oasis.opendocument.text)
2020-05-01 19:14 UTC, R. Green
Details
unit test document (fo:hyphenate-keep="page") (5.46 KB, application/vnd.oasis.opendocument.text-flat-xml)
2024-02-29 14:31 UTC, László Németh
Details
unit test document (fo:hyphenate-keep="auto") (5.46 KB, application/vnd.oasis.opendocument.text-flat-xml)
2024-02-29 14:32 UTC, László Németh
Details
screenshot of new option “Hyphenate across column and page” (186.61 KB, image/png)
2024-03-05 09:20 UTC, László Németh
Details
screenshot of new options “Hyphenate across” (84.74 KB, image/png)
2024-04-11 08:30 UTC, László Németh
Details
test document (spread, right page) (25.75 KB, application/vnd.oasis.opendocument.text-flat-xml)
2024-04-11 08:32 UTC, László Németh
Details
test document (spread, left page) (27.11 KB, application/vnd.oasis.opendocument.text-flat-xml)
2024-04-11 08:33 UTC, László Németh
Details
test document (column) (20.61 KB, application/vnd.oasis.opendocument.text-flat-xml)
2024-04-11 08:33 UTC, László Németh
Details
test document (page, in not last column) (20.61 KB, application/vnd.oasis.opendocument.text-flat-xml)
2024-04-11 08:34 UTC, László Németh
Details
test document (page, in last column) (21.33 KB, application/vnd.oasis.opendocument.text-flat-xml)
2024-04-11 08:34 UTC, László Németh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description R. Green 2020-05-01 19:14:22 UTC
Created attachment 160198 [details]
LibreOffice doc. showing inter-pahe hyphens

If Hyphenation is set to "Automatically" (in Paragraph Style > Text Flow), there is a problem with words hyphenating from one page to another.

According to New Harts Rules (OUP, 2005, "Line Endings", p. 40), a recto (right-hand) page should not end with a hyphen (probably the same rule in the Chicago Manual of Style). This rule obviously applies to hard copy in  book format; but for PC documents it also makes sense to apply the restriction on hyphenation to "verso" (left-hand) pages.

For example, open the attached document. Look at the hyphenation from pp. 1-2, and 5-6. This is awkward to read. In a long document, you have to turn off hyphenation for each hyphenated "inter-page" word : this is time-consuming, and a document update may require you to do the whole thing over again.

SUGGESTION: Add two tick-box options to the Paragraph Style > Text Flow TAB:

1. Don't hyphenate words from recto to verso pages.
2. Don't hyphenate words across any pages.

Instead of hypenation, the last word will be moved, automatically, to the next page.
Comment 1 Ming Hua 2020-05-02 15:52:04 UTC
Reproduced the inter-page hyphenation with attached example in 6.4.4 RC1 on Windows.

The enchancement request sounds very reasonable, setting to NEW.
Comment 2 László Németh 2022-06-06 15:02:42 UTC
It seems, this is also an interoperability problem, too:


https://docs.microsoft.com/en-us/openspecs/office_standards/ms-docx/e0c0663e-a5e7-4a44-8360-b0b5df1f43e6
Comment 3 László Németh 2023-05-23 09:25:06 UTC
Also it's part of the OpenDocument standard, as fo:hyphenation-keep, but not implemented by LibreOffice yet: 

https://ask.libreoffice.org/t/in-writer-is-there-a-setting-to-allow-hyphenation-but-restrict-hyphens-across-pages/49622
Comment 4 László Németh 2024-02-29 14:31:37 UTC
Created attachment 192862 [details]
unit test document (fo:hyphenate-keep="page")

Typeset bottom hyphenated line on the next page, resulting 3-page document.
Comment 5 László Németh 2024-02-29 14:32:18 UTC
Created attachment 192863 [details]
unit test document (fo:hyphenate-keep="auto")

Typeset bottom hyphenated line on the first page, resulting 2-page document.
Comment 6 Commit Notification 2024-03-04 22:40:04 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9574a62add8e4901405e12117e75c86c2d2c2f21

tdf#132599 cui offapi sw xmloff: implement hyphenate-keep

It will be available in 24.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.
Comment 7 László Németh 2024-03-05 08:33:57 UTC
Commit description:

tdf#132599 cui offapi sw xmloff: implement hyphenate-keep

Both parts of a hyphenated word shall lie within a single
page with ODF paragraph setting fo:hyphenation-keep="page".
The implementation follows the default page layout of
MSO 2016 and newer by shifting the bottom hyphenated line
to the next page (and to the next column, see last note).

Note: this is a MSO DOCX interoperability feature, used
also in DTP software, XSL and CSS.

* Add checkbox/combobox to Text Flow in paragraph dialog
* Store property in paragraph model (com::sun::star::style::ParagraphProperties::ParaHyphenationKeep)
* Add ODF import/export
* Add ODF unit tests

New constants of com::sun::star::text::ParagraphHyphenationKeepType,
containing ODF AUTO and PAGE (borrowed from XSL), and for the
planned extension ParaHyphenationKeepType of ParagraphProperties:

– COLUMN (standard XSL value, defined in
  https://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#hyphenation-keep)

– SPREAD and ALWAYS (CSS 4 values of hyphenate-limit-last,
  equivalent of hyphenation-keep, defined in
  https://www.w3.org/TR/css-text-4/#hyphenate-line-limits).

Note: the implementation truncates only a single hyphenated
line, like MSO does: the pages can end in hyphenated
lines (i.e. in the case of consecutive hyphenated lines),
but less often, than before.

Clean-up hyphenation dialog by collecting "Don't hyphenate"
options at the end of the hyphenation settings, and negating them
(similar to MSO and DTP), adding also the new option
"Hyphenate across column and page":

[x] Hyphenate words in CAPS
[x] Hyphenate last word
[x] Hyphenate across column and page

Note: ODF fo:hyphenation-keep has got only "auto" and
"page" attributes, while XSL defines also "column".
Because of the interoperability with MSO and DTP,
fo:hyphenation-keep="page" is interpreted as
XSL "column", avoiding hyphenation at the end
of column, not only at the end of page.
Comment 8 László Németh 2024-03-05 09:20:17 UTC
Created attachment 192959 [details]
screenshot of new option “Hyphenate across column and page”
Comment 9 Commit Notification 2024-04-11 08:21:18 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6e8819f29b6051a0e551d77512830539913ec277

tdf#132599 cui offapi sw xmloff: add hyphenation-keep-type

It will be available in 24.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.
Comment 10 László Németh 2024-04-11 08:24:20 UTC
Commit description:

tdf#132599 cui offapi sw xmloff: add hyphenation-keep-type

Support XSL attribute "column" and CSS 4 attribute "spread",
stored in loext:hyphenation-keep-type, to give better control
over hyphenation-keep. E.g. spread: both parts of a hyphenated
word shall lie within a single spread, i.e. when the next page
is not visible at the same time (e.g. the next page is not a
right page of a book).

– css::style::ParaHyphenationKeep is a boolean property now,
  importing hyphenation-keep = "page" as true.

– type of ParaHyphenationKeep, including the new non-ODF types
  is stored in the new ParagraphProperties::ParaHyphenationKeepType.

– default value of ParaHyphenationKeepType is COLUMN for
  interoperability.

– Add checkboxes to Text Flow -> Hyphenation Across in
  paragraph dialog:

  * Column (previously: Hyphenate across column and page)
  * Page
  * Spread

  – enabling/disabling them follows XSL/CSS 4/loext, i.e.
    possible combinations:

  * No Hyphenation across
    (hyphenation-keep = "page" and loext:hyphenation-keep-type = "column")

  * Hyphenation across [x] Column
    (hyphenation-keep = "page" and loext:hyphenation-keep-type = "page")

  * Hyphenation across [x] Column [x] Page
    (hyphenation-keep = "page" and loext:hyphenation-keep-type = "spread")

  * Hyphenation across [x] Column [x] Page [x] Spread
    (hyphenation-keep = "auto")

– Add ODF import/export

– Update DOCX import

– Add ODF unit tests

Note: recent implementation depends on widow settings: disabling widow
handling allows hyphenation across columns and pages not only in table
cells.

Note: RTF import-only, but not used bPageEnd has been renamed to bKeep.
Depending on the RTF test results, likely it will need to disable
the layout change, e.g. GetKeepType()=ParagraphHyphenationKeepType::AUTO,
if PageEnd uses obsolete hyphenation rule, i.e. shifting only the
hyphenated word to the next page, not the full line.

More information:

– COLUMN (standard XSL value, defined in
  https://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#hyphenation-keep)

– SPREAD and ALWAYS (CSS 4 values of hyphenate-limit-last,
  equivalent of hyphenation-keep, defined in
  https://www.w3.org/TR/css-text-4/#hyphenate-line-limits).

Follow-up to commit 9574a62add8e4901405e12117e75c86c2d2c2f21
"tdf#132599 cui offapi sw xmloff: implement hyphenate-keep" and
commit c8ee0e8f581b8a6e41b1a6b8aa4d40b442c1d463
"tdf160518 DOCX: import hyphenation-keep to fix layout".
Comment 11 László Németh 2024-04-11 08:30:51 UTC
Created attachment 193611 [details]
screenshot of new options “Hyphenate across”
Comment 12 László Németh 2024-04-11 08:32:58 UTC
Created attachment 193612 [details]
test document (spread, right page)
Comment 13 László Németh 2024-04-11 08:33:20 UTC
Created attachment 193613 [details]
test document (spread, left page)
Comment 14 László Németh 2024-04-11 08:33:36 UTC
Created attachment 193614 [details]
test document (column)
Comment 15 László Németh 2024-04-11 08:34:14 UTC
Created attachment 193615 [details]
test document (page, in not last column)
Comment 16 László Németh 2024-04-11 08:34:33 UTC
Created attachment 193616 [details]
test document (page, in last column)
Comment 17 Commit Notification 2024-04-11 15:43:22 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/58350a811a8001f72b13f6ca3def5f32ea904e72

tdf#132599 add "Hyphenation across" options