David
David

Reputation: 4117

Convert millimeter to em

I want to create an arial System.Drawing.Font with the font size of 5.9 millimeter. The font constructor allows the font size only in em:

public Font(string familyName, float emSize, FontStyle style);

How can I convert millimeter to em? The dpi is 96.

Upvotes: 0

Views: 1352

Answers (1)

Poonam Singhania
Poonam Singhania

Reputation: 347

You can have a variable conversionFactor

var conversionFactor = 1/(4.2175176);

And before passing value to Constructor you need to multiply conversionfactor with fontsize

In this way:

(fontsize) in mm * (conversionFactor) = (FontSize) in em

For 5.9 mm its

float emSize = conversionFactor*5.9

Upvotes: 3

Related Questions