Text on a path

417 views
Skip to first unread message

Brennon Williams

unread,
Sep 27, 2008, 10:49:32 AM9/27/08
to wpf-di...@googlegroups.com

Anyone ever worked out a nice way or being able to make text follow a path or arc segment in WPF?

I have been messing around with GetPointAtFractionLength() from flattened geometry to get specific points but it isnt workable when needing to just allow a string such as testing to be curved around a small segment keeping the letters close to each other. Its fine for making all the letters space around an entire ellipse though.

I have checked the WPF text team blog which appears to have been really quiet.

Anyone got any thoughts or come across anything that could give me some better direction on this?

Sacha Barber

unread,
Sep 27, 2008, 2:59:03 PM9/27/08
to wpf-di...@googlegroups.com
No but I would love to know, so if you find an answer I'm all ears.






From: brennon...@x-coders.com
To: wpf-di...@googlegroups.com
Subject: [WPF Disciples] Text on a path
Date: Sat, 27 Sep 2008 15:49:32 +0100

Try Facebook in Windows Live Messenger! Try it Now!

Laurent Bugnion

unread,
Sep 27, 2008, 3:04:07 PM9/27/08
to wpf-di...@googlegroups.com
Maybe by scripting WordArt in Office? :)

Sacha Barber wrote:
> No but I would love to know, so if you find an answer I'm all ears.
>
>
>
>
>

> ------------------------------------------------------------------------


> From: brennon...@x-coders.com
> To: wpf-di...@googlegroups.com
> Subject: [WPF Disciples] Text on a path
> Date: Sat, 27 Sep 2008 15:49:32 +0100
>
> Anyone ever worked out a nice way or being able to make text follow a
> path or arc segment in WPF?
>
> I have been messing around with GetPointAtFractionLength() from
> flattened geometry to get specific points but it isnt workable when
> needing to just allow a string such as “testing” to be curved around a
> small segment keeping the letters close to each other. Its fine for
> making all the letters space around an entire ellipse though.
>
> I have checked the WPF text team blog which appears to have been
> really quiet.
>
> Anyone got any thoughts or come across anything that could give me
> some better direction on this?
>
>

> ------------------------------------------------------------------------


> Try Facebook in Windows Live Messenger! Try it Now!

> <http://clk.atdmt.com/UKM/go/111354030/direct/01/>

--
Laurent Bugnion [Microsoft MVP, MCP]
Software engineering, Blog: http://www.galasoft.ch
PhotoAlbum: http://www.galasoft.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

Mike Brown

unread,
Sep 27, 2008, 11:13:23 PM9/27/08
to wpf-di...@googlegroups.com
I wonder how expression does it...designer not blend.

Brennon Williams

unread,
Sep 28, 2008, 7:21:49 AM9/28/08
to wpf-di...@googlegroups.com

Generally it is achieved by creating a flattened path geometry from the text which is simple enough, and then the individual path figures etc are modified to position each path.. which is fine if you can visually tweak the position of each path using a tool such as Design.

 

The issue for me is that I want this to be editable text, which is also possible using TextEffects… but this is a long drawn out scenario of modifying each character.

 

I can sit here and work it out, just wondered if anyone had come across and easier way of doing it that’s all.

 

Cheers

Corrado Cavalli

unread,
Sep 28, 2008, 9:51:12 AM9/28/08
to wpf-di...@googlegroups.com

I’m quite sure I’ve seen something like this, but don’t count on me to remember where, I thought it was on Petzold’s blog but after a search I presume I was wrong.

 

Sorry guys….

Corrado

 

From: wpf-di...@googlegroups.com [mailto:wpf-di...@googlegroups.com] On Behalf Of Sacha Barber


Sent: sabato 27 settembre 2008 20:59
To: wpf-di...@googlegroups.com

Subject: [WPF Disciples] Re: Text on a path

 

No but I would love to know, so if you find an answer I'm all ears.

Brennon Williams

unread,
Sep 28, 2008, 12:10:41 PM9/28/08
to wpf-di...@googlegroups.com

Thanks Corrado. I will just have to nut this out the old fashion way ;-)

 

Cheers

Karl Shifflett

unread,
Sep 28, 2008, 12:21:13 PM9/28/08
to wpf-di...@googlegroups.com

I’ll ask around get back to you all.

 

Karl

Mike Brown

unread,
Sep 28, 2008, 4:55:05 PM9/28/08
to wpf-di...@googlegroups.com
Found a text to path using gdi+ ... it should be too hard to convert to WPF.

Brennon Williams

unread,
Sep 28, 2008, 8:21:07 PM9/28/08
to wpf-di...@googlegroups.com

Thanks Mike, will take a look at this in the morning and post a conversion should I get it to work.

 

My current implementation is not that dissimilar although his method includes the char rotational requirement so that should save me a lot of foot work. I am using the drawing context method of DrawString().

 

Don’t you think for a design orientated UI framework, this sort of functionality should be built in? I certainly do, along with programmable brush styles, the same as available with most “design” packages. They are in Expression Design, so I wonder how much of a nightmare they would be to introduce. Maybe John Gossman has some thoughts on this?

 

Cheers again Mike.

Laurent Bugnion

unread,
Oct 7, 2008, 9:37:52 AM10/7/08
to wpf-di...@googlegroups.com
I guess that by now you guys already saw this:

http://timheuer.com/blog/archive/2008/10/06/silverlight-write-text-on-path-textblock-control.aspx

