Font Metrics C#


Can anyone point me to information regarding getting font metrics from a true type font in C#?
I need to split some text from an RSS feed for a given box height and width.

I’ve checked System.Drawing.Font and GetHeight is there but how do I get the width of a character?

I understand each character is rendered as a glyph but not sure which class will get the width of the character?

Many Thanks

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Text;
using System.Windows.Forms;

namespace TextWidth
    class Program
        static void Main(string[] args)
            Console.WriteLine("Text Width");

            string input = Console.ReadLine();

            //Create font
            Font testFont = new Font("ariel", 2.0f);

            Size s = TextRenderer.MeasureText(input, testFont);

            Console.WriteLine("Size: height " + s.Height + ", width " + s.Width);


Hi a_james72, welcome to the forums,

Thanks for posting your solution. I put it into bbcode tags to make it a bit easier to read.