Render TextBlock characters along a path
Hi guys,
We have just been asked to implement a TextBlock such that it follows an arc. For example, I just mocked up the following image in Photoshop which is the effect we're after:
Looking online, I don't see an easy way to do this. My current thought is to split each character into a separate Run element and then define the location of that inline to be placed along a spline.
Can you think of an easier way to achieve this? Is there some solution we could achieve entirely in the SDF text renderer? Could we define the arc as a cbuffer parameter in a custom shader and render it in a bespoke way?
Any input would be greatly appreciated! Cheers,
-Steven
We have just been asked to implement a TextBlock such that it follows an arc. For example, I just mocked up the following image in Photoshop which is the effect we're after:
Looking online, I don't see an easy way to do this. My current thought is to split each character into a separate Run element and then define the location of that inline to be placed along a spline.
Can you think of an easier way to achieve this? Is there some solution we could achieve entirely in the SDF text renderer? Could we define the arc as a cbuffer parameter in a custom shader and render it in a bespoke way?
Any input would be greatly appreciated! Cheers,
-Steven
Re: Render TextBlock characters along a path
I think the best solution for this is creating a UserControl and overriding the OnRender method to render each glyph at the desired orientation and position. Something similar to this
https://docs.microsoft.com/en-us/archiv ... h-with-wpf
We can help you with this as I think this is something we could include as part of our application framework.
https://docs.microsoft.com/en-us/archiv ... h-with-wpf
We can help you with this as I think this is something we could include as part of our application framework.
Re: Render TextBlock characters along a path
Awesome, cheers for the pointer Jesús. I'll take a look at this when I get a spare moment.
-Steven
-Steven
Re: Render TextBlock characters along a path
Thanks Steven, please keep us posted to help you.
Who is online
Users browsing this forum: Ahrefs [Bot] and 0 guests