Message 1 of 2
eInvalidInput FontDescriptor
Not applicable
09-15-2008
05:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This one really has me stumped... whenever I attempt to create a TextStyleTableRecord of a particular font name, I get "Runtime.Exception: eInvalidInput". The textstyle function works for other fonts, just not this particular one. The font folder is in both the Support File Search Path and Working Support File Search Path... not only that, but the font that doesn't work shows up inside of AutoCAD with the STYLE command. Here is the AddTextStyle code, as well as the function calls (two that work, the one that doesn't).
Public Shared Sub AddTextStyle(ByVal TextStyleName As String, ByVal FontName As String, ByVal width As Double)
Dim myDWG As ApplicationServices.Document
Dim myDB As DatabaseServices.Database
Dim myTransMan As DatabaseServices.TransactionManager
Dim myTrans As DatabaseServices.Transaction
myDWG = ApplicationServices.Application.DocumentManager.MdiActiveDocument
myDB = myDWG.Database
myTransMan = myDWG.TransactionManager
myTrans = myTransMan.StartTransaction
Dim myTST As DatabaseServices.TextStyleTable
Dim myTSTR As DatabaseServices.TextStyleTableRecord = New DatabaseServices.TextStyleTableRecord
Try
myTST = myDB.TextStyleTableId.GetObject(DatabaseServices.OpenMode.ForWrite)
myTSTR.Name = TextStyleName
Dim myFont As New GraphicsInterface.FontDescriptor(FontName, False, False, 0, 0)
myTSTR.Font = myFont
myTSTR.XScale = width
myTST.Add(myTSTR)
myTrans.AddNewlyCreatedDBObject(myTSTR, True)
Catch ex As Exception
If ex.Message = "eDuplicateRecordName" Then
' style is already present
myTSTR.Dispose()
myTrans.Dispose()
Exit Sub
Else
MsgBox(ex.ToString)
myTSTR.Dispose()
myTrans.Dispose()
Exit Sub
End If
End Try
myTrans.Commit() : myTrans.Dispose()
myDWG.Database.Textstyle = myTSTR.ObjectId
End Sub
Here are the two functions that work perfectly:
_
Public Sub leroy(ByVal args As ResultBuffer)
AddTextStyle("LEROY", "romans", 0.85)
End Sub
_
Public Sub leroy2(ByVal args As ResultBuffer)
AddTextStyle("LEROY2", "romand", 0.85)
End Sub
And here is the one that fails miserably:
_
Public Sub kroy(ByVal args As ResultBuffer)
AddTextStyle("KROY", "au102s01", 0.85)
End Sub
Please help?
Public Shared Sub AddTextStyle(ByVal TextStyleName As String, ByVal FontName As String, ByVal width As Double)
Dim myDWG As ApplicationServices.Document
Dim myDB As DatabaseServices.Database
Dim myTransMan As DatabaseServices.TransactionManager
Dim myTrans As DatabaseServices.Transaction
myDWG = ApplicationServices.Application.DocumentManager.MdiActiveDocument
myDB = myDWG.Database
myTransMan = myDWG.TransactionManager
myTrans = myTransMan.StartTransaction
Dim myTST As DatabaseServices.TextStyleTable
Dim myTSTR As DatabaseServices.TextStyleTableRecord = New DatabaseServices.TextStyleTableRecord
Try
myTST = myDB.TextStyleTableId.GetObject(DatabaseServices.OpenMode.ForWrite)
myTSTR.Name = TextStyleName
Dim myFont As New GraphicsInterface.FontDescriptor(FontName, False, False, 0, 0)
myTSTR.Font = myFont
myTSTR.XScale = width
myTST.Add(myTSTR)
myTrans.AddNewlyCreatedDBObject(myTSTR, True)
Catch ex As Exception
If ex.Message = "eDuplicateRecordName" Then
' style is already present
myTSTR.Dispose()
myTrans.Dispose()
Exit Sub
Else
MsgBox(ex.ToString)
myTSTR.Dispose()
myTrans.Dispose()
Exit Sub
End If
End Try
myTrans.Commit() : myTrans.Dispose()
myDWG.Database.Textstyle = myTSTR.ObjectId
End Sub
Here are the two functions that work perfectly:
Public Sub leroy(ByVal args As ResultBuffer)
AddTextStyle("LEROY", "romans", 0.85)
End Sub
Public Sub leroy2(ByVal args As ResultBuffer)
AddTextStyle("LEROY2", "romand", 0.85)
End Sub
And here is the one that fails miserably:
Public Sub kroy(ByVal args As ResultBuffer)
AddTextStyle("KROY", "au102s01", 0.85)
End Sub
Please help?