04-01-2010 04:41 PM
I'm wondering how best to deal with non-standard fonts used in a CVI project? I've got an application that uses the "SWAstro" font for up and down arrows as indicators in a CVI Table. When running the executable on a computer that has CVI installed, the arrows show up just fine. On computers that only have the CVI run time engine installed, the arrows simply show up as vertical bars.
Is there a way to have my program install a font if it's needed? Am I better off just including the font file with the executable and having the user install it themselves separately? I've tried to find a more generalized windows font that has up and down arrows, but the ones I've found (like Wingdings 3) don't seem to be available in CVI.
Thanks in advance for the help!!
Solved! Go to Solution.
04-02-2010 12:53 AM
Hi,
You may not be able to set the font as "Wingdings 3" from UIR editor, but it is possible from the code.
Below is a simple example. It sets the label of a control to the symbol corresponding to "a" key on the keyboard.
You just have to figure out the correct key for the symbol you want.
SetCtrlAttribute (pnl, ctrl, ATTR_LABEL_FONT, "wingdings 3");
SetCtrlAttribute (pnl, ctrl, ATTR_LABEL_TEXT, "a");
04-02-2010 04:08 AM
04-02-2010 06:05 PM - edited 04-02-2010 06:05 PM
Thanks for the help. Using charmap.exe, I was able to take a better look at what fonts had up and down arrows associated with the font set. After doing a little more reading, I found the Wingdings 3 gets installed with MS Office. Since I'm not sure that the PCs that will be running my application will have MS Office installed (probably not), Wingdings 3 probably isn't a good choice either. However, I did find that the "Symbol" font is installed with Windows XP and Vista (I assume Win 7 as well), and it has up and down arrows. I'll give that a shot and see if it works. I'm actually already using the "SetCtrlAttribute" to set the font in the table. I just didn't realize that SetCtrlAttribute would recognize fonts that were not available in the UIR editor.
So I gues there's no way to have my application install a font that I distribute with the executable?
Thanks!
04-03-2010 10:37 AM
Hi,
In the distribution kit builder, you can set a font file to be copied to Fonts folder of Windows (see attachment).
I believe that causes the font to be installed.
So you can distribute your font with the application.
However, beware that fonts are considered intellectual property so, better be sure you are allowed to distribute it.
04-05-2010 11:45 AM - edited 04-05-2010 11:49 AM
Thanks for the added info. I'll keep this in mind for future reference. I tried using the "Symbol" font today, and it worked great with the following:
SetCtrlAttribute (pnl, ctrl, ATTR_LABEL_FONT, "Symbol");
SetCtrlAttribute (pnl, ctrl,
ATTR_LABEL_TEXT, "\xAF"); // up arrow
SetCtrlAttribute (pnl, ctrl, ATTR_LABEL_TEXT, "\xAD"); // down arrow
This winds up being the simpler solution for my application because the user prefers a stand alone exe file (release build). Using the readily available Symbol font keeps me from having to put together a distribution kit that would require a full installation process.
Thank again!