Unless you have good reason to do otherwise, you should always use standard fonts in your programs, because this ensures that your application will work on every Windows system.
If you want to use non-standard fonts, you should at least adopt the following guidelines:
- Assign the font to form and controls through code in the Form_Load event procedure, not directly to the form or the control at design time. Most important, protect the assignment with an On Error statement, so that if the font doesn’t exist you can still use the default font.
- Provide the end user with a method to customize the font name and size, for example by editing an INI file or the Registry. Obviously, editing the Registry is a risky operation, and it should be performed only by experienced users, so usually the INI file is better. Alternatively, provide a distinct utility that configures the program through an easy-to-use interface.
Function SetFontSize(obj As Object, FontSize As Integer) As Boolean On Error Resume Next obj.Font.Size = FontSize SetFontSize = (obj.Font.Size = FontSize)End Function