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?
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 ?