Trouble displaying Text Style
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This is my code for creating the text style. I am trying to create a text style called romans using the romans.shx font. However, when I display my text using romans, the text looks thick. When I type in style at the command line to look at the new style, it is showing Regular in the Font Style section. It normally is not supposed to show anything. Also the Vertical box is highlighted. If I change the font manually to a different one and then back to romans.shx the font goes back to normal. What am I missing in my code that will fix that?
'Setup a transaction to the drawing
Using lock As DocumentLock = MyDrawing.LockDocument
Using acTrans As Transaction = MyDrawing.TransactionManager.StartTransaction()
Dim strTableTextStyle As String = "romans"
'' Open the Text style table for read
Dim myTextStyleTable As TextStyleTable = acTrans.GetObject(MyDrawingDb.TextStyleTableId, OpenMode.ForRead)
'Check if text style exists in table
If myTextStyleTable.Has(strTableTextStyle) = False Then
'Create a new Text style record
Dim myTextStyleTableRec As TextStyleTableRecord = New TextStyleTableRecord
''Assign the Text style name
myTextStyleTableRec.Name = strTableTextStyle 'name
'Get the font
Dim myNewTextStyle As New GraphicsInterface.FontDescriptor(strTableTextStyle, False, False, 0, 0)
''Assign the Text style properties
myTextStyleTableRec.Font = myNewTextStyle 'font .shx file
myTextStyleTableRec.TextSize = 0.125 'text size
myTextStyleTableRec.XScale = 0.85 'width factor
'' Upgrade the Textstyle table for write
myTextStyleTable.UpgradeOpen()
'' Append the new textstyle to the textstyle table and the transaction
myTextStyleTable.Add(myTextStyleTableRec)
acTrans.AddNewlyCreatedDBObject(myTextStyleTableRec, True)
acTrans.commit()
End If
End Using
End Using