How to add fonts to cadImage library, I have tried, but can not search fonts
Posted: 03 Feb 2023, 10:24
I added the shx path with the following code, but the number of fonts searched was 0; I don't know what went wrong. I hope you can help me. Thank you very much.
SearchedFonts = Count = 0
SearchedFonts = Count = 0
Code: Select all
CADImage cAD = CADImage.CreateImageByExtension(@"d:\123.dwg");
cAD.LoadFromFile(@"d:\123.dwg");
var shxFonts = cAD.Converter.SHXSettings;
string shxPath = Path.GetFullPath(@".\shx");
var shxFonts1 = cAD.Converter.SHXFonts;
shxFonts1.SearchPath.Clear();
shxFonts1.SearchPath.Add(shxPath);
cAD.SearchSHXPaths = true;
cAD.SHXSearchPaths = shxPath;
cAD.UseSHXFonts = true;
var shxFonts2 = cAD.Converter.SHXFonts;
foreach (var item in cAD.Converter.Entities)
{
if (item is CADShape shape)
{
// shape.ShapeName = "742";
}
}
CADtoDWG.SaveAsDWG(cAD, @"d:\999.dwg");
CADExport expObject = new CADtoDXF(cAD);
expObject.SaveToFile("d:\\666.dxf");