steveh
Topic Author
Posts: 42
Joined: 07 Oct 2019, 12:50

Render TextBlock characters along a path

09 Aug 2021, 13:57

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:
TextAlongPath.png
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
 
User avatar
jsantos
Site Admin
Posts: 3424
Joined: 20 Jan 2012, 17:18
Contact:

Re: Render TextBlock characters along a path

09 Aug 2021, 16:26

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.
 
steveh
Topic Author
Posts: 42
Joined: 07 Oct 2019, 12:50

Re: Render TextBlock characters along a path

11 Aug 2021, 11:08

Awesome, cheers for the pointer Jesús. I'll take a look at this when I get a spare moment.

-Steven
 
User avatar
jsantos
Site Admin
Posts: 3424
Joined: 20 Jan 2012, 17:18
Contact:

Re: Render TextBlock characters along a path

11 Aug 2021, 12:55

Thanks Steven, please keep us posted to help you.

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests