Skip to content

Commit ac9367a

Browse files
fix: fontstyle after save text signature issue
1 parent 081dae0 commit ac9367a

File tree

1 file changed

+19
-1
lines changed
  • microfrontends/SignDocuments/src/Component/component

1 file changed

+19
-1
lines changed

microfrontends/SignDocuments/src/Component/component/signPad.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ function SignPad({
5353
const currentUserName = jsonSender && jsonSender.name;
5454
//function for clear signature
5555
setSignValue(currentUserName);
56+
setFontSelect("Fasthand");
5657
}, []);
5758
//function for clear signature
5859
const handleClear = () => {
@@ -132,6 +133,22 @@ function SignPad({
132133
);
133134
};
134135

136+
useEffect(() => {
137+
const loadFont = async () => {
138+
try {
139+
await document.fonts.load(`20px ${fontSelect}`);
140+
const selectFontSTyle = fontOptions.find(
141+
(font) => font.value === fontSelect
142+
);
143+
setFontSelect(selectFontSTyle?.value || fontOptions[0].value);
144+
} catch (error) {
145+
console.error("Error loading font:", error);
146+
}
147+
};
148+
149+
loadFont();
150+
}, [fontSelect]);
151+
135152
useEffect(() => {
136153
// Load the default signature after the component mounts
137154
if (canvasRef.current) {
@@ -149,7 +166,8 @@ function SignPad({
149166
? fontStyle
150167
: fontSelect
151168
? fontSelect
152-
: fontOptions[0].value;
169+
: "Fasthand";
170+
console.log("font family", fontfamily);
153171
// Calculate the width of the text content
154172
const textWidth = getTextWidth(textContent, fontfamily);
155173
// Increase pixel ratio for higher resolution

0 commit comments

Comments
 (0)