Font defaults to Calibri irrespective of Style.Font

Dear Aspose team,

We have the problem that we cannot figure out how to set a specific font, that is not the document default to a piece of text.

We downloaded the sample codes from github: GitHub - aspose-diagram/Aspose.Diagram-for-.NET: Aspose.Diagram for .NET examples, plugins and showcase projects
and we used the sample ApplyFontOnText.cs. This code always applies the font value 4, which corresponds to the Calibri, default font, and in this particular case everything works fine.

We wanted to have a piece of text with a different font, Wingdings, that has ID=3 in the Fonts list of the document. So we changed one line in the sample code.

// Just a little modification. We would like to have another font here (the “Wingdings” font → ID = 3).
shape.Chars[1].Font.Value = 3;

The result is that output saved by the code shows three problems:

  1. The font of the text belonging to the given formatting shows in Calibri, and not in Wingdings.
  2. When we edit the respective shape, the dorpdown on the ribbon of Visio, that should show the font of the text is blank.
  3. All the text that comes after the one with the problematic font is squashed, the letters are on top of each other. When the shape is edited, then they show as one-pixel smudge.

I am attaching a small zip with the code file for convenience and a pdf file showing the issues we have.
Sample code and output vsdx: samples.zip (45.9 KB)
Pdf showing the problems: ApplyFontOnText_Out opened in Visio2013&Visio2016.pdf (1.7 MB)

The issue is present if we open the output file either with Visio 2016 or 2013.

This is a quite blocking issue for us. If you could provide any workaround or a quick fix for this, that would be highly appreciated.

Best regards,

Gergely Vándor

@gergelyv,

We managed to replicate the said issues in our environment. An investigation has been logged under the ticket ID DIAGRAMNET-51469 in our issue tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

@imran.rafique Thanks for the quick reaction. We hope the fix can come out soon.

@gergelyv,

We will notify you once it is fixed. Thank you for the cooperation.

The issues you have found earlier (filed as DIAGRAMNET-51469) have been fixed in Aspose.Diagram for .NET 18.6. This message was posted using BugNotificationTool from Downloads module by imran.rafique

Dear Imran, we checked the fixed version and there is still a bit of an issue with the font handling.

I am attaching sample code as well as a pdf showing explicitly how you can replicate the issue.DiagramFontCollectionIssue.pdf (470.3 KB)
Apply Different Style on the Each Text Value of a Shape.zip (4.2 MB)

What the sample code does is to crate a document with formatting, save it, then reload it into a diagram object.

What you can see on the first page of the pdf is that before saving the diagram has 4 character styles, however reloading the resulting document results in 7 styles.

If we save a document with four styles we expect the same number after reloading it as well.

@gergelyv,

We managed to replicate the problem of the font count in our environment. An investigation has been logged under the ticket ID DIAGRAMNET-51494 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

1 Like

The issues you have found earlier (filed as DIAGRAMNET-51494) have been fixed in this update.