Author Topic: get the list of all available fonts in AutoCAD  (Read 2135 times)

0 Members and 1 Guest are viewing this topic.

samisoft

  • Mosquito
  • Posts: 1
get the list of all available fonts in AutoCAD
« 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 !


 

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2145
  • class keyThumper<T>:ILazy<T>
Re: get the list of all available fonts in AutoCAD
« Reply #1 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.

Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.