Vectorlight News

  • Chat App Converted to HTML and JQuery
    Sep 08, 2011

    Converted from Silverlight to HTML and Javascript/JQuery is the Vectorlight Chat App. Login using your Vectorlight password to chat using your username and avatar.

  • HTML5 iPhone,Android Big Guns Tower Defense
    Jul 02, 2011

    Big Guns has made the leap from Windows Phone 7 (XNA) to HTML5 so you can now play it on your iPhone, Android and other HTML5 compatible devices.

  • HTML5 Games - Word Poppers and Batty
    Jun 04, 2011

    As the take-up of HTML5 quickens (74% of users currently have a browser capable of HTML5 Canvas) we present two more games for both your browser and mobile.

  • Big Guns Tower Defense on Windows Phone 7
    May 06, 2011

    Coming soon to Windows Phone 7 is an XNA port of the popular Vectorlight tower defense game Super Tower Defense. Whilst retaining many of the graphical and gameplay features of the original Silverlight game.

  • Wakacube WP7 Update
    Apr 26, 2011

    Released to the Windows Phone 7 marketplace today is Version 1.1 of Wakacube the 3D physics game of skill. Included in the update are more levels (30 in total) and new mode Wakatime which generates random crate structures to keep players entertained long after the levels have been completed.

  • Home Page News
Kosta
Kosta
Custom FonStyle Posted: Oct 06, 2009
 

Can I format some text using my own fontstyle?

 
 
dan
dan
RE: Custom FonStyle Posted: Oct 06, 2009
 

Hi,


Do you mean custom Font?  I'm not sure I've seen any examples of using a custom FontStyle in a regular TextBlock/TextBox, if you have seen any or have some code, could you post here please?


Thanks!

 
 
Kosta
Kosta
RE: Custom FonStyle Posted: Oct 06, 2009
 

I mean using my own ttf file. Something like this:


<TextBlock Name="test" FontFamily="timheuer.ttf#Tim Heuer Normal"></TextBlock>


or if you do it programatically:


WebClient client = new WebClient();

client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted);

client.OpenReadAsync(new Uri("../timheuer.ttf", UriKind.Relative));


void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)

{

      if (e.Error == null && !e.Cancelled)

      {

                

        test.Text = "ewfuhewuhfewhiuewhgiuewhiu";

                test.FontSource = new FontSource(e.Result);

                test.FontFamily = new FontFamily("Tim Heuer Normal");

                //fonts[Tim Heuer Normal"] = e.Result;

            }


        }

 
 
nikopa
nikopa
RE: Custom FonStyle Posted: Oct 06, 2009
 

Hi dan,


I think this one is quite useful example http://timheuer.com/blog/archive/2008/03/10/embedding-fonts-in-silverlight-2.aspx


I'm interested in using external or custom fonts with your control. But haven't found a way to so with RichTextBox control.

Any ideas.


Thanks!

 
 
dan
dan
RE: Custom FonStyle Posted: Oct 07, 2009
 

Hi,


At the moment you cannot use custom fonts like this.  The only way supported at the moment is to include your ttf file in your XAP and have a style in your RichText XML that looks something like this:


<Style ID="myStyle" FontFamily="timheuer.ttf#Tim Heuer Normal" FontSize="10" />


And then to use the style in your XML use the folloowing:


<Text Style="myStyle"><![CDATA[Some text]]></Text>


Or in code to apply the font to a text selection you can use:


myRichTextBox.ApplyFormatting(Formatting.FontFamily, "timheuer.ttf#Tim Heuer Normal");


Hope this helps!

 
 

Rate this: 

1 Star 2 Star 3 Star 4 Star 5 Star
4 Ratings / 2.5 Average