How to Use Fonts in DataFlex

We offer the following advice for working with fonts in DataFlex

  1. Use Windows system fonts. In your application object, make sure that pbUseWindowsFont is set to True.

  2. Don’t set custom fonts unless you need to. This applies primarily to setting Typeface or FontPointHeight. If you set these to a custom value, you are creating applications that may require continued maintenance as they are ported to different Windows versions.

  3. If you must set custom font sizes, use FontPointHeight when setting font height. Do not use FontSize or Physical_FontSize.

  4. Set fonts in controls and not their containers. This makes everything easier to model and to understand. If you need to set the same font in multiple controls, consider using a sub-class.

  5. If you want the control to resize based on the font, use the font interface (e.g., FontWeight). If you want the control to stay the same size, use the form_font interface (e.g., Form_FontWeight).

  6. If you want your application to scale well, always use dialog units and avoid using GUI units (e.g., GuiSize, GuiLocation). The exception here is the use of GUI units to make relative adjustments to a view or dialog. This usually involves getting the GUI units, performing calculations and setting other GUI units based on this.

  7. Leave a little extra space between visual objects. When fonts are scaled across Windows versions and DPI settings, the size of a dialog unit is an approximate calculation and is subject to rounding. If you have objects and labels that are tightly packed together on the screen, you may find that they will not fit on other displays. Be aware of this and leave a little breathing room in your design.

In summary, these guidelines encourage you to tread lightly with font changes and to just use the Windows default. Always be aware that you are developing for different Windows appearances and different DPI settings.

 

See Also

Understanding Fonts in DataFlex

Understanding Windows Fonts

How DataFlex Handles Fonts