Unexpected font names in Diagram.Fonts collection

Hi,

For file Diagram.zip (301.4 KB) using next code in Aspose.Diagram 18.11:

var fonts = new Diagram("Diagram.vsd").Fonts.Cast<Font>().Select(x => x.Name).ToArray();

Fonts include “Sendnya” and “Dhenu”, which are not actually present in specified document.

Thank you.

@WorkZone

Thanks for contacting support.

We have tested the your diagram by exporting it to PDF by MS Visio and noticed that mentioned fonts were not present there. However, would you kindly share how you are checking fonts which are used in the diagram. It would be helpful if you can please share a screenshot with us. We will further proceed accordingly.

Hi,

Following code returns expected font names:

protected override IEnumerable<string> GetFonts(Diagram diagram)
{
	return 
		diagram.Pages.Cast<Page>()
			.SelectMany(page => page.Shapes.Cast<Shape>())
			.SelectMany(GetFonts);

	IEnumerable<string> GetFonts(Shape shape)
	{
		foreach (Aspose.Diagram.Char ch in shape.Chars)
			yield return ch.FontName.Value;

		if (shape.Type == TypeValue.Group)
		{
			foreach (var font in shape.Shapes.Cast<Shape>().SelectMany(GetFonts))
				yield return font;
		}
	}
}

Thanks.

@WorkZone

Thanks for writing back.

It is good to know that you have managed to get the expected font names at your side. You shared code snippet would definitely help others facing similar issue. Please keep using our API and in case you need any further assistance, please feel free to let us know.