Font Size Tip for Silverlight
I often forget that font size is pixel-based instead of point-based when working with Silverlight. Designers using Expression Design will set the point size for Text fonts because that’s what available to them.
When implementing a design that was created using Expression Design, I need to convert the point values for fonts to pixel values for the fonts to be rendered accurately as designed. Traditionally, a point is 1/72 of an inch. A Silverlight pixel renders at 1/96 of an inch. To convert a point to a pixel, I need to multiply the point by 96/72 or 1.333….
Here’s a handy chart that I use.
|Point (pt)||Pixel (px)~|
Note that this is not an issue with setting FontSize for TextBlocks in WPF. With WPF, the FontSize value can be set with the “pt” unit qualifier and no conversion is necessary. Unit qualifiers are not supported in Silverlight 2.