Maybe it's possible to port this to WPF.

Greetings,
Laurent

Brennon Williams wrote:
>
> Thanks Mike, will take a look at this in the morning and post a
> conversion should I get it to work.
>
> My current implementation is not that dissimilar although his method
> includes the char rotational requirement so that should save me a lot
> of foot work. I am using the drawing context method of DrawString().
>
> Don’t you think for a design orientated UI framework, this sort of
> functionality should be built in? I certainly do, along with
> programmable brush styles, the same as available with most “design”
> packages. They are in Expression Design, so I wonder how much of a
> nightmare they would be to introduce. Maybe John Gossman has some
> thoughts on this?
>
> Cheers again Mike.
>

> *From:* wpf-di...@googlegroups.com
> [mailto:wpf-di...@googlegroups.com] *On Behalf Of *Mike Brown
> *Sent:* 28 September 2008 21:55
> *To:* wpf-di...@googlegroups.com
> *Subject:* [WPF Disciples] Re: Text on a path


>
> Found a text to path using gdi+ ... it should be too hard to convert
> to WPF.
>
> http://www.codeproject.com/KB/GDI-plus/Text_on_Path_with_VBNET.aspx
>
> On Sun, Sep 28, 2008 at 12:21 PM, Karl Shifflett
> <ka...@littlerichie.com <mailto:ka...@littlerichie.com>> wrote:
>
> I'll ask around get back to you all.
>
> Karl
>

> *From:* wpf-di...@googlegroups.com
> <mailto:wpf-di...@googlegroups.com>
> [mailto:wpf-di...@googlegroups.com
> <mailto:wpf-di...@googlegroups.com>] *On Behalf Of *Brennon Williams
> *Sent:* Sunday, September 28, 2008 9:11 AM
>
>
> *To:* wpf-di...@googlegroups.com
> <mailto:wpf-di...@googlegroups.com>
> *Subject:* [WPF Disciples] Re: Text on a path


>
> Thanks Corrado. I will just have to nut this out the old fashion way ;-)
>
> Cheers
>

> *From:* wpf-di...@googlegroups.com
> <mailto:wpf-di...@googlegroups.com>
> [mailto:wpf-di...@googlegroups.com
> <mailto:wpf-di...@googlegroups.com>] *On Behalf Of *Corrado Cavalli
> *Sent:* 28 September 2008 14:51
> *To:* wpf-di...@googlegroups.com
> <mailto:wpf-di...@googlegroups.com>
> *Subject:* [WPF Disciples] Re: Text on a path


>
> I'm quite sure I've seen something like this, but don't count on me to
> remember where, I thought it was on Petzold's blog but after a search
> I presume I was wrong.
>
> Sorry guys….
>
> Corrado
>

> *From:* wpf-di...@googlegroups.com
> <mailto:wpf-di...@googlegroups.com>
> [mailto:wpf-di...@googlegroups.com
> <mailto:wpf-di...@googlegroups.com>] *On Behalf Of *Sacha Barber
> *Sent:* sabato 27 settembre 2008 20:59
> *To:* wpf-di...@googlegroups.com
> <mailto:wpf-di...@googlegroups.com>
> *Subject:* [WPF Disciples] Re: Text on a path


>
> No but I would love to know, so if you find an answer I'm all ears.
>

> ------------------------------------------------------------------------


>
> From: brennon...@x-coders.com <mailto:brennon...@x-coders.com>
> To: wpf-di...@googlegroups.com <mailto:wpf-di...@googlegroups.com>
> Subject: [WPF Disciples] Text on a path
> Date: Sat, 27 Sep 2008 15:49:32 +0100
>
> Anyone ever worked out a nice way or being able to make text follow a
> path or arc segment in WPF?
>
> I have been messing around with GetPointAtFractionLength() from
> flattened geometry to get specific points but it isnt workable when
> needing to just allow a string such as "testing" to be curved around a
> small segment keeping the letters close to each other. Its fine for
> making all the letters space around an entire ellipse though.
>
> I have checked the WPF text team blog which appears to have been
> really quiet.
>
> Anyone got any thoughts or come across anything that could give me
> some better direction on this?
>

> ------------------------------------------------------------------------


>
> Try Facebook in Windows Live Messenger! Try it Now!

Zhou Yong

unread,
Oct 7, 2008, 10:41:20 AM10/7/08
to wpf-di...@googlegroups.com
I am just glad to know why you guys don't use pixel shader, since if you already have a polynomial curve formula at hand, it's just matter of mapping from upright texture coordinate system to the curved coordinate system, and what's more, you only need to apply the shader effect to the TextBlock, and you get all the functionality of TextBlock, aka being interactive, and enable data binding etc etc.

Yong

Brennon Williams

unread,
Oct 13, 2008, 11:38:37 AM10/13/08
to wpf-di...@googlegroups.com

Hey Yong I would love to see a sample of your explanations below, sounds really interesting.

 

A guy named Adam Hill sent me a link to his codeproject article today which I think is great to see

 

http://www.codeproject.com/KB/WPF/TextOnAPath.aspx

Zhou Yong

unread,
Oct 13, 2008, 11:38:58 PM10/13/08
to wpf-di...@googlegroups.com
I think missed the point, pixel shader cannot achieve this effect, since when using pixel shader, the text will be distorted.

Yong
Reply all
Reply to author
Forward
0 new messages