I'm trying to access to a font programmatically, because i cant install fonts on the sharing hosting
I use this code
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim collection As New PrivateFontCollection()
collection.AddFontFile(Server.MapPath("~\ShadowsIntoLight.ttf"))
Dim image As New Bitmap(500, 500)
Dim g As Graphics = Graphics.FromImage(image)
Dim RedBrush As New SolidBrush(Color.Black)
Dim drawFont As New Font("Shadows Into Light", 36)
g.DrawString("the lazy fox jumped over the brown log", drawFont, RedBrush, 0, 100)
Dim path As String = Server.MapPath("~/image.png")
image.Save(path, ImageFormat.Png)
g.Dispose()
image.Dispose()
Response.Write("<img src=""image.png""/>")
End Sub
but it always displays the Arial font. How can I make it display the specific font
Thank you