fillFontHoles(doc, callback) {
    if (this.crossOriginStyleSheets.length == 0) {
      if (this.fontCSS.length > 0) {
        var fonts = `<style>${this.fontCSS.join('')}</style>`;
        this.html[this.fontPlaceHolderIndex] = fonts;
      }
      callback();
    } else {
      var styleSheetSrc = this.crossOriginStyleSheets.shift();
      var serializer = this;
      fetch(styleSheetSrc).then(function(response) {
        return response.text();
      }).then(function(css) {
          serializer.processCSSFonts(doc.defaultView, styleSheetSrc, css);
          serializer.fillFontHoles(doc, callback);
      }).catch(function(error) {
        console.log(error);
        serializer.fillFontHoles(doc, callback);
      });
    }
  }
/**
   * Takes all of the cross origin stylesheets, processes their font
   * declarations, and adds them to |this.html|. Calls the callback when
   *     complete.
   *
   * @param {Document} doc The Document being serialized.
   * @param {Function} callback The callback function.
   */
Takes all of the cross origin stylesheets, processes their font
declarations, and adds them to |this.html|. Calls the callback when
complete.

@param {Document} doc The Document being serialized.
@param {Function} callback The callback function.
Takes all of the cross origin stylesheets processes their font declarations and adds them to |this . html| . Calls the callback when complete . @param { Document } doc The Document being serialized . @param { Function } callback The callback function .
fillFontHoles(doc, callback) {
    if (this.crossOriginStyleSheets.length == 0) {
      if (this.fontCSS.length > 0) {
        var fonts = `<style>${this.fontCSS.join('')}</style>`;
        this.html[this.fontPlaceHolderIndex] = fonts;
      }
      callback();
    } else {
      var styleSheetSrc = this.crossOriginStyleSheets.shift();
      var serializer = this;
      fetch(styleSheetSrc).then(function(response) {
        return response.text();
      }).then(function(css) {
          serializer.processCSSFonts(doc.defaultView, styleSheetSrc, css);
          serializer.fillFontHoles(doc, callback);
      }).catch(function(error) {
        console.log(error);
        serializer.fillFontHoles(doc, callback);
      });
    }
  }
fillFontHoles ( doc , callback ) { if ( this . crossOriginStyleSheets . length == 0 ) { if ( this . fontCSS . length > 0 ) { var fonts = ` ${ this . fontCSS . join ( '' ) } ` ; this . html [ this . fontPlaceHolderIndex ] = fonts ; } callback ( ) ; } else { var styleSheetSrc = this . crossOriginStyleSheets . shift ( ) ; var serializer = this ; fetch ( styleSheetSrc ) . then ( function ( response ) { return response . text ( ) ; } ) . then ( function ( css ) { serializer . processCSSFonts ( doc . defaultView , styleSheetSrc , css ) ; serializer . fillFontHoles ( doc , callback ) ; } ) . catch ( function ( error ) { console . log ( error ) ; serializer . fillFontHoles ( doc , callback ) ; } ) ; } }
Takes all of the cross origin stylesheets, processes their font
 declarations, and adds them to |this.html|.
Takes all of the cross origin stylesheets processes their font declarations and adds them to |this . html| .