Skip to content

Conversation

@Vansh0204
Copy link

@Vansh0204 Vansh0204 commented Nov 25, 2025

PR 1

  • Adds textAlign(JUSTIFIED) support in the 2D renderer for bounded text(...) .
  • Distributes inter-word spacing to fill maxWidth on non-final lines; final line remains ragged.
  • Canvas2D maps JUSTIFIED to LEFT internally; WEBGL remains left-aligned for now.
  • Lint/build pass locally. Follow-up PR will add textWrap(PRETTY) and BALANCE .

Addresses #7712

…erer

- Justifies non-final lines in bounded text()
- Keeps final line ragged
- Maps Canvas2D textAlign to LEFT when JUSTIFIED is set
- WEBGL remains left-aligned for now

Refs processing#7712
@Vansh0204 Vansh0204 force-pushed the feat/justified-align-pr1 branch from 96200c1 to 05aa09a Compare November 27, 2025 18:23
@dhowe
Copy link
Contributor

dhowe commented Nov 27, 2025

@Vansh0204 have you created tests for this feature?

@Vansh0204
Copy link
Author

Thanks for reviewing, sir! I haven't added tests yet – I'll add comprehensive unit tests for JUSTIFIED alignment in the 2D renderer covering inter-word spacing distribution and edge cases. I'll push them shortly.

@dhowe
Copy link
Contributor

dhowe commented Nov 28, 2025

a good place to start would be the alignment tests in https://github.com/processing/p5.js/blob/dev-2.0/test/manual-test-examples/type/index.html

image

eventually we will also need pixel-based tests like those here: https://github.com/processing/p5.js/blob/dev-2.0/test/unit/visual/cases/typography.js

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.

2 participants