You probably shouldn't change the fonts being used on dashboard controls like buttons and result displays. The reason for this is because the font used for these controls is the machine default for your operating system.
In contrast to documents such as a Word documents or Power Point presentation slides, GoldSim dashboards area user interfaces that are comparable to VBA forms. Because of this, model authors should understand that some of the dashboard controls are not native to GoldSim and GoldSim has no control over their fonts (such as button and edit controls). These controls default to the UI font of the underlying operating system (as used on dialogs). GoldSim is designed so that dashboard controls always use the system-specific UI font, which means that the font might be different depending on the OS version and OS locale.
The default font is MS Shell Dlg. The font will likely be different in cases where a language other than English is used for the user interface of the OS, such as Japanese being used on Windows Vista and Windows 7, where MS Shell Dlg maps to MS UI Gothic. MS Shell Dlg maps to Microsoft Sans Serif if the machine default UI language is set to a language other than Japanese.
Labels (Text and Text Box objects) do not use the system font like other objects, allowing you to choose any font and text size for these objects. Because of this difference, you will likely see labels do not look exactly the same as the other controls. The screenshot below shows the slider control with a header as well as two labels using the specified font and sizes of 8pts and 9pts, respectively.
The first one has the right length but is not high enough. The second one is a bit too high and too wide. This is because the system calculates the best mapping for the slider control font using a number of parameters: OS version, OS locale, display resolution, font family, font mapping based on family, font weight, DPI setting, logical pixel size and more. In the case shown above, the font specifics are:
Typeface name of font = MS Shell Dlg
Font height = -11
Notice that the second attribute is called font height, not font size. Logical fonts in Windows actually don’t have a point size – they have a height! Conversion can be done using the following formula:
lfHeight = -MulDiv(PointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);
There lies the problem, however, as the conversion function is integer-based! In our case the desired font point size is actually 8.5 pts. Unfortunately, you can’t do that with the basic label text. But you can do it with the Text Box control:
As seen above, the Text Box is able to provide a size and font that matches exactly with the slider control header. However, this may have still not always look the same. On a given target system MS Shell Dlg may map to a different font or a slightly different font size. In such case the controls will again look slightly different than your text with hardcoded font size of 8.5 pts.
The image below shows a Text component using the GUI font. It looks good (again, I assume it will not look the same if this model is opened on a system with a different GUI font). Also, the font properties of the Text component would not correctly reflect the current font.
Please sign in to leave a comment.