UI 에서 필요한 폰트를 만들기 위한 방법을 설명한다. 현재 UI 에서 사용하는 BDF 형식의 폰트이다. 하지만, 현재 가장 많이 사용하고 보편적으로 사용되는 폰트는 TTF(트루타입 폰트) 이다. 그래서 폰트 변환이 필요하다.

폰트를 변환하기 위해서는 변환 프로그램이 필요한데, 현재 윈도우 용으로는 '세종대왕' 이라는 프로그램과 리눅스 용으로는 'ttf2bdf' 라는 프로그램이 있다.

폰트 변환하기

우선 윈도우 용인 세종대왕 부터 살펴보면, 사용방법은 간단하다. 변환할 ttf 폰트를 선택하고, 폰트 크기를 지정해주면 된다. 이때, 변환할 폰트는 PC 에 설치되어 있어야 한다. 만일 설치되어 있지 않다면, 선택항목에서 선택이 불가능하기 때문이다.

리눅스의 freetype-tools 라는 패키지안에 포함되어 있는 이 프로그램은 약간의 옵션 조정이 필요하다.
필자의 경우, 레드햇 9 를 기준으로 했다. 기본설치를 했지만, ttf2bdf 라는 프로그램이 없었다. 그래서 freetype-tools-1.3.1-1000.i586.rpm 을 찾아서 설치했다.

#ttf2bdf -h
ttf2bdf: no input file provided.
Usage: ttf2bdf [options below] font.ttf
-h              This message.
-v              Print warning messages during conversion.
-l "subset"     Specify a subset of glyphs to generate.
-m mapfile      Glyph reencoding file.
-n              Turn off glyph hinting.
-c c            Set the character spacing (default: from font).
-f name         Set the foundry name (default: freetype).
-t name         Set the typeface name (default: from font).
-w name         Set the weight name (default: Medium).
-s name         Set the slant name (default: R).
-k name         Set the width name (default: Normal).
-d name         Set the additional style name (default: empty).
-u char         Set the character to replace '-' in names (default: space).
-pid id         Set the platform ID for encoding (default: 3).
-eid id         Set the encoding ID for encoding (default: 1).
-p n            Set the point size (default: 12pt).   # 폰트 사이즈
-r n            Set the horizontal and vertical resolution (default: 100dpi).
-rh n           Set the horizontal resolution (default: 100dpi)  # 폰트의 수평 크기
-rv n           Set the vertical resolution (default: 100dpi) # 폰트의 수직 크기
-o outfile      Set the output filename (default: stdout).

일단 현재 UI 에 알맞은 크기의 폰트로 만들기 위해서는 다음과 같이 명령을 내려주면 된다.

#ttf2bdf -c c -rf 100 -rv 87 -p 23 -o tgulim.bdf tgulim.ttf
#ttf2bdf -c c -rh 98 -rv 87 -p 35 -o H2GTRE.bdf H2GTRE.TTF

만들어진 tgulim.bdf 파일을 보자!!

STARTFONT 2.1
COMMENT
COMMENT Converted from TrueType font "H2GTRM.TTF" by "ttf2bdf 2.8".
COMMENT
FONT -FreeType-HYGothic Medium-Medium-R-Normal--28-230-100-87-C-262-ISO10646-1
SIZE 23 100 87
FONTBOUNDINGBOX 32 28 0 -4              // 폰트의 박스 크기를 나타낸다
STARTPROPERTIES 19
FOUNDRY "FreeType"
FAMILY_NAME "HYGothic Medium"
WEIGHT_NAME "Medium"
SLANT "R"
SETWIDTH_NAME "Normal"
  • computer/digitalarena/폰트_변환하기.txt
  • Last modified: 3 years ago
  • by likewind