简体   繁体   中英

How to find if a font is installed on the system inside LabWindows CVI?

In a panel from a User Interface Resource file there are few Text Message controls with special fonts (this is an old project where UIR was already deigned and is used in production so cannot change it). At design time LabWindows detects if the font is installed in the current system and if not it shows this in the Edit Text Attributes dialog with a (not found) suffix, as shown in this picture Font Not Found

But on run time if the font is still not available the executable will pick up another font which might not fit the designed control size.

Is it possible to detect at startup if the font is available and if not to warn the user to install it? System details: oldish LabWindows-8.5 on Windows-10 64-bit. Did try to search Google and National Instruments but didn't find an answer. Also did try this code:

  char buff[1024];
  int xx = GetFontTypefaceName("Digital-7", buff);

but it always returns xx=9 and buff="Digital-7" indifferently if the font is installed or not on the test computer.

Here's at design time when LabWindows detects that the font is installed: Font found

From Ni forum got a hint that indeed GetFontTypefaceName would be the way to go. Unfortunately it works in CVI versions 2009 or newer and I'm stuck with 8.5(2008). Most probably it was bugfixed in 9.0 or newer but didn't find any trace in their changelogs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM