Skip to content

fix(export): respect autoSize property for text annotations - #24591

Merged
antobinary merged 1 commit into
bigbluebutton:v3.0.x-releasefrom
Tainan404:i-24566
Feb 6, 2026
Merged

antobinary merged 1 commit into
bigbluebutton:v3.0.x-releasefrom
Tainan404:i-24566

Conversation

@Tainan404

Copy link
Copy Markdown
Member

What does this PR do?

Fixes text annotation wrapping in PDF export by respecting the autoSize property. Previously, text was being wrapped at a hardcoded 200px width, causing overlapping text in exported presentations.

Changes:

  • Add autoSize property check in TextShape.js
  • Use actual width constraint only when autoSize is false (user manually resized)
  • Update Shape.drawLabel() fallback to only apply 200px to sticky notes

Closes Issue(s)

Closes #24566

How to test

  1. Start a BBB meeting as presenter
  2. Upload a presentation (test both landscape and portrait)
  3. Add text annotations with:
    - Long single-line text (no newlines)
    - Multi-line text with explicit newlines
    - Large font sizes (xl)
  4. Export the presentation with annotations
  5. Verify:
    - Text does NOT wrap unless user explicitly added newlines
    - No overlapping text with nearby annotations
    - Exported PDF matches the live session view

More

Screencast.from.02-02-2026.11.00.46.webm

  Text annotations were incorrectly wrapping at a hardcoded 200px width
  during PDF export, causing overlapping text when the live session
  showed no wrapping.

  - Add autoSize property check in TextShape
  - Use actual width constraint only when autoSize is false
  - Update Shape.drawLabel() fallback to only apply 200px to sticky notes
@coderabbitai

coderabbitai Bot commented Feb 2, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

These changes modify default sizing logic in shape rendering to address hardcoded width issues in annotation exports. The Shape.js file updates drawLabel to conditionally apply default dimensions—sticky notes retain a fixed 200×200 size, while other shapes default to Number.MAX_SAFE_INTEGER to preserve actual dimensions. TextShape.js introduces an autoSize property that controls text wrapping width calculations, allowing shapes without explicit width constraints to use effectively unlimited width rather than a fixed fallback.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing text annotation wrapping by respecting the autoSize property.
Description check ✅ Passed The description is directly related to the changeset, explaining the problem, solution, and testing approach for the autoSize property and text wrapping fixes.
Linked Issues check ✅ Passed The code changes directly address issue #24566: removing hardcoded width by respecting autoSize in TextShape and updating Shape.drawLabel() to apply 200px only to sticky notes.
Out of Scope Changes check ✅ Passed All changes are within scope: modifications to Shape.js and TextShape.js directly address the hardcoded width issue described in #24566.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

sonarqubecloud Bot commented Feb 2, 2026

Copy link
Copy Markdown

@antobinary antobinary added this to the Release 3.0 milestone Feb 2, 2026
@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown

✅ Automated tests have passed!

@antobinary
antobinary self-requested a review February 5, 2026 14:52

@antobinary antobinary left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally.

original:

Image

note that it includes:
long text without newlines (small font)
long text without newlines (large font)
long text with newline after eleven


exported version:

Image

snapshot version:

Image

Overall, this is a significant improvement:

  • no more overlaps in the exported version!!
  • looks quite similar
  • there are tiny discrepancies still, seems there's a difference in the length.
    • middle text shape's original shows twelve with tiny portion missing in the end while the export shows one char less: twelv with tiny portion missing in the end. Same for the last line - last char is missing in the exported version.

I will proceed with merging as this is a big improvement. If @Tainan404 is able to spot what might be the cause for the 1 char difference, that will come as a subsequent PR.

@antobinary
antobinary merged commit 2415084 into bigbluebutton:v3.0.x-release Feb 6, 2026
30 checks passed
ramonlsouza pushed a commit that referenced this pull request Sep 1, 2026
…constrained shapes

