Need a special offer?Find out if your project fits.

SVG Icons are not loading - Failed to decode downloaded font

Rory Cornelius asked on February 21, 2022

I'm trying to incorporate flexmonster into another product, IBM Cognos Analytics, as a custom visualization. Everything seems to be working except the icons. I can't get them to load correctly. I've tried both Chrome and Edge. In the console I see several references to:
"Failed to decode downloaded font"
"OTS parsing error: incorrect file size in WOFF header"
Then there's a stack trace:
Uncaught TypeError: Cannot read properties of undefined (reading 'type')
at f.get caption [as caption] (VM563 Main.js:1153:516)
at f.uAa (VM563 Main.js:1903:309)
at f.getData (VM563 Main.js:1884:106)
at b.Tva.b.OC (VM563 Main.js:1876:214)
at b.getData (VM563 Main.js:1992:457)
at b.hg (VM563 Main.js:2059:86)
at (VM563 Main.js:2051:8)
at b.Iy (VM563 Main.js:1974:169)
at b.vG (VM563 Main.js:1988:397)
at (VM563 Main.js:2039:351)
at b.FG (VM563 Main.js:2054:263)
at b.FG (VM563 Main.js:2082:267)
at b.mY (VM563 Main.js:2053:128)
at VM563 Main.js:2052:444
My flexmonster definition in the code is pretty simple:

        let pivot = new Flexmonster({
          container: _info.node,
          componentFolder: "flexmonster/",
          toolbar: true,
          width: "100%",
          height: "100%",
          report: {
            dataSource: {
              data: pivotData

This is a TypeScript based application. I used npm to install flexmonster. My project code is attached along with a screenshot of what I'm seeing. I've tried a variety of different things, but I'm hoping you can at least provide some other ideas to try.


2 answers

Rory Cornelius February 22, 2022

I got this to work by adding a Service dependency to my manifest.xml file for the CSS. I had to reference instead of using the local version. It's able to parse the font files referenced there even though it can't for the local ones.

Vera Didenko Vera Didenko Flexmonster February 23, 2022

Hello, Rory,
Thank you for writing to us.
We are happy to hear that you found a way to get the icon fonts working.
We would like to explain that flexmonster.css includes relative paths to the font resources. When using CDN, the relative paths match the fonts available on CDN and that is why they are loaded successfully. In case of referencing the styles locally, it is possible that the bundler for the custom view couldn't locate the fonts. 
Another idea would be to include Flexmonster's styles from npm where the bundler for the custom view could locate the fonts. Here is an example of how this was solved for Front-end frameworks, for instance, in React.
We also have a custom theme builder that builds CSS themes for Flexmonster. The custom theme builder replaces the relative font paths with CDN links, so themes generated by it should also work in your project.
As always, you are welcome to reach out to us if other questions arise.
Kind regards,

Please login or Register to Submit Answer