Bug 169168 - Extend custom letter spacing and glyph scaling for lines with multiple text portions (e.g. emphasized words, soft hyphen etc.)
Summary: Extend custom letter spacing and glyph scaling for lines with multiple text p...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:26.2.0
Keywords:
Depends on:
Blocks: Paragraph-Alignment
  Show dependency treegraph
 
Reported: 2025-10-31 10:58 UTC by László Németh
Modified: 2025-11-03 09:28 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
tdf169168.odt: test document (37.09 KB, application/vnd.oasis.opendocument.text)
2025-10-31 21:30 UTC, László Németh
Details
tdf169168.pdf: PDF layout in LibreOffice v7.3 (no custom letter spacing and glyph scaling) (48.52 KB, application/pdf)
2025-10-31 21:40 UTC, László Németh
Details
tdf169168_new.pdf: PDF layout in LibreOffice master (no custom letter spacing and glyph scaling in multiportion lines) (47.07 KB, application/pdf)
2025-10-31 21:42 UTC, László Németh
Details
tdf169168_newer.pdf: PDF layout in LibreOffice master (custom letter spacing and glyph scaling in multiportion lines) (47.74 KB, application/pdf)
2025-10-31 21:45 UTC, László Németh
Details
tdf169168_new_annotated.pdf: fixed problems (54.97 KB, application/pdf)
2025-11-03 09:28 UTC, László Németh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description László Németh 2025-10-31 10:58:09 UTC
Description:
As the continuation of the previous development, allow DTP-like justification features for text lines with multiple text portions.

Steps to Reproduce:
1. Open test documents of Bug 167648 and Bug 168251
2. Select a word in a line, which contains visible letter spacing/glyph scaling and underline it.

Actual Results:
Custom letter spacing and glyph scaling are disabled in that line.

Expected Results:
Custom letter spacing and glyph scaling are still enabled in that line.


Reproducible: Always


User Profile Reset: No

Additional Info:
See Bug 167648 and Bug 168251 for the original problems.
Comment 1 László Németh 2025-10-31 21:30:38 UTC
Created attachment 203646 [details]
tdf169168.odt: test document

Column 1: custom letter spacing

Column 2: custom glyph scaling

Column 3: combined custom letter spacing and glyph scaling

Paragraph 1 of the sections: single portion line

Paragraph 2 of the sections: multi-portion line
Comment 2 László Németh 2025-10-31 21:40:27 UTC
Created attachment 203647 [details]
tdf169168.pdf: PDF layout in LibreOffice v7.3 (no custom letter spacing and glyph scaling)
Comment 3 László Németh 2025-10-31 21:42:14 UTC
Created attachment 203648 [details]
tdf169168_new.pdf: PDF layout in LibreOffice master (no custom letter spacing and glyph scaling in multiportion lines)
Comment 4 László Németh 2025-10-31 21:45:25 UTC
Created attachment 203649 [details]
tdf169168_newer.pdf: PDF layout in LibreOffice master (custom letter spacing and glyph scaling in multiportion lines)

Other fixes: removed letter spacing at the end of the lines (including in single portion lines), fixing too small or missing word spacing.
Comment 5 Commit Notification 2025-11-01 08:47:44 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/97f97ba44e6af2be2e94ae26054b060b0303933a

tdf#169168 sw letter spacing: extend it for multiportion lines

It will be available in 26.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 6 László Németh 2025-11-01 08:48:20 UTC
Commit description:

tdf#169168 sw letter spacing: extend it for multiportion lines

Enable custom letter spacing and glyph scaling for multiportion
lines, i.e. lines with emphasized and underlined words, or
lines hyphenated automatically or with soft hyphen etc.

For this, width of the text portions are modified temporarily
according to the actual available blank space of the lines
at processing the last text portion. Depending on the filling
of the text line with text portions during line breaking, portion
width data are changed back and forth.

Note: Letter spacing and scaling data are stored in SwLineLayout
instead of SwTextPortion.

Other fixes and changes:

– itrcrsr.cxx: text cursor position follows the custom letter
  spacing and custom glyph scaling applied in the line;

– itradj.cxx: at letter spacing, the enlarged blank space is
  removed after the last letter in the line, fixing jittering
  of the right side of the lines.

– guess.cxx: fix crashing during typing before a terminating
  text portion;

– portxt.cxx: fix bad letter spacing, when the line contains
  zero width characters (soft hyphen, zero-width space etc.);

– testTdf168351: extend test document, because compression is not
  applied in the last line any more. Note: this is likely not a
  problem (in fact, it's the opposite, because filling the last
  line completely can destroy the clear separation of the paragraphs,
  especially without first line indent).

– testTdf168251 and testTdf168448: adjust the tests according to
  the fixed line breaking.
Comment 7 László Németh 2025-11-03 09:28:07 UTC
Created attachment 203698 [details]
tdf169168_new_annotated.pdf: fixed problems

1) enlarged letter spacing was applied at the end of the lines, too (yellow bar). 

2) there was no microtypography in lines with multiple text portions (blue circle). 

3) Where microtypography was enabled in multiportion lines by accident, the result was completely wrong (red box).