Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 2, 2025

Problem

BPMN diagrams often contain inconsistent LabelStyles configurations where some shapes define custom fonts while others don't, leading to visual inconsistency in the rendered diagram. This was particularly problematic for users wanting consistent font rendering across their BPMN visualizations.

Solution

This PR introduces the ignoreBpmnLabelStyles option that allows users to ignore font configurations defined in BPMN LabelStyles, ensuring consistent font rendering across the entire diagram.

Configuration

The option is configured at library initialization via RendererOptions:

const bpmnVisualization = new BpmnVisualization({
  container: 'container',
  renderer: { ignoreBpmnLabelStyles: true }
});

Demo Page Testing

For testing purposes, the option can also be enabled in demo pages using a query parameter:

https://example.com/demo?renderer.ignore.label.style=true

Behavioral Changes

  • When false (default): Preserves existing behavior, respecting all font styles from BPMN LabelStyles
  • When true: Ignores font family, size, and style (bold/italic/underline/strikethrough) from BPMN LabelStyles, using the library's default theme fonts instead

Example Use Case

Consider a BPMN diagram with mixed font definitions:

  • Start Event: Uses Arial 12pt
  • Task 1: Uses Arial 14pt Bold
  • Task 2: Uses Times New Roman 16pt Italic
  • End Event: No font defined (uses default)

With ignoreBpmnLabelStyles: true, all elements will use consistent default theme fonts, eliminating visual inconsistency.

Implementation Details

  • Modified StyleComputer to accept the new option and conditionally apply font styles
  • Option is configured only at the renderer level for consistency with other renderer options
  • Simple, predictable API that maintains consistency with existing patterns
  • Added query parameter support in demo pages for testing (renderer.ignore.label.style)
  • Refactored renderer parameter handling to eliminate code duplication and improve maintainability

Testing

  • Added 15 comprehensive unit tests covering renderer-level configuration scenarios
  • Tests verify font style behavior with different option values
  • All existing tests continue to pass (3,060 unit + 308 integration tests)
  • Demo pages can be used to manually test the feature with query parameters

Backward Compatibility

This change is fully backward compatible. The new option defaults to false, preserving existing behavior for all current users while providing the new functionality for those who need it.

Fixes #555, #869, and addresses requirements from #1993 and #2659.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@CLAassistant
Copy link

CLAassistant commented Oct 2, 2025

CLA assistant check
All committers have signed the CLA.

@tbouffard tbouffard changed the title [WIP] [FEAT] Provide an option to ignore BPMN LabelStyles feat: provide an option to ignore BPMN LabelStyles [WIP] Oct 2, 2025
Co-authored-by: tbouffard <27200110+tbouffard@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Oct 2, 2025

🎊 PR Preview b761cad has been successfully built and deployed to https://process-analytics-bpmn-visualization-js-doc_preview-pr-3386.surge.sh

🕐 Build time: 0.011s

🤖 By surge-preview

@github-actions
Copy link

github-actions bot commented Oct 2, 2025

🎊 PR Preview b761cad has been successfully built and deployed to https://process-analytics-bpmn-visualization-js-demo_preview-pr-3386.surge.sh

🕐 Build time: 0.01s

🤖 By surge-preview

Copilot AI changed the title feat: provide an option to ignore BPMN LabelStyles [WIP] [FEAT] Provide an option to ignore BPMN LabelStyles Oct 2, 2025
Copilot AI requested a review from tbouffard October 2, 2025 08:59
Co-authored-by: tbouffard <27200110+tbouffard@users.noreply.github.com>
@tbouffard tbouffard changed the title [FEAT] Provide an option to ignore BPMN LabelStyles feat: provide an option to ignore BPMN LabelStyles Oct 2, 2025
@tbouffard tbouffard changed the title feat: provide an option to ignore BPMN LabelStyles feat: add an option to ignore BPMN LabelStyles Oct 2, 2025
@tbouffard
Copy link
Member

@copilot New requirement, in the test/demo pages, manage a new query parameter to ignore label styles.
This is done in dev/ts/shared/main.ts, use a parameter like renderer.ignore.label.style
Proceed as existing parameter, like for renderer.ignore.bpmn.colors

Co-authored-by: tbouffard <27200110+tbouffard@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 2, 2025

@copilot New requirement, in the test/demo pages, manage a new query parameter to ignore label styles.
This is done in dev/ts/shared/main.ts, use a parameter like renderer.ignore.label.style
Procee...

Added support for the renderer.ignore.label.style query parameter in the demo pages. The parameter works the same way as renderer.ignore.bpmn.colors - when set to true, it will ignore BPMN label styles for consistent font rendering. Updated in commit 07bb9c2.

Copilot AI requested a review from tbouffard October 2, 2025 10:05
Co-authored-by: tbouffard <27200110+tbouffard@users.noreply.github.com>
Copilot AI requested a review from tbouffard October 3, 2025 07:55
@tbouffard
Copy link
Member

ℹ️ implementation seems ok, but the e2e tests running on macos Firefox are failing; this is not due to changes in this PR.
I am going to fix this problem first, then when the e2e tests pass we will be able to mere this PR

@tbouffard tbouffard added enhancement New feature or request BPMN rendering Something about the way the lib is rendering BPMN elements labels Oct 4, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 6, 2025

@tbouffard
Copy link
Member

Screenshots

Compare rendering of ignored/not_ignored label styles with the test/fixtures/bpmn/bpmn-rendering/labels.04.fonts.bpmn file.

not ignored ignored
do not ignore label styles ignore label styles

@tbouffard tbouffard marked this pull request as ready for review October 6, 2025 10:09
Copy link
Member

@tbouffard tbouffard left a comment

Choose a reason for hiding this comment

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

LGTM

@tbouffard tbouffard merged commit 4cbe851 into master Oct 6, 2025
1 check passed
@tbouffard tbouffard deleted the copilot/fix-be48e1f3-ff42-4970-9438-323770bd65d3 branch October 6, 2025 13:22
@tbouffard tbouffard linked an issue Oct 6, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BPMN rendering Something about the way the lib is rendering BPMN elements enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Provide an option to ignore BPMN LabelStyles

3 participants