Custom (non-default) fonts in Text Areas are not rendered as desired when viewed on the TIBCO Spotfire Web Player.

Custom (non-default) fonts in Text Areas are not rendered as desired when viewed on the TIBCO Spotfire Web Player.

book

Article ID: KB0080383

calendar_today

Updated On:

Products Versions
Spotfire Web Player All Versions

Description

When using custom (non-default) fonts which are installed on the local client machine while authoring in your TIBCO Spotfire Analyst client, the fonts in Text Areas may not be displayed with the desired font when the analysis file is viewed on the TIBCO Spotfire Web Player.

Issue/Introduction

Custom (non-default) fonts in Text Areas are not rendered as desired when viewed on the TIBCO Spotfire Web Player.

Resolution

One option is to install the custom fonts on all client machines to ensure that the fonts can be rendered as desired. This option can be problematic though as it can be cumbersome to ensure ALL client machines have had the custom font installed.

Another option would be to use Google's Web Font Loader in the HTML Text area. With the following script in the text area, Spotfire renders the custom font even if the custom font is not installed on the client side.
<script type="text/javascript">
  WebFontConfig = {
    google: { families: [ 'Open+Sans:400,300,300italic,400italic,600,700,700italic,800,600italic,800italic:greek,greek-ext,latin' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })();
</script>
The Web Font Loader is able to load fonts from Google FontsTypekitFonts.com, and Fontdeck, as well as self-hosted web fonts. See the references for more details.

Disclaimer:
The code in this article is only a sample to be used as a reference and is not officially tested or supported. Please see the following Wiki article on the best practices and limitations of using JavaScript in Text Areas:
 

Additional Information

Wiki: Best Practices for Writing Custom JavaScript Code in Text Areas External: Web Font Loader