Skip to content

Conversation

perminder-17
Copy link
Collaborator

@perminder-17 perminder-17 commented Sep 12, 2025

Resolves #8079

@perminder-17 perminder-17 changed the title fixing-issue textToContours is broken under textAlign(CENTER,CENTER) and use linebreak Sep 12, 2025
Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

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

This looks great Perminder! Just left some very minor code format comments, otherwise good to go 🙂

);
// When width is not provided (e.g., fontBounds path), fall back to the widest line.
const maxWidth = boxes.length
? boxes.reduce((m, b) => Math.max(m, b.w || 0), 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Super minor, but I think since you provide the initial value of 0 in the reduce, we don't additionally need to have a ternary on boxes.length; the reduce will already return 0 here.

});

test('fontBounds no NaN (multiline + CENTER)', async () => {
const pFont = await myp5.loadFont(fontFile);
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the body of this test might be indented one time too many?

@perminder-17
Copy link
Collaborator Author

Thanks for your valuable feedback :)

@perminder-17 perminder-17 linked an issue Sep 13, 2025 that may be closed by this pull request
17 tasks
@perminder-17 perminder-17 linked an issue Sep 13, 2025 that may be closed by this pull request
17 tasks
@perminder-17 perminder-17 requested a review from ksen0 September 13, 2025 12:41
Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for the fix!

@davepagurek davepagurek merged commit 752a7fe into processing:dev-2.0 Sep 14, 2025
2 checks passed
@perminder-17 perminder-17 deleted the fontBounds-NaN branch September 14, 2025 15:06
@perminder-17
Copy link
Collaborator Author

Awesome, thanks for the fix!

Always, a pleasure.

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.

[p5.js 2.0 Bug Report]: textToContours font loading error

2 participants