toptensoftware / RichTextKit

Rich text rendering for SkiaSharp
Other
367 stars 73 forks source link

Option to control ellipsis #50

Closed gresolio closed 2 years ago

gresolio commented 2 years ago

As far as I understand, there is no way to disable the ellipsis in RichString, it is always added if the TextBlock is truncated:

https://github.com/toptensoftware/RichTextKit/blob/5f4d2c80cc3723a7d3018172803c64637f92f7ee/Topten.RichTextKit/RichString.cs#L1042-L1048

Sometimes this behavior is undesirable, and it would be nice to be able to not render the ellipsis at the end.

I suggest to add a bool property to control ellipsis, for example Ellipsis, EllipsisEnabled (true by default). Is the idea reasonable? If so, I can prepare a patch.

My use case: I render fairly simple pdf reports, and use one RichString per page. The Truncated property serves as an indicator to me that a new page needs to be created. Everything works fine, but the ellipsis at the end of each page looks terrible, and I want to turn it off.

I also had a thought that maybe I was using RichString wrongly, but after reading the source code I couldn't find a better way. Please correct me if I have missed something obvious.

p.s. Thanks for the great RichTextKit project :)

toptensoftware commented 2 years ago

Happy to accept a pull request for this if you're willing to add it.

gresolio commented 2 years ago

Done, please review: https://github.com/toptensoftware/RichTextKit/pull/51

gresolio commented 2 years ago

Thanks!