Some characters in Shapes are not rendered correctly

Some special characters in text boxes in Word documents are not rendered correctly.

My system:
macOS 10.14.3, dotnet 2.2, Aspose.Words 19.2.0

eg. This text box in a Word document contains less-than, greater-than and asterisk characters:

original.jpg (4.6 KB)

When I load the document and save the shape using the ShapeRenderer they are all invalid:
shape_Textfeld 2.png (1.5 KB)

I am using this code to render it:

            var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ShapeRenderer.Shape.docx");

            var document = new Document(stream);
            var shape = document.GetChildNodes(NodeType.Shape, true).ToArray().First() as Shape;
            var shapeRenderer = shape.GetShapeRenderer();
            var imageSaveOptions = new ImageSaveOptions(SaveFormat.Png)
                Resolution = 96.0f, DmlRenderingMode = DmlRenderingMode.DrawingML, UseGdiEmfRenderer = false,
                UseAntiAliasing = true, UseHighQualityRendering = true, DmlEffectsRenderingMode = DmlEffectsRenderingMode.Fine,
                MetafileRenderingOptions = {RenderingMode = MetafileRenderingMode.VectorWithFallback}, 
            var renderedFileName = $"/tmp/shape_{shape.Name}.png";
            shapeRenderer.Save(renderedFileName, imageSaveOptions);

            Console.WriteLine($"Rendered shape can be found at {renderedFileName}");
        catch (Exception exception)
            Console.WriteLine($"Cannot render image: {exception.Message}");

This is my test project with the Word document: (25.0 KB)

Thanks in advance for your help.


Thanks for your inquiry. Please note that Aspose.Words requires True Type fonts when rendering shapes to images. If you save your document to fixed file format e.g. PDF, you will face the same issue. You need to install fonts that are used in your document on the machine where you are converting shape to image. Please refer to the following articles:

How Aspose.Words Uses True Type Fonts
How to Receive Notification of Missing Fonts and Font Substitution during Rendering