Hi I have been trying to use the open type fonts (.otf files) purchased from Adobe for one of our asp.net web applications. Even after i installed those fonts, Either installedfontcollection is not getting those fonts or using Privatefontcollection also i am
not able to add those fonts. When i use addfontfile method, it says, file not found. Please advice.
Public Class TypeFont
Const GDI32 As String = "gdi32.dll"
Const USER32 As String = "user32.dll"
<DllImport(GDI32)>
Public Shared Function CreateFont(ByVal nHeight As Integer,
ByVal nWidth As Integer,
ByVal nEscapement As Integer,
ByVal nOrientation As Integer,
ByVal fnWeight As Integer,
ByVal fdwItalic As Integer,
ByVal fdwUnderline As Integer,
ByVal fdwStrikeOut As Integer,
ByVal fdwCharSet As Integer,
ByVal fdwOutputPrecision As Integer,
ByVal fdwClipPrecision As Integer,
ByVal fdwQuality As Integer,
ByVal fdwPitchAndFamily As Integer,
ByVal lpszFace As String) As Integer
End Function
Shared Function CreateFont(FontName As String, FontSize As Integer, Optional ByVal Escapement As Integer = 0, Optional ByVal Orientation As Integer = 0, Optional ByVal FontWeight As Integer = 0, Optional ByVal IsItalic As Integer = 0, Optional ByVal Underline As Integer = 0, Optional ByVal StrikeOut As Integer = 0, Optional ByVal Charset As Integer = 0, Optional ByVal OutputPrecision As Integer = 0, Optional ByVal ClipPrecision As Integer = 0, Optional ByVal Quality As Integer = 5, Optional ByVal PitchAndFamily As Integer = 0) As Font
Return Font.FromHfont(CreateFont(FontSize, 0, Escapement, Orientation, FontWeight, IsItalic, Underline, StrikeOut, Charset, OutputPrecision, ClipPrecision, Quality, 1, FontName))
End Function
End Class
None
0 Points
1 Post
Open Type fonts in vb.net or C#
Jan 15, 2004 01:58 PM|mkanandh|LINK
Member
138 Points
83 Posts
Re: Open Type fonts in vb.net or C#
Dec 26, 2007 10:56 AM|itsurday|LINK
Hi ..
even I am facing the same problem ... did you by any chance get the answer?
itsUrDAY
None
0 Points
1 Post
Re: Open Type fonts in vb.net or C#
Jul 28, 2018 02:49 PM|PoyrazTheVBCoder|LINK
try this:
Using:
XXXX = Font Name
YYYY = Font Size (Pixel)
I hope it helped!