Font Error
Posted: Tue Jun 05, 2012 4:30 pm
When my charting application encounters problems it records the call stack in a file and eventually sends that error message to me. Periodically I see errors coming through from customers that are the result of setting a font. It seems that, say, the Verdan font on one machine is not exactly like the Verdana font on another. Here is a sample call stack from the error that I am seeing. If you could trap the error in the code so the control does not blow up if a user sets some font that does not happen to work quite right, I would really appreciate it.
In this case the user's system does not support a Regular style for the Verdana font. The result is that the control either crashes entirely or becomes a window with a big X through it. Trapping the error and/or replacing it with a very generic font if an error occurs would be very useful.
FONT 'VERDANA' DOES NOT SUPPORT STYLE 'REGULAR'.
AT SYSTEM.DRAWING.FONT.CREATENATIVEFONT()
AT SYSTEM.DRAWING.FONT.INITIALIZE(FONTFAMILY FAMILY SINGLE EMSIZE FONTSTYLE STYLE GRAPHICSUNIT UNIT BYTE GDICHARSET BOOLEAN GDIVERTICALFONT)
AT SYSTEM.DRAWING.FONT.INITIALIZE(STRING FAMILYNAME SINGLE EMSIZE FONTSTYLE STYLE GRAPHICSUNIT UNIT BYTE GDICHARSET BOOLEAN GDIVERTICALFONT)
AT SYSTEM.DRAWING.FONT..CTOR(STRING FAMILYNAME SINGLE EMSIZE FONTSTYLE STYLE)
AT STEEMA.TEECHART.DRAWING.CHARTFONT.SETDRAWINGFONT()
AT STEEMA.TEECHART.DRAWING.CHARTFONT.GET_DRAWINGFONT()
AT STEEMA.TEECHART.DRAWING.GRAPHICS3DGDIPLUS.MEASURESTRING(CHARTFONT F STRING TEXT)
AT STEEMA.TEECHART.DRAWING.GRAPHICS3D.TEXTHEIGHT(STRING TEXT)
AT STEEMA.TEECHART.DRAWING.GRAPHICS3D.GET_FONTHEIGHT()
AT STEEMA.TEECHART.TITLE.CALCTITLESIZE(GRAPHICS3D G RECTANGLE RECT)
AT STEEMA.TEECHART.CHART.DRAWTITLEFOOT(RECTANGLE& RECT BOOLEAN CUSTOMONLY)
AT STEEMA.TEECHART.CHART.DRAWTITLESANDLEGEND(GRAPHICS G RECTANGLE& TMP BOOLEAN BEFORESERIES)
AT STEEMA.TEECHART.CHART.INTERNALDRAW(GRAPHICS G BOOLEAN NOTOOLS)
AT STEEMA.TEECHART.CHART.INTERNALDRAW(GRAPHICS G)
AT STEEMA.TEECHART.TCHART.DRAW(GRAPHICS G)
AT STEEMA.TEECHART.TCHART.ONPAINT(PAINTEVENTARGS PE)
AT SYSTEM.WINDOWS.FORMS.CONTROL.PAINTWITHERRORHANDLING(PAINTEVENTARGS E INT16 LAYER)
AT SYSTEM.WINDOWS.FORMS.CONTROL.WMPAINT(MESSAGE& M)
AT SYSTEM.WINDOWS.FORMS.CONTROL.WNDPROC(MESSAGE& M)
AT SYSTEM.WINDOWS.FORMS.CONTROL.CONTROLNATIVEWINDOW.ONMESSAGE(MESSAGE& M)
AT SYSTEM.WINDOWS.FORMS.CONTROL.CONTROLNATIVEWINDOW.WNDPROC(MESSAGE& M)
AT SYSTEM.WINDOWS.FORMS.NATIVEWINDOW.CALLBACK(INTPTR HWND INT32 MSG INTPTR WPARAM INTPTR LPARAM)
In this case the user's system does not support a Regular style for the Verdana font. The result is that the control either crashes entirely or becomes a window with a big X through it. Trapping the error and/or replacing it with a very generic font if an error occurs would be very useful.
FONT 'VERDANA' DOES NOT SUPPORT STYLE 'REGULAR'.
AT SYSTEM.DRAWING.FONT.CREATENATIVEFONT()
AT SYSTEM.DRAWING.FONT.INITIALIZE(FONTFAMILY FAMILY SINGLE EMSIZE FONTSTYLE STYLE GRAPHICSUNIT UNIT BYTE GDICHARSET BOOLEAN GDIVERTICALFONT)
AT SYSTEM.DRAWING.FONT.INITIALIZE(STRING FAMILYNAME SINGLE EMSIZE FONTSTYLE STYLE GRAPHICSUNIT UNIT BYTE GDICHARSET BOOLEAN GDIVERTICALFONT)
AT SYSTEM.DRAWING.FONT..CTOR(STRING FAMILYNAME SINGLE EMSIZE FONTSTYLE STYLE)
AT STEEMA.TEECHART.DRAWING.CHARTFONT.SETDRAWINGFONT()
AT STEEMA.TEECHART.DRAWING.CHARTFONT.GET_DRAWINGFONT()
AT STEEMA.TEECHART.DRAWING.GRAPHICS3DGDIPLUS.MEASURESTRING(CHARTFONT F STRING TEXT)
AT STEEMA.TEECHART.DRAWING.GRAPHICS3D.TEXTHEIGHT(STRING TEXT)
AT STEEMA.TEECHART.DRAWING.GRAPHICS3D.GET_FONTHEIGHT()
AT STEEMA.TEECHART.TITLE.CALCTITLESIZE(GRAPHICS3D G RECTANGLE RECT)
AT STEEMA.TEECHART.CHART.DRAWTITLEFOOT(RECTANGLE& RECT BOOLEAN CUSTOMONLY)
AT STEEMA.TEECHART.CHART.DRAWTITLESANDLEGEND(GRAPHICS G RECTANGLE& TMP BOOLEAN BEFORESERIES)
AT STEEMA.TEECHART.CHART.INTERNALDRAW(GRAPHICS G BOOLEAN NOTOOLS)
AT STEEMA.TEECHART.CHART.INTERNALDRAW(GRAPHICS G)
AT STEEMA.TEECHART.TCHART.DRAW(GRAPHICS G)
AT STEEMA.TEECHART.TCHART.ONPAINT(PAINTEVENTARGS PE)
AT SYSTEM.WINDOWS.FORMS.CONTROL.PAINTWITHERRORHANDLING(PAINTEVENTARGS E INT16 LAYER)
AT SYSTEM.WINDOWS.FORMS.CONTROL.WMPAINT(MESSAGE& M)
AT SYSTEM.WINDOWS.FORMS.CONTROL.WNDPROC(MESSAGE& M)
AT SYSTEM.WINDOWS.FORMS.CONTROL.CONTROLNATIVEWINDOW.ONMESSAGE(MESSAGE& M)
AT SYSTEM.WINDOWS.FORMS.CONTROL.CONTROLNATIVEWINDOW.WNDPROC(MESSAGE& M)
AT SYSTEM.WINDOWS.FORMS.NATIVEWINDOW.CALLBACK(INTPTR HWND INT32 MSG INTPTR WPARAM INTPTR LPARAM)