Home > Design > Font Size Tip for Silverlight

Font Size Tip for Silverlight

February 27th, 2009

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.

image

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)~
7pt 9.333
8pt 10.666
9pt 12
10pt 13.333
11pt 14.666
12pt 16
13pt 17.333
14pt 18.666
15pt 20

image

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.

Design , ,

  1. March 18th, 2009 at 16:01 | #1

    Hi alan, where have you been. I found this site when my g/f was looking for lion king recipe over at your wife’s site. Pretty neat eh.

  2. August 27th, 2010 at 02:20 | #2

    Pixel Fonts for Silverlight and WPF at CodePlex.com

    http://pixelfonts.codeplex.com/

  1. No trackbacks yet.