The best laid plans...and some cool text stuff
Well that didn't last long, trying to post once a day about Silverlight...I'll try to do a double post to make up for it later, but here's a little teaser to what took up too much of my time last night and I didn't get a post in.
http://www.bluerosegames.com/fontpathsampleweb/fontpathsampletestpage.aspx
Here's a screenshot:
For those of you familiar with text in Silverlight, there are a couple of things it's missing that people have asked for. One is that you can't specify a Stroke, and the other is that you can't draw along a curve or distort your text.
How this sample works is that the font data is scraped from the font file and the path data is stored in an XML file that gets included in your Silverlight project. It is then converted at run time based on the text string specified into a Path object. So right away, you now have the ability to specify both a Fill and a Stroke for the text.
Then I run the path data through a transform layer (this is optional), which takes each point in the Path and transforms it to some other point. In the sample, it's a polar transform where Y is converted to distance from the center, and X is converted to an angle.
By running the text through multiple transforms, you could do even more interesting effects. The goal is to easily allow you to extend the functionality by creating your own transforms and hopefully making them available for others to use.
So what I'm trying to do now is encapsulate the code in this sample into a reusable control with full XAML support for specifying properties and transforms so that you could use this without any code behind.
Once I get this a bit closer to where it needs to be, I'll making the source code available either on this site or through CodePlex, probably CodePlex because I'd like others to be able to contribute.
I think it's pretty cool, hopefully it's interesting to you as well.