LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to have two fonts apply to one string? or use symbols amongst normal font?

Solved!
Go to solution

Hi,

Is it possible to apply two different fonts to one string, or use symbols amongst normal font? My purpose is to display an Omega symbol after some number.

 

".99982 Ω" or "-180 φ"

 

I am using version 6.0,

Thanks in advance!

0 Kudos
Message 1 of 3
(3,629 Views)

It's not possible to use differnt fonts in the same text control (string, text message, text box, listbox...) or in the label for any control.

An alternative solution can be to use a font that natively includes the letters / symbols you need. Within CVI 6 native fonts you can use NISystemMetaFont which includes uppercase omega letter together with other commonly used greek letters (and uppercase / lowercase alphabet and numbers, of course Smiley Wink ).

In charmap the font is seen as NISYSTEM: with that program you can see all characters included in the font file and select / copy each of them to paste in CVI controls if you need it.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(3,609 Views)
Solution
Accepted by topic author TurboMetrologist

In addition to being able to use charmap to cut and paste, charmap also shows the codes you can use to programmatically create the character.  For example, with the NISYSTEM font loaded into charmap (as suggested by Roberto), when you point to the omega character, charmap displays "U + 00EA".  "U" indicates that it is a Unicode font.  With a Unicode font loaded, you can use the escape sequence \xea for the omega character.

 

For example:

 

char myString[80];
double ohmsReading = 3.14;

// ...

 
SetCtrlAttribute (panelHandle, PANEL_STRING, ATTR_TEXT_FONT,
       "NISYSTEM");

 

sprintf(myString, "%f \xea", ohmsReading);

 

SetCtrlAttribute (panelHandle, PANEL_STRING, ATTR_CTRL_VAL, myString);

 

// ...

 

Use your own appropriate names for panelHandle, PANEL_STRING, etc.

 

P.S. To run the charmap character viewer, on the Windows toolbar click on Start >> Run, then enter charmap.  Use the drop-down box labeled Font to select your font.
 

0 Kudos
Message 3 of 3
(3,593 Views)