简体   繁体   English

如何在 LabWindows CVI 中查找系统上是否安装了字体?

[英]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).在来自用户界面资源文件的面板中,很少有带有特殊 fonts 的文本消息控件(这是一个旧项目,其中 UIR 已经设计并用于生产,因此无法更改)。 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在设计时 LabWindows 会检测字体是否安装在当前系统中,如果没有,它会在 Edit Text Attributes 对话框中显示,并带有(未找到)后缀,如图所示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.系统详细信息:Windows-10 64 位上的旧 LabWindows-8.5。 Did try to search Google and National Instruments but didn't find an answer.确实尝试搜索 Google 和 National Instruments 但没有找到答案。 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.但无论字体是否安装在测试计算机上,它总是返回 xx=9 和 buff="Digital-7" 。

Here's at design time when LabWindows detects that the font is installed: Font found这是在设计时 LabWindows 检测到字体已安装:找到字体

From Ni forum got a hint that indeed GetFontTypefaceName would be the way to go.Ni 论坛得到一个提示,确实GetFontTypefaceName将是 go 的方式。 Unfortunately it works in CVI versions 2009 or newer and I'm stuck with 8.5(2008).不幸的是,它适用于 CVI 2009 或更高版本,我坚持使用 8.5(2008)。 Most probably it was bugfixed in 9.0 or newer but didn't find any trace in their changelogs .很可能它在 9.0 或更高版本中已修复错误,但在其更改日志中未找到任何痕迹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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