TheSwamp

Code Red => .NET => Topic started by: samisoft on June 24, 2023, 11:27:55 AM

Title: get the list of all available fonts in AutoCAD
Post by: samisoft on June 24, 2023, 11:27:55 AM
How can I get the list of all available fonts in AutoCAD?

 I received the following code , but the reference FontTable is not there in AutoCAD !!!

Code: [Select]
using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                // Get the font table object
                FontTable fontTable = (FontTable)tr.GetObject(db.FontTableId, OpenMode.ForRead);
               
                // Iterate through the font table records and print the font names
                foreach (ObjectId fontId in fontTable)
                {
                    FontTableRecord fontRecord = (FontTableRecord)tr.GetObject(fontId, OpenMode.ForRead);
                    string fontName = fontRecord.Name;
                    ed.WriteMessage("\n" + fontName);
                }
               
                tr.Commit();
            }

THE name space of FontTable could not e found !


 
Title: Re: get the list of all available fonts in AutoCAD
Post by: kdub_nz on June 24, 2023, 05:26:42 PM
As noted over on f5 there is no such class as FontTableRecord.

would be nice if you posted your revised code here when finished.