Submitted by bhavik231187 on Tue, 09/27/2016 - 21:09
Forums:
HI,
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: font style
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
to:
theCellPrefs.text_font = fntMonoBT
Likewise, when you use .AddFont to add the "Arial Unicode MS" font, you can use the returned value in later code to change font preferences for annotations.