Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Printing some fonts throws exception in XPS to GDI conversion

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-24-2007   #1 (permalink)
GeneW
Guest


 

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 SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using the ObjectDataProvider always throws an exception... Desmond Cassidy Avalon 1 06-20-2007 07:05 AM
SendKeys throws "Hook cannot be created" security exception in Vista Beta 2 Dan Dautrich Vista security 1 03-28-2007 03:47 PM
Bug: MediaElement throws exception on application resize Philippe Lavoie Avalon 2 05-01-2006 08:54 AM
BUG: MediaPlayer throws an exception after multiple play / pause Philippe Lavoie Avalon 0 04-06-2006 04:04 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51