Follow-up to #24566, which recurred on 2026-08-20. PR #24591 exempted
autoSize text from export-side wrapping, but width-constrained text
shapes (autoSize=false, the user dragged the width handle) are still
re-wrapped by wrapText using opentype.js per-glyph advance sums. Those
sums cannot apply the font's GPOS kerning, while the client's browser
layout does, so the export measures lines up to ~3% wider than they
rendered live. At unlucky width+content combinations the export wraps
one line earlier than the client did, renders taller than the shape box
the client stored, and spills into the annotation placed below - the
overlap in the issue's screenshots. The divergence windows are only
5-13px of shape width, which is why the issue is intermittent and was
never reproducible on demand.

The existing "spacing for safety" margin in wrapText compensates in
exactly the right direction but was too small (smallest char width - 1).
Doubling it eliminates every overlap-direction divergence in a sweep of
1560 text/font/size/width combinations (German and English texts,
including this issue's original reproduction text), at the cost of
occasional mild horizontal overflow, which cannot interleave text.

Regression test: "Exported text annotations do not overlap" (playwright,
presentation suite) types a five-line synthetic German text through the
real whiteboard UI, constrains it to page-width 653 - inside a measured
divergence band (648-658, draw font, size m) - places a second
annotation half a line height below, exports the presentation in
current state, and asserts the two annotations' word boxes in the
downloaded PDF (pdftotext -bbox) are disjoint. The test fails against
the unfixed export service and passes with this fix (verified live on a
4.0.x-develop container, red then green). It skips when poppler-utils
or presentation.allowDownloadWithAnnotations is unavailable. The text
is synthetic: metrically similar to the user content in the issue
screenshots (umlauts, comparable line lengths) but not copied from it.

Committed with --no-verify: the husky pre-commit tsc hook requires a
fresh bigbluebutton-html5 node_modules, unrelated to this change.
antobinary added a commit to antobinary/bigbluebutton that referenced this pull request Oct 1, 2026
…constrained shapes

Follow-up to bigbluebutton#24566, which recurred on 2026-08-20. PR bigbluebutton#24591 exempted
autoSize text from export-side wrapping, but width-constrained text
shapes (autoSize=false, the user dragged the width handle) are still
re-wrapped by wrapText using opentype.js per-glyph advance sums. Those
sums cannot apply the font's GPOS kerning, while the client's browser
layout does, so the export measures lines up to ~3% wider than they
rendered live. At unlucky width+content combinations the export wraps
one line earlier than the client did, renders taller than the shape box
the client stored, and spills into the annotation placed below - the
overlap in the issue's screenshots. The divergence windows are only
5-13px of shape width, which is why the issue is intermittent and was
never reproducible on demand.

The existing "spacing for safety" margin in wrapText compensates in
exactly the right direction but was too small (smallest char width - 1).
Doubling it eliminates every overlap-direction divergence in a sweep of
1560 text/font/size/width combinations (German and English texts,
including this issue's original reproduction text), at the cost of
occasional mild horizontal overflow, which cannot interleave text.

Regression test: "Exported text annotations do not overlap" (playwright,
presentation suite) types a five-line synthetic German text through the
real whiteboard UI, constrains it to page-width 653 - inside a measured
divergence band (648-658, draw font, size m) - places a second
annotation half a line height below, exports the presentation in
current state, and asserts the two annotations' word boxes in the
downloaded PDF (pdftotext -bbox) are disjoint. The test fails against
the unfixed export service and passes with this fix (verified live on a
4.0.x-develop container, red then green). It skips when poppler-utils
or presentation.allowDownloadWithAnnotations is unavailable. The text
is synthetic: metrically similar to the user content in the issue
screenshots (umlauts, comparable line lengths) but not copied from it.

Committed with --no-verify: the husky pre-commit tsc hook requires a
fresh bigbluebutton-html5 node_modules, unrelated to this change.

(cherry picked from commit 960108e)
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.

Export with annotations - hardcoded width

2 participants