Conversion from DXF to EMF is substituting +_ with accesnts

When I used the Aspose Cad api to convert a DXF file to an EMF file, if the DXF file has a +_ symbol that sit on top of each other, in the EMF file, that symbol is substituted for an accesnt character (`) and the lettering in emboldened. I have tried the conversion on windows 2019, 2022 and 10, same results.
Please help

@rnzimiro,
Hi.
Please, attach the initial DXF file and conversion code so we can reproduce the issue on our side.

Code.zip (8.3 KB)

@rnzimiro,
could you please check whether this file is fine or not? What version of Aspose.CAD do you use?
a010001020_1.dxf.emf.zip (129.7 KB)

Yes, this EMF is good. What did you do differently?
Runtime version 23.4.0.0

@rnzimiro,
nothing special, just commented out colors (with the latest 24.4):

 //cOption.BackgroundColor = Color.Transparent;
 //cOption.DrawType = CadDrawTypeMode.UseObjectColor;

Do you have simplex_.ttf installed in operation system?

I do not have simplex_.ttf. Do I need it? I also need the resulting EMF to be transparent, so I need those options included

@rnzimiro,
please try to install it so we can check if this is the source of the issue.

Where do I get that from?

@rnzimiro,
this font comes with AutoCAD, but give us some time to look better at this problem.

I installed the simplex font on a standalone machine and ran the code. It did not work. Does autocad need to be installed on the server/pc where the conversion is taking place, in case there is more to it than the font, to get the correct rendering?

@rnzimiro,
no, AutoCAD is not required. But DXF/DWG drawings may use fonts typically included by Autodesk in AutoCAD distribution. For instance, in this drawing the default “simplex” font is used for text, but “±” symbol is written with another “gdt” font. We will investigate what we can do here in the scope of CADNET-9762.

Thanks. Keep me posted. Also do I need to update to Aspose.CAD 24.4?

@rnzimiro,
the necessity to update will be clear later after we see how this is possible to fix.

Thanks… Any updates?

@rnzimiro,
not yet, I will post update here once we have more information.

Following up … to see if there are any updates

@rnzimiro,
So, this file uses SIMPLEX and GDT fonts. That’s good idea to have both of them. The file stores “±” symbol using special GDT font, so accent symbol “`” just corresponds to “±” in GDT font. If there is not such font you can see accent instead of “±” and the same is applicable for other special symbols. So, if there is no such GDT font it is possible only to map proper symbol explicitly:

string fileName = "a010001020_1.dxf";

using (CadImage img = (CadImage)Aspose.CAD.Image.Load(fileName))
{
	List<CadEntityBase> filteredEntities = new List<CadEntityBase>();
	foreach (var entity in img.Entities)
	{
		if (entity is CadDimensionBase)
		{
			CadDimensionBase cadDimension = (CadDimensionBase)entity;

			// replace special sequence %%p that marks "±" symbol
			if (!string.IsNullOrEmpty(cadDimension.Text) && cadDimension.Text.Contains("%%p"))
			{
				cadDimension.Text = cadDimension.Text.Replace("%%p", "±");
			}

			CadBlockEntity block = img.BlockEntities[cadDimension.BlockName];

			foreach (var blockEntity in block.Entities)
			{
				if (blockEntity is CadMText)
				{
					CadMText cadmText = (CadMText)blockEntity;
				}

				if (blockEntity is CadText)
				{
					CadText cadText = (CadText)blockEntity;

					// replace accent for gdt with the correct symbol
					if (cadText.DefaultValue.Contains("`") && FontNameFromStyle(cadText.StyleType, img.Styles) == "gdt")
					{
						cadText.DefaultValue = cadText.DefaultValue.Replace("`", "±");
					}
				}
			}
		}
	}

	var cOption = new CadRasterizationOptions();
	cOption.PageHeight = img.Height * 600;
	cOption.PageWidth = img.Width * 600;
	//cOption.BackgroundColor = Color.Transparent;
	//cOption.DrawType = CadDrawTypeMode.UseObjectColor;
	cOption.GraphicsOptions = new GraphicsOptions { TextRenderingHint = TextRenderingHint.SystemDefault, SmoothingMode = SmoothingMode.HighQuality };
	var options = new EmfOptions() { };
	options.VectorRasterizationOptions = cOption;

	img.Save(fileName + ".emf", options);
}


private static string FontNameFromStyle(string styleName, CadStylesList stylesList)
{
	foreach (var style in stylesList)
	{
		CadStyleTableObject styleTable = (CadStyleTableObject)style;
		if (styleTable.StyleName == styleName)
		{
			return styleTable.PrimaryFontName;
		}
	}

	return null;
}

Thanks for this. I am trying to compile this code but I cannot resolve “CadEntityBase”. What dll is this type defined in?

@rnzimiro,
this example is written for the last Aspose.CAD for .NET 24.4, please try to use CadBaseEntity instead, it was renamed for recent versions.