diff --git a/src/hooks/common/useFont.js b/src/hooks/common/useFont.js index 28c78f14..595ec74c 100644 --- a/src/hooks/common/useFont.js +++ b/src/hooks/common/useFont.js @@ -1,6 +1,6 @@ import { useRecoilValue } from 'recoil' import { canvasState } from '@/store/canvasAtom' -import { fontSelector, globalFontAtom } from '@/store/fontAtom' +import { fontSelector } from '@/store/fontAtom' import { useEffect } from 'react' export function useFont() { @@ -17,7 +17,8 @@ export function useFont() { textObjs.forEach((obj) => { obj.set({ fontFamily: commonText.fontFamily.value, - fontWeight: commonText.fontWeight.value, + fontWeight: lengthText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal', + fontStyle: lengthText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal', fontSize: commonText.fontSize.value, fill: commonText.fontColor.value, }) @@ -32,7 +33,8 @@ export function useFont() { textObjs.forEach((obj) => { obj.set({ fontFamily: dimensionLineText.fontFamily.value, - fontWeight: dimensionLineText.fontWeight.value, + fontWeight: lengthText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal', + fontStyle: lengthText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal', fontSize: dimensionLineText.fontSize.value, fill: dimensionLineText.fontColor.value, }) @@ -47,7 +49,8 @@ export function useFont() { textObjs.forEach((obj) => { obj.set({ fontFamily: flowText.fontFamily.value, - fontWeight: flowText.fontWeight.value, + fontWeight: lengthText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal', + fontStyle: lengthText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal', fontSize: flowText.fontSize.value, fill: flowText.fontColor.value, }) @@ -62,7 +65,8 @@ export function useFont() { textObjs.forEach((obj) => { obj.set({ fontFamily: lengthText.fontFamily.value, - fontWeight: lengthText.fontWeight.value, + fontWeight: lengthText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal', + fontStyle: lengthText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal', fontSize: lengthText.fontSize.value, fill: lengthText.fontColor.value, })