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

  • SEARCH
  • Home
  • 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 4101984
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:46:03+00:00 2026-05-20T20:46:03+00:00

I’m messing around with the Windows Phone 7 sdk and I’m trying to make

  • 0

I’m messing around with the Windows Phone 7 sdk and I’m trying to make the screen look like an old fashion digital display. Right now I’m trying to figure out how to make the text “glow” like one of those cool digital clocks. This is the sort of thing I’d assume you would look in to using shaders for, but it seems that shaders are disabled for use on the Windows Phone 7 OS. Any ideas? To be more specific, I want the text to look as though it is a light source and have the color “bleed” out slightly from the actual font.

  • 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-05-20T20:46:03+00:00Added an answer on May 20, 2026 at 8:46 pm

    I’d say its a choice between using an image as a font or blurring with WriteableBitmap.

    Using a pre-made font image allows you to make the letters a complex as you want and should perform well. SpriteFont2 is convenient as it can generate the SpriteSheet with effects like glow, stroke, shadow and export an xml file containing the letter positions.
    Add the generated png, and xml files to your solution and change the Build Action to content also check you have referenced System.Xml.Linq.

    The following class can then be used.

    public static class BitmapFont
    {
        private class FontInfo
        {
            public FontInfo(WriteableBitmap image, Dictionary<char, Rect> metrics)
            {
                this.Image = image;
                this.Metrics = metrics;
            }
            public WriteableBitmap Image { get; private set; }
            public Dictionary<char, Rect> Metrics { get; private set; }
        }
    
        private static Dictionary<string, FontInfo> fonts = new Dictionary<string, FontInfo>();
        public static void RegisterFont(string fontFile, string fontMetricsFile)
        {
            string name = System.IO.Path.GetFileNameWithoutExtension(fontFile);
            BitmapImage image = new BitmapImage();
    
            image.SetSource(App.GetResourceStream(new Uri(fontFile,UriKind.Relative)).Stream);
            var metrics = XDocument.Load(fontMetricsFile);
            var dict = (from c in metrics.Root.Elements()
                        let key = (char)((int)c.Attribute("key"))
                        let rect = new Rect((int)c.Element("x"), (int)c.Element("y"), (int)c.Element("width"), (int)c.Element("height"))
                        select new { Char = key, Metrics = rect }).ToDictionary(x => x.Char, x => x.Metrics);
    
            fonts.Add(name,new FontInfo(new WriteableBitmap(image),dict));
        }
    
        public static WriteableBitmap DrawFont(string text, string fontName)
        {
            var font = fonts[fontName];
    
            var letters = text.Select(x => font.Metrics[x]).ToArray();
            var height = (int)letters.Max(x => x.Height);
            var width = (int)letters.Sum(x => x.Width);
    
            WriteableBitmap bmp = new WriteableBitmap(width, height);
    
            int[] source = font.Image.Pixels, dest = bmp.Pixels;
            int sourceWidth = font.Image.PixelWidth;
            int destX = 0;
            foreach (var letter in letters)
            {
                for (int sourceY = (int)letter.Y, destY = 0; destY < letter.Height; sourceY++, destY++)
                {
                    Array.Copy(source, (sourceY * sourceWidth) + (int)letter.X, dest, (destY * width) + destX, (int)letter.Width);
                }
                destX += (int)letter.Width;
            }
    
            return bmp;
        }
    
        public static Rectangle[] GetElements(string text, string fontName)
        {
            var font = fonts[fontName];
    
            return (from c in text
                    let r = font.Metrics[c]
                    select new Rectangle
                    {
                        Width = r.Width,
                        Height = r.Height,
    
                        Fill = new ImageBrush { 
                            ImageSource = font.Image, 
                            AlignmentX=AlignmentX.Left,
                            AlignmentY=AlignmentY.Top,
                            Transform = new TranslateTransform { X = -r.X, Y = -r.Y },
                            Stretch=Stretch.None                        
                        },
                    }).ToArray();
        }
    }
    

    Usage

    //Register the font once.
    BitmapFont.RegisterFont("Font.png", "Metrics.xml");
    
    //Draws the text to a new bitmap, font name is image name without extension.
    image.Source = BitmapFont.DrawFont(DateTime.Now.ToLongTimeString(), "Font");
    
    //Alternatively put these elements in a horizontal StackPanel, or ItemsControl
    //This doesn't create any new bitmaps and should be more efficient.
    //You could alter the method to transform each letter too.
    BitmapFont.GetElements(DateTime.Now.ToLongTimeString(), "Font");
    

    If you want to blur see a BoxBlur implementation here or use WriteableBitmapEx.Convolute.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
In my XML file chapters tag has more chapter tag.i need to display chapters

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.