Flutter/기본설정
[ Flutter ] Font 설정하기
부루붐
2023. 5. 31. 16:30
1. asset 폴더 만들기
프로젝트 폴더에 asset폴더 생성
asset 폴더에 font폴더 생성
asset > font
2. Font 파일 준비
구글폰트(무료 폰트 사용)
https://fonts.google.com/?subset=korean¬o.script=Kore
Google Fonts
Making the web more beautiful, fast, and open through great typography
fonts.google.com
무료폰트를 사용하기 위해 구글폰트에 들어가서 language > Korean 선택해서 한국어 지원하는 폰트를 찾아서 다운로드 하면 됩니다.
3. pubspec.yaml 파일 수정
주의! 들여쓰기를 맞춰야 합니다. 틀리면 작동안됨
주석처리된 것을 살펴보면 이미지와 폰트에 대해서 설명이 되어 있습니다.
fonts:
- family: Schyler
fonts:
- asset: asset/font/Schyler-Regular.ttf
- asset: asset/font/Schyler-Italic.ttf
style: italic
- family: Trajan Pro
fonts:
- asset: asset/font/TrajanPro.ttf
- asset: asset/font/TrajanPro_Bold.ttf
weight: 700
다운로드한 폰트에 맞게 설정해주시면 됩니다.
폴더 경로는 폰트가 위치한 폴더로 넣어주시면 됩니다.
asset/font/폰트이름