comparison SilverlightExampleApp/SilverlightExampleApp.Web/Services/Helpers.asmx.cs @ 49:502f5f365649

Initial load for Silverlight Example Application
author Steven Hollidge <stevenhollidge@hotmail.com>
date Tue, 17 Apr 2012 17:57:52 +0100
parents
children
comparison
equal deleted inserted replaced
48:d617b54e1f47 49:502f5f365649
1 using System;
2 using System.Globalization;
3 using System.Web.Services;
4 using System.Windows;
5 using System.Windows.Media;
6
7 namespace SilverlightExampleApp.Web.Services
8 {
9 [WebService(Namespace = "http://silverbladetechnology.com/")]
10 [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
11 [System.ComponentModel.ToolboxItem(false)]
12 public class Helpers : WebService
13 {
14 [WebMethod]
15 public string Text2Path(String strText, string strCulture, bool LtoR, string strTypeFace, int nSize)
16 {
17 if (strCulture == "")
18 strCulture = "en-us";
19
20 CultureInfo ci = new CultureInfo(strCulture);
21 FlowDirection fd = LtoR ? FlowDirection.LeftToRight : FlowDirection.RightToLeft;
22 FontFamily ff = new FontFamily(strTypeFace);
23 Typeface tf = new Typeface(ff, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
24 FormattedText t = new FormattedText(strText, ci, fd, tf, nSize, Brushes.Black);
25 Geometry g = t.BuildGeometry(new Point(0, 0));
26 PathGeometry p = g.GetFlattenedPathGeometry();
27
28 return p.ToString();
29 }
30 }
31 }