내가 사용한 폰트는 Pretendard이다.
React 프로젝트에서 tailwind를 사용중인데, 이때 가장 간단하게 폰트를 적용할 수 있는 법을 작성해볼려 한다.
나는 /src/style/fonts 폴더 내에 폰트 파일을 넣었다.

폰트를 다운받고 /public/static 폴더 내에 있는 ttf 파일 중, 사용할 파일만 넣으면 된다.
@font-face {
font-family: 'Pretendard';
font-weight: 400;
font-display: swap;
src: local('Pretendard Medium'), url('./style/fonts/Pretendard-Medium.ttf') format('truetype');
}
@font-face {
font-family: 'Pretendard';
font-weight: 300;
font-display: swap;
src: local('Pretendard Light'), url('./style/fonts/Pretendard-Light.ttf') format('truetype');
}
body {
font-family: 'Pretendard'
}
이렇게까지 하면 기본 폰트로 내가 정의한 Pretendard 폰트가 적용 된다!
이제 폰트의 굵기 (weight)를 바꿀려면 어떻게 해야될까?

...
return (
<div className='font-light'>
안녕하세요
</div>
)
...
아까 index.css에 font-wieght: 300인 경우를 정의해줬기 때문에
className에 font-light를 작성해주면 Pretendard-Light가 적용된다!