diff --git a/microfrontends/SignDocuments/src/Component/component/signPad.js b/microfrontends/SignDocuments/src/Component/component/signPad.js index 211ba0a8e..66355fd05 100644 --- a/microfrontends/SignDocuments/src/Component/component/signPad.js +++ b/microfrontends/SignDocuments/src/Component/component/signPad.js @@ -53,6 +53,7 @@ function SignPad({ const currentUserName = jsonSender && jsonSender.name; //function for clear signature setSignValue(currentUserName); + setFontSelect("Fasthand"); }, []); //function for clear signature const handleClear = () => { @@ -132,6 +133,22 @@ function SignPad({ ); }; + useEffect(() => { + const loadFont = async () => { + try { + await document.fonts.load(`20px ${fontSelect}`); + const selectFontSTyle = fontOptions.find( + (font) => font.value === fontSelect + ); + setFontSelect(selectFontSTyle?.value || fontOptions[0].value); + } catch (error) { + console.error("Error loading font:", error); + } + }; + + loadFont(); + }, [fontSelect]); + useEffect(() => { // Load the default signature after the component mounts if (canvasRef.current) { @@ -149,7 +166,8 @@ function SignPad({ ? fontStyle : fontSelect ? fontSelect - : fontOptions[0].value; + : "Fasthand"; + console.log("font family", fontfamily); // Calculate the width of the text content const textWidth = getTextWidth(textContent, fontfamily); // Increase pixel ratio for higher resolution