LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Fonts under Linux

Hello all (yet again),
CVI under Linux sure uses some ugly-ass fonts.
And in ways that I don't understand.

If I keep the default NIDialogMetaFont in my user interface, then things are
OK, but if I try to use bold or italic, then it turns into a disaster: the
resulting text is much larger and appears to be a different font altogether.

Is there a way to use the same fonts on windows and linux UIR ? Both systems
can use TTF, right ? So is it possible to copy the TTF files from Windows to
Linux ?

What is the correspondance between NIDialogMetaFont,
NIDialogMetaFontPrototypeBoldface (bold), NIDialog (italic) and real fonts ?
Where is it determined in both systems ? Can I manipulate the equivalencies
?
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 1 of 7
(3,522 Views)

It sure seems like the mapping of the NI meta fonts has some gaps in it, and the next closest font is not so close.

 

I can't help much with Linux, but here are a few clues:

 

NI font mappings (dated!) http://digital.ni.com/public.nsf/allkb/930E95F6633AA2EB86256242004CEDD2

 

I presume that you can install the equivalent TrueType fonts on your Linux machine and use them. In Windows I check for a specific TrueType font right up front like this:

  breakstat = SetBreakOnLibraryErrors(0);
  err = GetFontTypefaceName ("Tahoma", tahomafontsname);
  if (err < 0) {
   MessagePopup("Missing Font","Program requires the 'Tahoma' font to be installed.");
   exit(-1);
  }
  SetBreakOnLibraryErrors(breakstat);

 

Edit: A test program I posted ages ago here may be of use. 

 

Hope this helps

 

--Ian

Message Edited by Ian W on 11-06-2008 03:09 PM
0 Kudos
Message 2 of 7
(3,510 Views)
Hmmm, this is apparently a muddy issue.

So I can convert "MS Sans Serif" and System fon files to bdf and install
them on my linux system.

Or maybe the best option would be to standardize all the text of the UIR on
a
common Windows/Linux ttf file (Arial, Tahoma, I don't know what would make a
good target).

Instead of going through my entire UIR and changing everything, is there a
way to match NIDialog to a given font ?
--
Guillaume Dargaud
http://www.gdargaud.net/





0 Kudos
Message 3 of 7
(3,495 Views)
I saw the following and very similar thread:
http://forums.ni.com/ni/board/message?board.id=180&thread.id=33984

So I tried the following _before_ loading my UIR file (not sure if it's the
proper way to proceed):
CreateMetaFont("NIDialogMetaFontPrototypeBoldface", "NIDialogMetaFont", 11,
1, 0, 0, 0);
CreateMetaFont("NIDialog", "NIDialogMetaFont", 11, 0, 1, 0, 0);

or this:
CreateMetaFont("NIDialogMetaFontPrototypeBoldface", "NIDialog", 11, 1, 0,
0, 0);
CreateMetaFont("NIDialogMetaFont", "NIDialog", 11, 0, 1, 0, 0);

With no change (see images).

So I try the following to set it manually:
SetFontPopupDefaults (0, 0, 0, 0, 0, VAL_LEFT_JUSTIFIED, VAL_BLACK, Size);
FontSelectPopup ("Select a base font", "Sample Text 0123", 0, Font,
&Bold, 0, 0, &Italic, 0, 0, &Size, 6, 48, 1, 1);
CreateMetaFont("NIDialogMetaFontPrototypeBoldface", Font, Size, 1, 0, 0,
0);
CreateMetaFont("NIDialog", Font, Size, 0, 1, 0, 0);
//CreateMetaFont("NIDialogMetaFont", Font, Size, 0, 0, 0, 0);
But the last line returns a lib error -14 (value is invalid or out of
range).
And in any case it doesn't change the fonts when I load the UIR.
--
Guillaume Dargaud
http://www.gdargaud.net/



0 Kudos
Message 4 of 7
(3,491 Views)

I'm not going to be able to get Guillaume to an answer -- others please chime in!

 

--Ian

0 Kudos
Message 5 of 7
(3,465 Views)

If you are loading a uir that already has a defined font (with a specific size or other attribute) then there is not much you can do to change the resulting panel without resetting the fonts in the panel. Only when the font is saved as NIDialogMetaFont, NIAppMetaFont, NIEditorMetaFont, NIMenuMetaFont or NIMessageBoxMetaFont is a size adjustment made at load time. On Linux, we make an 11 point NIDialogMetaFont into an 8 point font so that it is sized correctly for your panel. If your panel stores that it needs an 11 point bold font then it is going to get a true 11 point font which is much larger than you expect. If you start with the NIDialogMetaFont on Linux and then apply the bold attribute, I think it should be about the right size. Additionally if you set the font to be much smaller, around 8 point, in the uir then it should size correctly as well.

 

We know that our handling of font sizes between Windows and Linux is very poor and it is on our to do list to update in a future version. We also intend to add True Type font support at the same time.

 

Michael

NI

0 Kudos
Message 6 of 7
(3,446 Views)
> I'm not going to be able to get Guillaume to an answer -- others please
> chime in!

The only way I can think off right now is to loop through the entire user
interface, changing dynamically the font for all labels and text. And not
only that but it screws up the alignments too. There must be a better way to
change all UIR fonts at once at runtime.
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 7 of 7
(3,425 Views)