If I want to use custom font (non-default Windows font) in compiled LV code (EXE or PPL) what is the best way to deploy it? Do I need to install it on the target machine or it can/is somehow embedded into a compiled code? If I need to install it, what would be the best automated approach? How do you manage custom fonts in general?
Solved! Go to Solution.
Generally fonts have to be installed on the target system. Only a few applications have embedded font handling such as Adobes PDF Reader (Adobe is one of the main developers of the Font standards on Mac and Windows so they have both the knowledge and incentive to do such things). But for most others, font handling with the built in OS capabilities is already more than complex enough the handle, so they won't want to start to worry about providing font embedding capabilities into the application itself.
And you can't just drop a font file into the Font folder anymore. That worked back in Windows 95 days but in a modern OS even fonts can be something that can and sometimes do contain malicious code so you need elevated rights to install them in the system.
As such installing a program on a computer also requires elevated rights so the standard method is to create an installer for your program and add the font installation routines in the post install hook of that installer. You can do that even in a LabVIEW generated installer. An easy solution to make sure the font is copied to the right location and added to the registry is to use this tool. The archive even comes with the according source code and it would be relatively simple to create the same code in LabVIEW too but it requires elevated rights. So the easiest would be to simply add the call to FontReg.exe into the PostInstall call for your installer as an installer always is started with elevated rights and any child process started by it inherits those rights too.