Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is a font in .NET of size 8 displayed as 8.25?

Tags:

When you select, for example, a Size of 8 in a Font Dialog for Microsoft Sans Serif, it returns a font that .NET displays as having a size 8.25?

Why is this exactly?

like image 217
bvanderw Avatar asked Feb 13 '09 17:02

bvanderw


People also ask

How come my font size goes back to normal?

To set your computer's displayed font size to default: Browse to: Start>Control Panel>Appearance and Personalization>Display. Click Smaller - 100% (default). Click Apply.

What is the default for font size?

Usually, the default font is Calibri or Times New Roman, and the default font size is 11 or 12 point.


2 Answers

A point is 1/72 of an inch, so the font should be 8/72 (0.111111) inches high. Windows assumes a standard display is 96 DPI, unless you take pains to configure it otherwise. That means it tries to create a font that's 10.66667 pixels high; it rounds to 11 pixels. When you convert that back to points ((11 / 96) * 72), it becomes 8.25.

like image 169
Mark Ransom Avatar answered Sep 27 '22 19:09

Mark Ransom


This is most likely due to the way the Windows Font Mapper calculates font sizes. There is a slight difference between pixel heights of font cells and normal "points" @ 1/72 of an inch.

More info here: http://msdn.microsoft.com/en-us/library/ms969909.aspx

like image 21
Brandon Avatar answered Sep 27 '22 21:09

Brandon