tags:

views:

26

answers:

1

Does anyone know a way to determine if a font is monospace and the width and height of a single character (only relevant if it is monospace). The important requirement is that it works with mono and microsoft implementations of .net .

Thanks

A: 

First thing you need to choose which GUI Toolkit you are targeting.

Fonts aren't abstracted in a toolkit-independent way, AFAIK.

For WinForms, TextRenderer.MeasureText method used with "iii" and "www" strings can help you guess if the font is monospaced and which is the probable 'fixed' width of a char cell, bu it may not work right for very small point sizes...

Monoman