A while back, I mentioned how I was using TIFF files to embed a 3rd party report into XPS content. It was decided that the bitmap was rather jarring when compared to the surrounding beautiful vector elements, so I coded up a solution that leveraged the component's export to XPS feature and converted the XPS FixedPages to Canvases thereby creating XAML for a WPF visual which I deserialized and hosted in the app.
There was a problem though. The first page of the report looked great. Second+ pages were missing characters. It seemed to be consistent within each document.
Fonts in XPS are stored as shared resources. I was taking the first occurrence of any font, say "Arial", and putting it in an in-memory package. I'd update the Xaml of my FixedPages-turned-Canvases to point to the in-memory package for the FontUri rather than using the original resource. Because of the consistency with which this was happening, I could only figure that the font files were being corrupted somehow.
It turned out that this was in fact this case. Each report's "Arial" file was a different size. I skimmed the web for a while and found some vague allusions to XPS optimizing fonts.
Today my coworker pinpointed a likely cause:
XpsSerializationManager.SetFontSubsettingPolicy
This method lets you control exactly what I was describing. It determines if all glyphs from the fonts are preserved or if the unused glyphs are stripped out per page or per document.
Thanks Matt!!
Friday, September 19, 2008
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment