Skip to content

Dev3 pptx text wrap fix - kept updated - #267

Open
hiroshisuga wants to merge 15 commits into
v3.0.x-releasefrom
dev3_pptx_fontwrap_updating
Open

Dev3 pptx text wrap fix - kept updated#267
hiroshisuga wants to merge 15 commits into
v3.0.x-releasefrom
dev3_pptx_fontwrap_updating

Conversation

@hiroshisuga

@hiroshisuga hiroshisuga commented Jul 18, 2026

Copy link
Copy Markdown
Owner

What does this PR do?

This PR adds a pre-processing step of PPTX conversion to fix three textbox problems that break the layout of slides.

Closes Issue(s)

Closes #

Motivation

Problems addressed here are:

  1. Incorrect wrapping in auto-fit text boxes
    LibreOffice sometimes did not recalculate text boxes configured to resize to fit their contents during headless PPTX-to-PDF conversion. As a result, text that should remain on one line was wrapped unnecessarily.
  2. Incorrect indentation of wrapped bullet lines
    Some PPTX files omit explicit marL and indent values for bullet paragraphs. PowerPoint and LibreOffice interpret these omitted values differently, causing wrapped bullet lines to start at the wrong horizontal position and changing line breaks. This typically happens when a user convert an old ppt file to pptx. I have not encountered it when working on a pptx from the beginning. But it may happen also in other cases (like copying an old slide to a pptx file) because omitting these settings is not banned in the OOXML format.
  3. Extra spacing between Asian and Western characters
    LibreOffice could insert additional spacing between Japanese (and perhaps other Asian) text and Latin letters or numbers. This increased the effective text width and sometimes caused additional line wrapping.

Solution: a PPTX-specific conversion step was added before PDF export as follows:

  1. For non-wrapping auto-fit text boxes, the Resize shape to fit text property is temporarily disabled and re-enabled through UNO, forcing LibreOffice to recalculate the text-box geometry before PDF export.
  2. Locally resolvable bullet indentation values are made explicit in the PPTX XML before LibreOffice opens the file.
  3. LibreOffice’s ParaIsCharacterDistance option is disabled to avoid unwanted spacing between Asian and Western characters.

These corrections are applied before exporting the presentation from the same in-memory LibreOffice document.

You can omit this pre-processing by adding options as indicated as the comment in run-pptx-fixes-in-container.sh.

This PR could also be applied after the PPTX animation expansion (PR bigbluebutton#25422). The merged PR sample is #269.

How to test

sample.pptx

sample_preprocess.pdf

sample_nopreprocess.pdf

The problem 1 and 2 happen also in Latin text presentation.
english_bullet_implicit_indent_example_final.pptx

More

LibreOfficeでは文字位置がわずかに下がる現象も確認。現在のところ原因不明。アンダーラインの有無は関係なさそう。
underline.pptx

Posted as an issue bigbluebutton#25462 and a PR bigbluebutton#25463.

[Additional problem and its solution - removing the trailing spaces] 27 July 2026
Problem: PowerPoint ignores trailing normal or full-width spaces when calculating line wrapping, but LibreOffice may include them in the line width. As a result, text that fits on one line in PowerPoint can wrap onto a second line in LibreOffice.
Solution: Trim trailing normal spaces (U+0020) and full-width spaces (U+3000) from each DrawingML paragraph before opening the PPTX in LibreOffice. The existing bullet indentation normalization remains unchanged and runs independently.
Example pptx:
ICT2.pptx
ICT.pptx

@hiroshisuga hiroshisuga changed the title Dev3 pptx fontwrap updating Dev3 pptx text wrap fix - kept updated Jul 18, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

🚨 Automated tests failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant