06-16-2016 09:09 AM - edited 06-16-2016 09:10 AM
I have a string control set to System Font. What I would like to know, is how can I programatically know what the name of this font is in the system? Similarly if my font is set to Dialog, or Application. What is the actual name being used on the system? I am making a web interface mirroring a VI front panel, and the fonts aren't quite right and I think that could be a reason why because the font being resolves isn't the right one. As a temporary solution I'm going to be setting these string controls to a defined known font, but I'd like to support these system level fonts too. Thanks.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
Solved! Go to Solution.
06-16-2016 09:54 AM
So,
Well there is some kind of an underground way to do this. I will not post a snippet but I know you'll get away with that.
If you never touched the default Application/System/Dialog Box settings in LV options (in Environment category), then LV will use the Windows font (by default Segoe UI unless you have enabled ClearType feature). There might be a WinAPI function to get that information but that's not really LV-relevant.
If you have changed the fonts in the options at some point, you can use the Configuration.GetSettings method on the Application class. Pass appFont, systemFont or dialogFont as the setting name to get the real name of the font, its size and its attributes (bold, italic...). If you get Error 20, it means LV uses the default values.
Hope this can work for your use case!
--Eric
Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.
06-16-2016 09:59 AM
HI Hoovah,
I think you can read it in the LabVIEW.ini file if it st in labVIEW option.
In mine i got
NoAdvice080=",ClassBrowser"
ProbeDefaultCache_15_0=""
systemFont="1" 14
Hope this help.
06-16-2016 10:25 AM
Sorry, misread the problem.
It should be possible with register key.
HKEY_CURRENT_USER\Control Panel\Colors
HKEY_CURRENT_USER\Control Panel\Desktop\Colors
HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics
as when you click on active panel you get the system font info.*
Regards
06-17-2016 04:56 AM
Hi Hooovahh,
Found another solution. UsingPropriété SystemFonts::DefaultFont. with a .net contructor node.
Didn't spend much time on finding the right constructor or method.
Regards