본문 바로가기

리눅스

리눅스에서 글꼴(font)을 추가하는 방법

728x90

리눅스에서 글꼴(font)을 추가하는 방법

1. 글꼴 파일 다운로드

추가할 글꼴 파일을 다운로드합니다. 대부분의 글꼴 파일은 .ttf 또는 .otf 확장자를 갖습니다.

2. 글꼴 파일 복사

글꼴 파일을 /usr/share/fonts 디렉토리 또는 해당 글꼴 유형에 맞는 디렉토리에 복사합니다.

예를 들어, TrueType 글꼴의 경우 /usr/share/fonts/truetype 디렉토리에 복사합니다. OpenType 글꼴의 경우 /usr/share/fonts/opentype 디렉토리에 복사합니다.

복사할 때 파일 권한을 변경할 필요가 있을 수 있습니다. 다음 명령을 사용하여 파일 권한을 변경할 수 있습니다.

sudo chmod 644 fontfile.ttf

3. 새로운 글꼴 캐시 빌드

글꼴을 추가했지만, 리눅스는 해당 글꼴을 인식하지 못할 수 있습니다. 따라서, 글꼴 캐시를 업데이트 해주어야 합니다.

sudo fc-cache -fv

4. 글꼴 확인

글꼴이 올바르게 설치되었는지 확인하기 위해 다음 명령을 실행하여 설치된 글꼴 리스트를 볼 수 있습니다.

fc-list

설치된 글꼴 리스트 중에서 새로 추가한 글꼴이 있는지 확인할 수 있습니다.

 

이제 리눅스에 새로운 글꼴을 추가할 수 있습니다.

 

728x90

font 파일 저정

$ pwd
/usr/share/fonts
$ ls
DroidSansFallback.ttf

적용

  • /usr/share/fonts: caching, new cache contents: 1 fonts, 1 dirs
$ fc-cache -fv
/usr/share/fonts: caching, new cache contents: 1 fonts, 1 dirs
/usr/share/fonts/un-core: caching, new cache contents: 12 fonts, 0 dirs
/usr/share/X11/fonts/Type1: skipping, no such directory
/usr/share/X11/fonts/TTF: skipping, no such directory
/usr/local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
/var/cache/fontconfig: cleaning cache directory
/root/.fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded

폰트 확인

  • Droid Sans Fallback:style=Regular
$ fc-list
Droid Sans Fallback:style=Regular
은 돋움,UnDotum:style=Regular
은 궁서,UnGungseo:style=Regular
은 그래픽,UnGraphic:style=Bold
은 바탕,UnBatang:style=Bold
은 디나루,UnDinaru:style=Bold,Light
은 필기,UnPilgi:style=Regular
은 디나루,UnDinaru:style=Regular
은 필기,UnPilgi:style=Bold
은 돋움,UnDotum:style=Bold
은 바탕,UnBatang:style=Regular
은 그래픽,UnGraphic:style=Regular
은 디나루,UnDinaru:style=Bold

 

yum install -y xorg-x11-font-utils ttmkfdir
mkfontscale
ttmkfdir

 

728x90