I recently had a unique challenge with SSRS which was the utilization of a Custom Font on an SSRS Report. Normally, I do not think about fonts other than what get installed as system fonts in Windows so this was a fairly new experience. I know a few people who REALLY enjoy fonts in the Design Practice at Clarity, but had never considered the impact and usefulness they can play in SSRS. It was somewhat difficult to find information about this so I figured I would summarize to save some other people some trouble.
The report that I had to develop was going to be a customer facing report so there were some fairly exact standards that it needed to comply with both from an aesthetic and regulatory perspective, much more so than most SSRS reports which are generally for internal consumption only. As an idea of some of the requirements take a look at a statement from your cell phone provider, local utility or television provider, and that is similar to what I had to build. If you have never looked very closely at something like that you probably have missed the sheer amount of different fonts, font sizes, font weights, font decorations, and so on that is used in building that statement. Some of the formatting is done based on aesthetics and some is also based on regulations, such as minimum font sizes for those disclaimers that you can barely read on the statement.
So before I get into the nuts and bolts of this, I need to give a shout out to Andre Milbradt from the SSRS team who was very helpful in clearing up some of the confusion out there for me on font embedding and the PDF Renderer.
Before we get into SSRS, let’s go into a bit about the different types of fonts out there (Reminder: I am not a Font guy). There are two major types of Fonts out there: True Type (wiki: http://en.wikipedia.org/wiki/True_Type_Font ) and Open Type (wiki: http://en.wikipedia.org/wiki/OpenType). Of these two, SSRS fully supports True Type Fonts and has limited support for Open Type Fonts. Essentially, any Font that can be instantiated by the .Net System.Drawing.Font (http://msdn.microsoft.com/en-us/library/system.drawing.font.aspx) class is supported by SSRS. Because the custom font that we needed was available as both a True Type Font and an Open Type Font, we went with the True Type font since we knew that it would be fully supported.
So we went ahead and installed the fonts on the developer machine and the SSRS server. On the development machine, you do have to restart Visual Studio after you install the fonts for Visual Studio to pick up on the font. On the server, we were having issues with SSRS picking up the newly installed Font until we restarted the Reporting Services Server. We probably could have just restarted SSRS, but we ended up just restarting the server. If you have never installed a font before (I hadn’t before this project) you can get to the installed fonts by going to Control Panel -> Fonts. For Windows XP and above you can just copy and paste the font files into this directory. For Vista and above, one of the right-click options on the .ttf font file is “Install”.
I first started developing the report in SSRS 2005, using my custom font and it all looks good. Then I try to export to PDF for the first time and “Uh-Oh”. That doesn’t quite work. And after a bit of research and some verification from the PG team, SSRS 2005 does have limited support PDF Font Embedding, but it is limited to Unicode Data. You can check out the Books Online here (http://technet.microsoft.com/en-us/library/ms159713(SQL.90).aspx) about the behavior in SSRS 2005. You can also check out this post from Robert Bruckner (http://blogs.msdn.com/robertbruckner/archive/2008/10/27/unicode-in-pdf-font-embedding.aspx ) on the feature in SSRS 2008 CU1, which is the same feature that was also added SSRS 2005 in SP3. So since I was using ANSI text data, it was on to SSRS 2008.
So I started looking at Books Online for SSRS 2008 and noticed the same restrictions on Font Embedding in PDF as there are in SSRS 2005. If you take a look at the same topic for SSRS 2008 (http://technet.microsoft.com/en-us/library/ms159713(SQL.100).aspx) in the Font Embedding section it still lists the following as a restriction, “The characters in the string that has the Font property set are Unicode, not ANSI. No font embedding occurs for ANSI characters.” After confirmation from the product group, this is incorrect and a User Education bug was submitted to have this documentation fixed. So with that out of the way and we had confirmation that SSRS 2008 will embed fonts within a generated PDF, we developed our report.
At this point I want to remind you to restart the server after installing your font, because I forgot my own rule to restart the server after installing fonts and was pulling my hair out at one point.
So after you have developed and deployed your report, you export to PDF and want to verify that your Font got embedded. There are a number of ways to do this. First, check the properties of the PDF. In Acrobat Reader, go to File->Properties and then click on the Font tab. There should be a listing of Fonts there which should include your custom font. Second, send the PDF to someone who does not have the Font installed. They should see the new custom font as well in their PDF. Lastly, if your custom font is not obvious, having a nice trained designer eye is the best tool you can have to verify the font for you.
So hopefully this post clears up some confusion on custom fonts and Font Embedding with the PDF Font Renderer.