LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

trouble with special fonts

Solved!
Go to solution

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!!

 

 

0 Kudos
Message 1 of 6
(4,352 Views)
Solution
Accepted by topic author byrd01

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");

S. Eren BALCI
IMESTEK
Message 2 of 6
(4,344 Views)

A final note; 

You can use the "charmap.exe" in Windows (Start > Run > charmap) to see the character codes of such symbols.

 

See the discussion here

S. Eren BALCI
IMESTEK
0 Kudos
Message 3 of 6
(4,340 Views)

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!

Message Edited by byrd01 on 04-02-2010 06:05 PM
0 Kudos
Message 4 of 6
(4,316 Views)

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.

S. Eren BALCI
IMESTEK
0 Kudos
Message 5 of 6
(4,304 Views)

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

or

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!

Message Edited by byrd01 on 04-05-2010 11:49 AM
0 Kudos
Message 6 of 6
(4,279 Views)