.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

font and shx file validation

1 REPLY 1
Reply
Message 1 of 2
m.yenafaradam
523 Views, 1 Reply

font and shx file validation

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?

1 REPLY 1
Message 2 of 2
Balaji_Ram
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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost