/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{pt2px as e}from"../../../core/screenUtils.js";import{glyphSize as t,magicLabelLineHeight as n}from"../engine/webgl/definitions.js";import{shapeGlyphs as i}from"../engine/webgl/mesh/templates/shapingUtils.js";async function o(o,r,a){const s={type:"cim-rasterization-info",resource:{type:"text",textString:o.text,font:o.font}},f=r.textureManager.rasterizeItem(s,a),l=await f;return i(l,{angle:o.angle??0,xOffset:e(o.xoffset??0),yOffset:e(o.yoffset??0),lineHeight:n*Math.max(.25,o.lineHeight),maxLineWidth:Math.max(32,Math.min(e(o.lineWidth),512)),decoration:o.font.decoration,scale:Math.min(Math.round(e(o.font.size)),127)/t,horizontalAlignment:"center",verticalAlignment:"middle",useCIMAngleBehavior:!1,hasBackground:!!o.backgroundColor,borderLineSizePx:e(o.borderLineSize)}).boundsT}let r=o;async function a(e,t,n){return r(e,t.stage,n)}const s={stubGetTextBounds:e=>r=e,restoreGetTextBounds:()=>r=o};export{a as getTextBounds,s as test};
