File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
microfrontends/SignDocuments/src/Component/component Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ function SignPad({
53
53
const currentUserName = jsonSender && jsonSender . name ;
54
54
//function for clear signature
55
55
setSignValue ( currentUserName ) ;
56
+ setFontSelect ( "Fasthand" ) ;
56
57
} , [ ] ) ;
57
58
//function for clear signature
58
59
const handleClear = ( ) => {
@@ -132,6 +133,22 @@ function SignPad({
132
133
) ;
133
134
} ;
134
135
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
+
135
152
useEffect ( ( ) => {
136
153
// Load the default signature after the component mounts
137
154
if ( canvasRef . current ) {
@@ -149,7 +166,8 @@ function SignPad({
149
166
? fontStyle
150
167
: fontSelect
151
168
? fontSelect
152
- : fontOptions [ 0 ] . value ;
169
+ : "Fasthand" ;
170
+ console . log ( "font family" , fontfamily ) ;
153
171
// Calculate the width of the text content
154
172
const textWidth = getTextWidth ( textContent , fontfamily ) ;
155
173
// Increase pixel ratio for higher resolution
You can’t perform that action at this time.
0 commit comments