Showing results for 
Search instead for 
Did you mean: 

Set Font Style In Tabular Note



I am trying to set font style "Arial Unicode MS" in tabular note.
But it is not getting applied to note.

But I am able to set "Monospac821 BT".
I have used below code to set this Font.


Dim theCellPrefs As UFTabnot.CellPrefs
ufsession.Tabnot.AskCellPrefs(cellTag, theCellPrefs)
theCellPrefs.text_aspect_ratio = 0.68

'change the font preference setting
Dim fntMonoBT As Integer = workPart.Fonts.AddFont("Monospac821 BT", FontCollection.Type.Standard)
theCellPrefs.text_font = 8
ufsession.Tabnot.SetCellPrefs(cellTag, theCellPrefs) 


So is there any specific integer value for "Arial Unicode MS" like "8" is for "Monospac821 BT".


Re: Set Font Style In Tabular Note

Esteemed Contributor
Esteemed Contributor

I use this (C++, NX10)

    int fontIndex1;
    fontIndex1 = workPart->Fonts()->AddFont("Arial Unicode MS", NXOpen::FontCollection::TypeStandard);

Then use "fontIndex1" as needed.


Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled

Re: Set Font Style In Tabular Note

Honored Contributor
Honored Contributor

NX part files use what is called a "font table" that keeps track of all the fonts used in the current file. Each font gets an integer ID in the part file; the same font may have a different ID in another part file. The journal recorder tends to retrieve the font ID, then use a hard coded value in the code it returns. The good news is that you have all you need in your code currently; it only requires a small change. The .AddFont method returns the ID for the newly added font. In your code above, the variable "fntMonoBT" holds the ID value of the "Monospac821 BT" font in the work part.

In the code above, I would suggest changing:


theCellPrefs.text_font = 8


theCellPrefs.text_font = fntMonoBT

Re: Set Font Style In Tabular Note





Now it is working as expected.