hi
I use a special font in my app with textbox and drawstring methods.
How can I install this font with the apllication
i tried to copy the fontfile to windows\fonts folder but even on restart the font does not show up until I manually open the fonts folder and click on the font

font install
Jazz Soft
khan2025
Edited, improved and updated private font info and code at my other thread.
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=542664&SiteID=1
(original hack removed)
AlexSok
(Edited Reply) Experts, is there a way to shorten this code
Imports
System.DrawingImports
System.Runtime.InteropServicesPublic
Class Form1 Public privateFontCollection As New Drawing.Text.PrivateFontCollection Public FamilyName As String Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ' Name embedded resource font file Dim m As New System.IO.MemoryStream(My.Resources.PENMP___) Dim fontStream As IO.Stream = m Dim data As System.IntPtr = Marshal.AllocCoTaskMem(fontStream.Length) 'create a buffer to read in to Dim fontdata() As Byte ReDim fontdata(fontStream.Length) 'fetch the font program from the resourcefontStream.Read(fontdata, 0, fontStream.Length)
'copy the bytes to the unsafe memory blockMarshal.Copy(fontdata, 0, data, fontStream.Length)
'pass the font to the font collectionprivateFontCollection.AddMemoryFont(data, fontStream.Length)
'close the resource streamfontStream.Close()
'free the unsafe memoryMarshal.FreeCoTaskMem(data)
FamilyName = privateFontCollection.Families(0).Name
TextBox1.Font =
New Font(FamilyName, 24.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) End SubEnd
Classrdrast
hi,
Is your problem solved
Thank you,
Bhanu.
Aryan_Patel_05
Hi is this thread still alive I'd like to comment on it..
I was having the same issue as Dewald was describing, I tested the code examplesubmitted by Tall Dude, but it is not working for me. At runtime the variable 'FamilyName' shows the name of my embedded font, but "Sans Serif" is the font actually being assigned to my control by the Font constructor.
Thanks,
Oyvind
LittleNew
Thank you for your reply.I have tried it before without sucsess.I will try it again.
Do you know if a font in the privateFont Collection can be used in a rich text editor, textbox and with the drawString method