Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8163379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:01:22+00:00 2026-06-06T19:01:22+00:00

I have a True type font (.ttf) file hosted on a service. I obtain

  • 0

I have a True type font (.ttf) file hosted on a service. I obtain it in the form of a byte array. I need to set the font in that file during run-time.

I am facing the problem on Windows Phone 7 and the service used is a simple WCF service which provides the .ttf file as a byte-array.

This is what I have done till now but it doesn’t seem to work.. :

        IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication();
        string fontPath = string.Empty;
        string ss = string.Empty;

        IsolatedStorageFileStream fs = new IsolatedStorageFileStream("foo.ttf", System.IO.FileMode.Create, file);
        fs.Write(e.Result.byteArray, 0, e.Result.byteArray.Length);
        fs.Dispose();

        fs = new IsolatedStorageFileStream("foo.ttf", FileMode.Open, file);
        ss = fs.Name + @"#My Font";
        textBlock1.FontFamily = new System.Windows.Media.FontFamily(ss);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:01:23+00:00Added an answer on June 6, 2026 at 7:01 pm

    I finally figured it out. There is a FontSource property of a textblock which has a constructor which takes a STREAM as parameter. The .ttf file can be read from the Isolated Storage in the form of a stream.

    The FontFamily can then be set as any of the fonts present in the .ttf font file.

    The code snippet is as follows:

    void ttlHost_FileStreamingCompleted(object sender, TTL_Host.FileStreamingCompletedEventArgs e)
    {
            IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication();
            FontSource mySource;
            byte[] MyFont;
    
            using (IsolatedStorageFileStream fs = new IsolatedStorageFileStream("foo.ttf", System.IO.FileMode.Create, file))
            {
                fs.Write(e.Result.byteArray, 0, e.Result.byteArray.Length);
            }
    
            MyFont = e.Result.byteArray;
    
            using (IsolatedStorageFileStream fileStream = file.OpenFile(""foo.ttf", FileMode.Open, FileAccess.Read))
            {
                using (StreamReader reader = new StreamReader(fileStream))
                {
                    mySource = new FontSource(reader.BaseStream);
                    myTextBlock.FontFamily = new FontFamily("My Font");
                    myTextBlock.FontSource = mySource;
                }
            }
    
            myTextBlock.Text = "Changed Font";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom TrueType font (TTF) that consists of a bunch of icons,
I have a function which takes in a font (ttf or otf file) and
I need my WPF app to use a true-type font for a different language.
I have some custom type: [RdfSerializable] public class Item { [RdfProperty(true)] public string Name
I'm trying to write a macro to delete all rows that have True in
I have an application which has a font stored within a jar file. It
I'm trying to export a font so that you don't have to install the
I have a project that's been using font-face without problem for some time. Today
Let’s say we have a font-face section like that @font-face { font-family: 'F'; src:
I have some fonts being configured in my Scss file like so: @font-face {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.