eInvalidInput FontDescriptor

eInvalidInput FontDescriptor

Anonymous
Not applicable
616 Views
1 Reply
Message 1 of 2

eInvalidInput FontDescriptor

Anonymous
Not applicable
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?
0 Likes
617 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
After posting I realized that the LispFunction wrapper disappeared due to the attempt at formatting in these text boxes... so just to clarify, the last three functions are all LispFunctions named (leroy), (leroy2) and (kroy), respectively... that's why they have the args parameter.
0 Likes