🔥 The free & Open Source DocuSign alternative
JavaScript digital-signaturedocument-signingdocusign-alternativedocusign-freee-signatureelectronic-signatureelectronic-signaturesesignesignaturehacktoberfestjavascriptlegaltechmongodbnodejsopen-sourcepdf-signpdf-signaturereactjsself-hostedsign-pdf-files
fix: fontstyle after save text signature issue
RaktimaNXGac9367a71544
diff --git a/microfrontends/SignDocuments/src/Component/component/signPad.js b/microfrontends/SignDocuments/src/Component/component/signPad.jsindex 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 signaturesetSignValue(currentUserName);+ setFontSelect("Fasthand");}, []);//function for clear signatureconst 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 mountsif (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 contentconst textWidth = getTextWidth(textContent, fontfamily);// Increase pixel ratio for higher resolution