I've looked for answer to this everywhere but with no luck..
I need to dynamically create graphic text from database values. I've got this working fine if I use arial as the font but I want to use another font.
Now - presumably I can use any font installed on the server? But it doesn't seem to work. I want to use a font called blurLight but it just outputs in arial (I think - it's a standard font anyway)
Is there anything else I need to do to make other fonts available to asp.net other than just installing them on the server???
Thank you.Post some code so we can have a looksie
Alright - I will
<%@. Page Language="VB" Debug="True" %>
<%@. Import Namespace="System.Drawing" %>
<%@. Import Namespace="System.Drawing.Imaging" %>
<%@. Import Namespace="System.Drawing.Text" %>
<%
' Declare Vars
Dim objBMP As System.Drawing.Bitmap
Dim objGraphics As System.Drawing.Graphics
Dim objFont As System.Drawing.FontobjBMP = New Bitmap(100, 30)
objGraphics = System.Drawing.Graphics.FromImage(objBMP)
objGraphics.Clear(Color.Green)
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias
objFont = New Font("Arial", 16, FontStyle.Bold)
objGraphics.DrawString("Hello World", objFont, Brushes.White, 3, 3)
Response.ContentType = "image/GIF"
objBMP.Save(Response.OutputStream, ImageFormat.Gif)objFont.Dispose()
objGraphics.Dispose()
objBMP.Dispose()
%
That code works fine but when I replace Arial with the font I want to use - it doesn't work..
Any ideas??
0 comments:
Post a Comment