Arial Black Italic font causes WinForms application to crash

The WinForms application that I support is broken down into a very small portion of user machines (perhaps around 4 today). The application crashes each time for these users, and it crashes until the very first dialog box is displayed.

Exception

Source:
System.Drawing

Message:
Font 'Arial Black' does not support style 'Bold'.

Stack Trace:
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, GraphicsUnit unit, Byte gdiCharSet)

One of the fonts that the application uses is Arial Black:

this.label3.Font = new System.Drawing.Font("Arial Black", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

The first time it crashed, I noticed a font that was on the user's computer, but not mine. It was called "Arial Black Italic" and it was dated 1997. This was the file name:

ARBLI ___. TTF

enter image description here

The user had Windows XP.

, . , 22 . , "Arial Black Italic" , .

Windows 7, , .

.

+3
1

- .

using System.Drawing;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            // Create regular font first.
            // Depending on the user system, this font may already be bold.
            //

            var theFont = new System.Drawing.Font(
                "Arial Black",
                8.25F,
                System.Drawing.FontStyle.Regular,
                System.Drawing.GraphicsUnit.Point,
                ( ( byte )( 0 ) )
                );

            // If font is not bold, then try to create it.
            //

            if ( ( null != theFont ) && !theFont.Bold )
            {
                if ( theFont.FontFamily.IsStyleAvailable( FontStyle.Bold ) )
                {
                    theFont = new Font( theFont, FontStyle.Bold );
                }
            }

            // Now use the font.
            //

            this.label3.Font = theFont;
        }
    }
}
0

All Articles