How can I use a font not installed on the PC?

Need help in implementing some specific function to your LightningChart Ultimate powered application? Post a question and get code snippets from other LightningChart Ultimate community members.

Moderator: Queue Moderators

Post Reply
Energetic
Posts: 5
Joined: Wed Jun 03, 2020 10:56 am

How can I use a font not installed on the PC?

Post by Energetic » Fri Apr 30, 2021 11:46 am

Hello,
Is it possible to use a font for the axis title and labels, which is not installed on the computer but supplied with the application as .ttf file? It is included as a resource in a WPF application. In a resource dictionary I can use it without problems for TextBoxes in the application but the charts are not accepting it. Could you please tell me how I can use it?

I tried:
Dim font = New WpfFont(13)
font.Family = DirectCast(Application.Current.FindResource("MarvelFontFamily"), FontFamily)
yAxis.LabelsFont = font

or alternatively loading the font into a PrivateFontCollection and then using the Syste.Drawing.FontFamily:
font = New WpfFont(FontCollection.Families(0), 12, FontStyle.Regular)

but none of those resultated in a change of the labels font.

ArctionKestutis
Posts: 552
Joined: Mon Mar 14, 2016 9:22 am

Re: How can I use a font not installed on the PC?

Post by ArctionKestutis » Fri Apr 30, 2021 1:36 pm

We have such feature request in our wish-list, but currently it is not possible to use custom font from the resources (for charting). The workaround is to install font in the system folder and use family name string in constructor.

Energetic
Posts: 5
Joined: Wed Jun 03, 2020 10:56 am

Re: How can I use a font not installed on the PC?

Post by Energetic » Fri Apr 30, 2021 2:14 pm

Ok, Thank you for the quick response

Post Reply