Skip to content

Instantly share code, notes, and snippets.

@nurse
Created August 13, 2011 22:34
Show Gist options
  • Save nurse/1144318 to your computer and use it in GitHub Desktop.
Save nurse/1144318 to your computer and use it in GitHub Desktop.
Show the width of the character
using System;
using System.Drawing;
using System.Windows.Forms;
class CharacterWidth
{
static void Main(string[] args)
{
Font font = new Font("MS Gothic", 12, GraphicsUnit.Pixel);
for (char c = '!'; c < 0x0301; c++) {
Size size = TextRenderer.MeasureText(c.ToString(), font);
Console.WriteLine("{0,0:X6},{1},{2}", (int)c, size.Width,c);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment