changwoo (owner)

Revisions

gist: 60908 Download_button fork
public
Description:
nanum2munan.pe
Public Clone URL: git://gist.github.com/60908.git
Embed All Files: show embed
Text only #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/fontforge
# Usage:
# fontforge -script nanum2munan.pe NanumGothicCoding-Bold.ttf
# fontforge -script nanum2munan.pe NanumGothicCoding.ttf
 
NAME = "Munan"
 
input_filename = $1
 
output_family = NAME + " Sans Mono"
if (input_filename == "NanumGothicCoding.ttf")
  output_name = NAME + "SansMono"
  output_filename = output_name + ".ttf"
  output_fullname = NAME + "Sans Mono"
  jamo_start = 0x11656
  jamo_end = 0x11DA0 - 2
endif
if (input_filename == "NanumGothicCoding-Bold.ttf")
  output_name = NAME + "SansMono-Bold"
  output_filename = output_name + ".ttf"
  output_fullname = NAME + "Sans Mono Bold"
  jamo_start = 0x11656
  jamo_end = 0x11EDA - 2
endif
 
Print("Input File: " + input_filename)
Print("Output File: " + output_filename)
Print("Family: " + output_family)
Print("Fullname: " + output_name)
 
Open(input_filename)
 
### 1. OFL에 따라 이름 변경
SetFontNames(output_name, output_family, output_fullname)
SetTTFName(0x409, 3, output_name)
 
# 한글 TTF 이름은 삭제
SetTTFName(1042, 1, "")
SetTTFName(1042, 3, "")
SetTTFName(1042, 4, "")
 
### 2. width
 
# 글리프 선택
# - 한글 음절 U+AC00 - U+D7A3
# - 한글 호환 자모 U+3130 - U+318F
# - 일본어 U+3040 - U+309F, U+30A0 - U+30FF
 
Select(0xAC00, 0xD7A3, 0x3130, 0x318F, 0x3040, 0x309F, 0x30A0, 0x30FF)
 
# SetWidth 1204
SetWidth(1204)
# LBearing increment by 102
SetLBearing(102, 1)
 
Select(jamo_start, jamo_end)
SetWidth(1204)
 
Generate(output_filename)