-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathgsfonts-CID.rb
executable file
·79 lines (75 loc) · 1.85 KB
/
gsfonts-CID.rb
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#! /usr/bin/env ruby1.9.1
# -*- coding: utf-8 -*-
#
# gsfonts-CID.rb fonts.csv output_dir
#
# GhostScriptで必要となる
# H, V, EUC-H, EUC-V, UniJIS-UTF16-H, UniJIS-UTF16-V
# の各ファイルを生成する
# fonts.csvの第一列にPostScript nameが記述されていることを前提とする
#
require "csv"
def create_font_files(psname)
output = "#{ARGV[1]}/#{psname}"
File.open("#{output}-H","w") do |file|
file.puts %Q[/#{psname}-H
/H /CMap findresource
[/#{psname} /CIDFont findresource]
composefont pop
]
end
File.open("#{output}-V","w") do |file|
file.puts %Q[/#{psname}-V
/V /CMap findresource
[/#{psname} /CIDFont findresource]
composefont pop
]
end
File.open("#{output}-Identity-H","w") do |file|
file.puts %Q[/#{psname}-Identity-H
/Identity-H /CMap findresource
[/#{psname} /CIDFont findresource]
composefont pop
]
end
File.open("#{output}-Identity-V","w") do |file|
file.puts %Q[/#{psname}-Identity-V
/Identity-V /CMap findresource
[/#{psname} /CIDFont findresource]
composefont pop
]
end
File.open("#{output}-EUC-H","w") do |file|
file.puts %Q[/#{psname}-EUC-H
/EUC-H /CMap findresource
[/#{psname} /CIDFont findresource]
composefont pop
]
end
File.open("#{output}-EUC-V","w") do |file|
file.puts %Q[/#{psname}-EUC-V
/EUC-V /CMap findresource
[/#{psname} /CIDFont findresource]
composefont pop
]
end
File.open("#{output}-UniJIS-UTF16-H","w") do |file|
file.puts %Q[/#{psname}-UniJIS-UTF16-H
/UniJIS-UTF16-H /CMap findresource
[/#{psname} /CIDFont findresource]
composefont pop
]
end
File.open("#{output}-UniJIS-UTF16-V","w") do |file|
file.puts %Q[/#{psname}-UniJIS-UTF16-V
/UniJIS-UTF16-V /CMap findresource
[/#{psname} /CIDFont findresource]
composefont pop
]
end
end
Dir.mkdir(ARGV[1]) unless File.exist?(ARGV[1])
CSV.foreach(ARGV[0]) do |row|
puts "#{row[0]}"
create_font_files(row[0])
end