![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Printing some fonts throws exception in XPS to GDI conversion I am working on a WPF-based application. When I attempt to print my document, the print job fails if the document contains certain TrueType fonts. Details of the failure: Using either the System.Windows.Controls.PrintDialog.PrintVisual method or the System.Windows.Xps.VisualsToXpsDocument.Write method, an exception is thrown if the Visual contains one of the problematic fonts. The exception is System.IndexOutOfRangeException. The message is “Index was outside the bounds of the array.” The stack trace is: at Microsoft.Internal.GDIExporter.TrueTypeFont.CheckSum(UInt32 pos, UInt32 len) at Microsoft.Internal.GDIExporter.TrueTypeFont.ProcessNameTable(UInt32 pos) at Microsoft.Internal.GDIExporter.FontInstallInfo.Install(FontStreamContext context, String& newFamilyName, UInt32 faceIndex) at Microsoft.Internal.GDIExporter.FontInfo.UsePrivate(GlyphTypeface typeface) at Microsoft.Internal.GDIExporter.CGDIDevice.CheckFont(GlyphTypeface typeface, String name) at Microsoft.Internal.GDIExporter.CGDIRenderTarget.CreateFontW(GlyphRun pGlyphRun, Double fontSize, Double scaleY) at Microsoft.Internal.GDIExporter.CGDIRenderTarget.RenderTextThroughGDI(GlyphRun pGlyphRun, Brush pBrush) at Microsoft.Internal.GDIExporter.CGDIRenderTarget.DrawGlyphRun(Brush pBrush, GlyphRun glyphRun) at Microsoft.Internal.AlphaFlattener.BrushProxyDecomposer.Microsoft.Internal.AlphaFlattener.IProxyDrawingContext.DrawGlyphs(GlyphRun glyphrun, Geometry clip, Matrix trans, BrushProxy foreground) at Microsoft.Internal.AlphaFlattener.PrimitiveRenderer.DrawGlyphs(GlyphRun glyphrun, Rect bounds, Matrix trans, String desp) at Microsoft.Internal.AlphaFlattener.Flattener.AlphaRender(Primitive primitive, List`1 overlapping, Int32 overlapHasTransparency, Boolean disjoint, String desp) at Microsoft.Internal.AlphaFlattener.Flattener.AlphaFlatten(IProxyDrawingContext dc, Boolean disjoint) at Microsoft.Internal.AlphaFlattener.Flattener.Convert(Primitive tree, ILegacyDevice dc, Double width, Double height, Double dpix, Double dpiy, Nullable`1 quality) at Microsoft.Internal.AlphaFlattener.MetroDevice0.FlushPage(ILegacyDevice sink, Double width, Double height, Nullable`1 outputQuality) at Microsoft.Internal.AlphaFlattener.MetroToGdiConverter.FlushPage() at System.Windows.Xps.Serialization.NgcSerializationManager.EndPage() at System.Windows.Xps.Serialization.NgcSerializationManager.WalkVisual(Visual visual) at System.Windows.Xps.Serialization.NgcSerializationManager.SaveAsXaml(Object serializedObject) at System.Windows.Xps.XpsDocumentWriter.SaveAsXaml(Object serializedObject, Boolean isSync) at System.Windows.Controls.PrintDialog.PrintVisual(Visual visual, String description) at PrintFontTest.Window1.Print(PrintDialog dlg) in C:\Users\me\Documents\Visual Studio 2005\Projects\PrintFontTest\PrintFontTest\Window1.xaml.cs:line 72 The defect doesn’t occur when printing to the built-in “Microsoft XPS Document Writer” print driver, since that is apparently an XPS-native print driver. The defect will occur when printing to any regular GDI print driver. I’ve used a couple of commercial font validation programs to determine if the font files are corrupt. They are not. These fonts print fine using a win32-based app. It’s only in the XPS to GDI conversion code that the exception occurs, as the stack trace shows. These are the fonts I have installed on my system that cause the defect: A770-Deco A780-Deco A850-Deco Abilene Accent AdvertisersGothic Alfredo AmericanText B650-Deco B790-Deco B821-Deco BallantinesSerial Balloon Xbold Bristol C650-Script C720-Deco C790-Deco Cimarron Cimarron-CE Cimarron-Exp Cimarron-Fig Cimarron-PC8 Cornered D730-Deco D891-Deco Delaware DiamanteSerial Xlight Dom E820-Deco EgyptianWide Estelle F761-Deco F820-Deco Gandalf Greyhound Greyhound BoldItalic Hubert Hudson Ingrid Inverserif LookingGlass M730-Deco OrganGrinder PalazzoWerk Pittsburgh The exception occurs on both Vista and XP, and both 32-bit and 64-bit systems. Any help with this problem would be greatly appreciated. I can also supply a simple test application that demonstrates the defect (though you would need at least one of the problematic fonts installed). Thanks, Jeremy@criticalpath.com (GeneW) |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| TcpClient throws "invalid pointer address" exception on Server 2008 | .NET General | |||
| SendKeys throws "Hook cannot be created" security exception in Vista Beta 2 | Vista security | |||