Using a Font not installed on the Computer
It may have happen to you a time where u needed to use a font that is not (or normally is not) installed in the target computer. You can install it, but installing fonts slows down the system and may need restart. So I went looking (well kleinma may have helped a little) and found this link http://www.bobpowell.net/embedfonts.htm. But as this codes deals with unmanaged memory (and some times can occur some errors), I changed the code to create a temporary file. In my code I used a very uncommon font TI83Pluspc, is the font used by the Graphic Calculator TI-83 Plus, so where is says "\TI-83PL.TTF" you should change by the name of your font file.
First you need to add the font file to the project as you would an image, a sound, etc. Then use this code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim FontCollection As New System.Drawing.Text.PrivateFontCollection()
'Filestream that will create the temporary font file, uses IO.Path.GetTempPath so the file is created in a Temporary folder
Dim FileStream As New IO.FileStream(IO.Path.GetTempPath & "\TI-83PL.TTF", IO.FileMode.Create, IO.FileAccess.Write)
'Creates the File, you can use My.Resources.TI_83PL because its a byte array
FileStream.Write(My.Resources.TI_83PL, 0, My.Resources.TI_83PL.Length)
FileStream.Close()
'Adds the Font to the font collection
FontCollection.AddFontFile(IO.Path.GetTempPath & "\TI-83PL.TTF")
Dim f As System.Drawing.Font
'We will need the FontFamily because of the font styles, because some fonts dont include all styles
Dim ff As FontFamily
'Loop through the Families
For Each ff In FontCollection.Families
'If the regular style is available then uses it, you can use some other style just change this "FontStyle.Regular"
'For the style you want. You can also change its size
If ff.IsStyleAvailable(FontStyle.Regular) Then f = New Font(ff, 8.25, FontStyle.Regular, GraphicsUnit.Point)
Next
'Assign the font to the controls you want to use it in
Textbox1.Font = f
End Sub
And to keep the temporary file from staying on the computer, occupying space you should use this:
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
'As IO.Path.GetTempPath is readonly you don't need to have the path assign to a variable, you can just use this
IO.File.Delete(IO.Path.GetTempPath & "\TI-83PL.TTF")
End Sub
I'm not sure if it will work with all Font types. But with TrueType works perfectly.

