.NET

Reply
Active Member
7 Posts
0 Kudos
Registered: ‎05-17-2013
Post 1 of 2

font and shx file validation

214 Views, 1 Replies
09-13-2013 03:07 PM

Hi,
I have a rquirement to valdiate my dwg file with ObjectARX dll (accoreconsole dll) . I want to now if a font is not availble log the error. 
Any clue what should I do?

I  used

private static void FontValidator(Database db, Transaction tr)
{
TextStyleTable styleTable = tr.GetObject(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable;
foreach (var item in styleTable)
{
TextStyleTableRecord styleRecord = item.GetObject(OpenMode.ForRead) as TextStyleTableRecord;

//s.Current.FindFile(styleRecord.FileName,db,FindFileHint.Default)
if (!string.IsNullOrEmpty(styleRecord.Font.TypeFace))//TrueType Font
{
if (!System.Drawing.FontFamily.Families.Any(font => font.Name.Contains(styleRecord.Font.TypeFace)))
System.Windows.Forms.MessageBox.Show("Font : " + styleRecord.Font.TypeFace + "Not found");
}
// styleRecord
}
}

to go all StyleTableRecord but was not succesful to find my used font just there was 4 records

Am I doing the iteration in the right way ? How can I iteraret whole TextStyleTableRecord  in the DWG file?
Any other way to get the result?

ADN Support Specialist
762 Posts
100 Kudos
Registered: ‎03-21-2011
Post 2 of 2

Re: font and shx file validation

09-25-2013 12:12 AM in reply to: m.yenafaradam

Hi,

 

I do not see any problem with the code that you have posted.

 

A possible reason your font is not be identified could be that the MText is using the "\f" formatting to specify a different font without changing the style ?

 

Can you please provide a sample drawing that you are having problem with ?



Balaji
Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!