Embed fonts in SVG

Hi, I am using Aspose Java words to export an SVG of a word document that can be displayed in the browser. The problem is that the on Macs the Symbol font is different from windows/linux and the bullet points do not show correctly. So I would like embed the correct symbols font in the generated SVG image. I have manually added this to the SVG file:

@font-face { font-family: ‘Symbol’; src: url(’/Users/josh/Downloads/symbol.ttf’); }

and it will show the bullet points correctly then. However, manual insertion is not really an option for us in production. So Is there any way to have Aspose embed all required fonts in the SVG when it is created? Based on this page https://blog.aspose.com/2012/03/01/new-svg-save-format-default-font-option-and-enhanced-fonts-selection-interface-in-aspose.words-11.1.0 it seems like there should be some way to set this. But, I have not been able to figure out how. So if you can let me know how to set this it would be much appreciate.

Thanks,

Josh

Hi Josh,

Thanks for your inquiry. In case you are using an older version of Aspose.Words, I would suggest you please upgrade to the latest version (v15.8.0) from here and let us know how it goes on your side.

SvgSaveOptions.TextOutputMode property is used to get or set a value determining how text should be rendered in SVG. The default value is UseTargetMachineFonts (Fonts installed on the target machine are used to render text). Note, if some of fonts used in the document are not available on the target machine, document can look differently.

Please read about SvgTextOutputMode from here:
https://reference.aspose.com/words/java/com.aspose.words/svgtextoutputmode/

If the problem still remains, please share following detail for testing purposes.

  • Attach
    your input Word document
  • Attach Symbol font which you are using at Mac operating system
  • Attach output SVG showing undesired behavior.