I wonder if its possible to use a custom font for my form labels without installing it on the users machine? I would like to display a text using a font I have rights to, but its not installed on the potencial user machine.
Are there any solutions for this?
Here is the extract (using PrivateFontCollection):
Dim pfc As New PrivateFontCollection()
pfc.AddFontFile("C:\Path To\PALETX3.ttf")
label1.Font = New Font(pfc.Families(0), 16, FontStyle.Regular)
Converted from here: Load And Use Custom Font Without Installing It.
Also check this: Embedding/deploying custom font in .NET app
Add this code in Top of your Code
Imports System.Drawing.Text
Add this code on Form1_Load() to change the Lablel1.Font
Dim customfont As PrivateFontCollection = New PrivateFontCollection
customfont.AddFontFile("C:\maven.ttf")
Label1.Font = New Font(customfont.Families(0), 10)
Tested on Visual Basic 2010 Enterprises Edition
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With