Skip to content

Text : Added EllipsizeMode for tail and clip alignment #14660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jun 6, 2025

Conversation

iamAbhi-916
Copy link
Contributor

@iamAbhi-916 iamAbhi-916 commented May 12, 2025

Description

Added EllipsizeMode for tail and clip, for head and middle the behaviour maps to default tail alignment of ellipsis.

DirectWrite does not natively support head and middle truncation in the same way it supports tail.
A custom implementation will be required for the same adding that to backlog.

Type of Change

  • New feature (non-breaking change which adds functionality)

Why

This PR adds functionality to a prop EllipsizeMode particular to windows, this prop is tightly coupled with numberOfLines and adjusts the text alignment based on the ellipsis mode.

Resolves [Add Relevant Issue Here]
#13111

What

Made changes to paragraph.cpp to reflect ellipsis depending on the EllipsizeMode prop, and updating the text layout, text alignment for the same.

Screenshots

Screenshot 2025-06-04 112233

Testing

tested in playground.

Changelog

Should this change be included in the release notes: indicate yes or no
yes

Add a brief summary of the change to use in the release notes for the next release.

Added EllipsizeMode for tail and clip , for head and middle the behaviour maps to default tail alignment of ellipsis.

Microsoft Reviewers: Open in CodeFlow

@iamAbhi-916 iamAbhi-916 requested a review from a team as a code owner May 12, 2025 11:08
@iamAbhi-916 iamAbhi-916 marked this pull request as draft May 12, 2025 11:10
@iamAbhi-916 iamAbhi-916 marked this pull request as ready for review June 4, 2025 07:15
@iamAbhi-916 iamAbhi-916 requested a review from acoates-ms June 5, 2025 17:03
// Reset m_textLayout when ellipsizeMode changes
if (oldViewProps.paragraphAttributes.ellipsizeMode != newViewProps.paragraphAttributes.ellipsizeMode) {
m_textLayout = nullptr;
}
if (oldViewProps.paragraphAttributes.adjustsFontSizeToFit != newViewProps.paragraphAttributes.adjustsFontSizeToFit) {
m_requireRedraw = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to this PR. But I think we need to reset the textlayout here, not just redraw.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense , let me create an issue for the same and add this fix.

@iamAbhi-916 iamAbhi-916 requested a review from acoates-ms June 6, 2025 11:21
@iamAbhi-916 iamAbhi-916 merged commit d6501a3 into microsoft:main Jun 6, 2025
59 checks passed
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