import { HTMLTextRenderData } from '../HTMLTextSystem.mjs';

let tempHTMLTextRenderData;
function measureHtmlText(text, style, fontStyleCSS, htmlTextRenderData) {
  htmlTextRenderData = htmlTextRenderData || tempHTMLTextRenderData || (tempHTMLTextRenderData = new HTMLTextRenderData());
  const { domElement, styleElement, svgRoot } = htmlTextRenderData;
  domElement.innerHTML = text;
  domElement.setAttribute("style", style.cssStyle);
  if (fontStyleCSS) {
    styleElement.textContent = fontStyleCSS;
  }
  document.body.appendChild(svgRoot);
  const contentBounds = domElement.getBoundingClientRect();
  svgRoot.remove();
  return {
    width: contentBounds.width,
    height: contentBounds.height
  };
}

export { measureHtmlText };
//# sourceMappingURL=measureHtmlText..mjs.map
