See https://bugzilla.mozilla.org/show_bug.cgi?id=1735738 for reference.
common: {
      file: "./text_layer_test.css",
      promise: null,
    },
  };
  function getTextLayerStyle() {
    return loadStyles(styles);
  }
  
  function rasterizeTextLayer(
    ctx,
    viewport,
    textContent,
    enhanceTextSelection
  ) {
    return new Promise(function (resolve, reject) {
      
      var svg = document.createElementNS(SVG_NS, "svg:svg");
      svg.setAttribute("width", viewport.width + "px");
      svg.setAttribute("height", viewport.height + "px");
      
      svg.setAttribute("font-size", 1);
      
      var foreignObject = document.createElementNS(SVG_NS, "svg:foreignObject");
      foreignObject.setAttribute("x", "0");
      foreignObject.setAttribute("y", "0");
      foreignObject.setAttribute("width", viewport.width + "px");
      foreignObject.setAttribute("height", viewport.height + "px");
      var style = document.createElement("style");
      var stylePromise = getTextLayerStyle();