How to Use Fonts in DataFlex
We offer the following advice for working with fonts in DataFlex:
-
Use Windows system fonts. In your application object, make sure that
pbUseWindowsFontis set toTrue. -
Don’t set custom fonts unless you need to. This applies primarily to setting
TypefaceorFontPointHeight. 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. -
If you must set custom font sizes, use
FontPointHeightwhen setting font height. Do not useFontSizeorPhysical_FontSize. -
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 subclass.
-
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). -
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. -
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.