Community
Database dataBase = Application.DocumentManager.MdiActiveDocument.Database;
Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = dataBase.TransactionManager;
Transaction txtTR = tm.StartTransaction();
// Get the text styles table
TextStyleTable textStyles = (TextStyleTable)txtTR.GetObject(dataBase.TextStyleTableId, OpenMode.ForRead);
// Search for the text style you want to change
if (textStyles.Has("myTextStyle"))
{
SymbolTableEnumerator textStylesEnum = textStyles.GetEnumerator();
TextStyleTableRecord textStyle;
while (textStylesEnum.MoveNext())
if ((textStyle = (TextStyleTableRecord)(textStylesEnum.Current.GetObject(OpenMode.ForRead))).Name.Equals("myTextStyle"))
{
// Now that you have found it, change its font
textStyle.UpgradeOpen();
textStyle.FileName = "ARIALUNI.TTF";
break;
}
textStylesEnum.Dispose();
}
txtTR.Commit();