asciidoctor-pdf-cjk-kai_gen_gothic 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cb0b7b33821d7a97058f3e549bb88ea6e2856e0a
4
+ data.tar.gz: 8fcaedcae38c2e06a9a6e6200cff4447f3e3fa15
5
+ SHA512:
6
+ metadata.gz: 786c263524b57e0a43a4f940c86462a4dedf9bd9e4782af91d30297c0de0dba6a83a317f85e76a02d9464246bc729a36c9ed8ad6395d72d51915c0400b4908cd
7
+ data.tar.gz: 9a54fb99ad1c0d40595e184fb473d4b845c54365be938c2cc2f25cfda3d66a039a8b1087d0c4993770035fc48363b88f39e6206c17373b5cd29b2a7912162b34
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /data/fonts/*.ttf
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in asciidoctor-pdf-cjk-kai_gen_gothic_cn.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Rei
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # Asciidoctor::Pdf::CJK::KaiGenGothicCn
2
+
3
+ A Asciidoctor PDF theme, using font [KaiGen Gothic](https://github.com/akiratw/kaigen-gothic). Include CN/JP/KR/TW glyphs.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'asciidoctor-pdf-cjk-kai_gen_gothic', '~> 0.1.0'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install asciidoctor-pdf-cjk-kai_gen_gothic
20
+
21
+ And download fonts after installed gem:
22
+
23
+ $ asciidoctor-pdf-cjk-kai_gen_gothic-install
24
+
25
+ ## Usage
26
+
27
+ Render PDF:
28
+
29
+ $ asciidoctor-pdf -r asciidoctor-pdf-cjk-kai_gen_gothic -a pdf-style=[THEME] doc.asc
30
+
31
+ Available themes:
32
+
33
+ - KaiGenGothicCN
34
+ - KaiGenGothicJP
35
+ - KaiGenGothicKR
36
+ - KaiGenGothicTW
37
+
38
+ ## License
39
+
40
+ Code: MIT License
41
+
42
+ Fonts:
43
+
44
+ - KaiGenGothic SIL Open Font License, repo: https://github.com/akiratw/kaigen-gothic
45
+ - Roboto Mono Apache 2 license, repo: https://github.com/google/fonts
46
+
47
+ ## Contributing
48
+
49
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/asciidoctor-pdf-cjk-kai_gen_gothic_cn.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'asciidoctor/pdf/cjk/kai_gen_gothic/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "asciidoctor-pdf-cjk-kai_gen_gothic"
8
+ spec.version = Asciidoctor::Pdf::CJK::KaiGenGothic::VERSION
9
+ spec.authors = ["Rei"]
10
+ spec.email = ["chloerei@gmail.com"]
11
+
12
+ spec.summary = %q{}
13
+ spec.description = %q{}
14
+ spec.homepage = ""
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+ spec.post_install_message = <<-EOF
21
+
22
+ ======================
23
+
24
+ Run this command to download required fonts:"
25
+
26
+ $ asciidoctor-pdf-cjk-kai_gen_gothic-install
27
+
28
+ ======================
29
+
30
+ EOF
31
+
32
+ spec.add_dependency "asciidoctor-pdf-cjk", "~> 0.1.1"
33
+ spec.add_development_dependency "bundler", "~> 1.10"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "minitest"
36
+ end
data/bin/build_fonts ADDED
@@ -0,0 +1,57 @@
1
+ #!/bin/bash
2
+
3
+ mkdir tmp
4
+ cd tmp
5
+
6
+ # CN
7
+ wget -c https://github.com/akiratw/kaigen-gothic/releases/download/v1.002.20150501/KaiGenGothicCN-1.002.20150501.zip
8
+ unzip -o KaiGenGothicCN-1.002.20150501.zip
9
+ ../bin/convert_italic.pe KaiGenGothicCN-Regular.ttf
10
+ ../bin/convert_italic.pe KaiGenGothicCN-Bold.ttf
11
+
12
+ cp KaiGenGothicCN-Regular.ttf ../data/fonts
13
+ cp KaiGenGothicCN-Regular-Italic.ttf ../data/fonts
14
+ cp KaiGenGothicCN-Bold.ttf ../data/fonts
15
+ cp KaiGenGothicCN-Bold-Italic.ttf ../data/fonts
16
+
17
+ # TW
18
+ wget -c https://github.com/akiratw/kaigen-gothic/releases/download/v1.002.20150501/KaiGenGothicTW-1.002.20150501.zip
19
+ unzip -o KaiGenGothicTW-1.002.20150501.zip
20
+ ../bin/convert_italic.pe KaiGenGothicTW-Regular.ttf
21
+ ../bin/convert_italic.pe KaiGenGothicTW-Bold.ttf
22
+
23
+ cp KaiGenGothicTW-Regular.ttf ../data/fonts
24
+ cp KaiGenGothicTW-Regular-Italic.ttf ../data/fonts
25
+ cp KaiGenGothicTW-Bold.ttf ../data/fonts
26
+ cp KaiGenGothicTW-Bold-Italic.ttf ../data/fonts
27
+
28
+ # JP
29
+ wget -c https://github.com/akiratw/kaigen-gothic/releases/download/v1.002.20150501/KaiGenGothicJP-1.002.20150501.zip
30
+ unzip -o KaiGenGothicJP-1.002.20150501.zip
31
+ ../bin/convert_italic.pe KaiGenGothicJP-Regular.ttf
32
+ ../bin/convert_italic.pe KaiGenGothicJP-Bold.ttf
33
+
34
+ cp KaiGenGothicJP-Regular.ttf ../data/fonts
35
+ cp KaiGenGothicJP-Regular-Italic.ttf ../data/fonts
36
+ cp KaiGenGothicJP-Bold.ttf ../data/fonts
37
+ cp KaiGenGothicJP-Bold-Italic.ttf ../data/fonts
38
+
39
+ # KR
40
+ wget -c https://github.com/akiratw/kaigen-gothic/releases/download/v1.002.20150501/KaiGenGothicKR-1.002.20150501.zip
41
+ unzip -o KaiGenGothicKR-1.002.20150501.zip
42
+ ../bin/convert_italic.pe KaiGenGothicKR-Regular.ttf
43
+ ../bin/convert_italic.pe KaiGenGothicKR-Bold.ttf
44
+
45
+ cp KaiGenGothicKR-Regular.ttf ../data/fonts
46
+ cp KaiGenGothicKR-Regular-Italic.ttf ../data/fonts
47
+ cp KaiGenGothicKR-Bold.ttf ../data/fonts
48
+ cp KaiGenGothicKR-Bold-Italic.ttf ../data/fonts
49
+
50
+ cd ..
51
+
52
+ # RobotoMono
53
+ cd data/fonts
54
+ wget -c https://github.com/google/fonts/raw/master/apache/robotomono/RobotoMono-Regular.ttf
55
+ wget -c https://github.com/google/fonts/raw/master/apache/robotomono/RobotoMono-Italic.ttf
56
+ wget -c https://github.com/google/fonts/raw/master/apache/robotomono/RobotoMono-Bold.ttf
57
+ wget -c https://github.com/google/fonts/raw/master/apache/robotomono/RobotoMono-BoldItalic.ttf
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "asciidoctor/pdf/cjk/kai_gen_gothic"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env fontforge
2
+
3
+ Open($1)
4
+ SelectWorthOutputting()
5
+ Skew(13)
6
+ Generate($1:r + "-Italic.ttf")
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
File without changes
@@ -0,0 +1,229 @@
1
+ font:
2
+ catalog:
3
+ KaiGen Gothic CN:
4
+ normal: KaiGenGothicCN-Regular.ttf
5
+ bold: KaiGenGothicCN-Bold.ttf
6
+ italic: KaiGenGothicCN-Regular-Italic.ttf
7
+ bold_italic: KaiGenGothicCN-Bold-Italic.ttf
8
+ Roboto Mono:
9
+ normal: RobotoMono-Regular.ttf
10
+ bold: RobotoMono-Bold.ttf
11
+ italic: RobotoMono-Italic.ttf
12
+ bold_italic: RobotoMono-BoldItalic.ttf
13
+ fallbacks:
14
+ - KaiGen Gothic CN
15
+ page:
16
+ background_color: ffffff
17
+ layout: portrait
18
+ # NOTE multiply inches by 72 to get pt values
19
+ #margin: [0.5 * 72, 0.67 * 72, 0.67 * 72, 0.67 * 72]
20
+ margin: [0.5in, 0.67in, 0.67in, 0.67in]
21
+ # size can be a named size (e.g., A4) or custom dimensions (e.g., [8.25in, 11.69in])
22
+ size: Letter
23
+ base:
24
+ # color as hex string (leading # is optional)
25
+ font_color: 333333
26
+ # color as RGB array
27
+ #font_color: [51, 51, 51]
28
+ # color as CMYK array (approximated)
29
+ #font_color: [0, 0, 0, 0.92]
30
+ #font_color: [0, 0, 0, 92%]
31
+ font_family: KaiGen Gothic CN
32
+ # choose one of these font_size/line_height_length combinations
33
+ #font_size: 14
34
+ #line_height_length: 20
35
+ #font_size: 11.25
36
+ #line_height_length: 18
37
+ #font_size: 11.2
38
+ #line_height_length: 16
39
+ font_size: 10.5
40
+ #line_height_length: 15
41
+ # correct line height for Noto Serif metrics
42
+ line_height_length: 15
43
+ #font_size: 11.25
44
+ #line_height_length: 18
45
+ line_height: $base_line_height_length / $base_font_size
46
+ font_size_large: round($base_font_size * 1.25)
47
+ font_size_small: round($base_font_size * 0.85)
48
+ font_size_min: $base_font_size * 0.75
49
+ font_style: normal
50
+ align: justify
51
+ border_radius: 4
52
+ border_width: 0.5
53
+ border_color: eeeeee
54
+ # FIXME vertical_rhythm is weird; we should think in terms of ems
55
+ #vertical_rhythm: $base_line_height_length * 2 / 3
56
+ # correct line height for Noto Serif metrics
57
+ vertical_rhythm: $base_line_height_length
58
+ horizontal_rhythm: $base_line_height_length
59
+ link:
60
+ font_color: 428bca
61
+ # literal is currently used for inline monospaced in prose and table cells
62
+ literal:
63
+ font_color: b12146
64
+ font_family: Roboto Mono
65
+ heading:
66
+ #font_color: 181818
67
+ font_color: $base_font_color
68
+ font_family: $base_font_family
69
+ # h1 is used for part titles
70
+ h1_font_size: floor($base_font_size * 2.6)
71
+ # h2 is used for chapter titles
72
+ h2_font_size: floor($base_font_size * 2.15)
73
+ h3_font_size: round($base_font_size * 1.7)
74
+ h4_font_size: $base_font_size_large
75
+ h5_font_size: $base_font_size
76
+ h6_font_size: $base_font_size_small
77
+ font_style: bold
78
+ #line_height: 1.4
79
+ # correct line height for Noto Serif metrics
80
+ line_height: 1.2
81
+ margin_top: $vertical_rhythm * 0.2
82
+ margin_bottom: $vertical_rhythm * 0.8
83
+ title_page:
84
+ align: right
85
+ title_top: 55%
86
+ title_font_size: $heading_h1_font_size
87
+ title_font_color: 999999
88
+ title_line_height: 0.9
89
+ subtitle_font_size: $heading_h3_font_size
90
+ subtitle_font_style: bold_italic
91
+ subtitle_line_height: 1
92
+ authors_margin_top: $base_font_size * 1.25
93
+ authors_font_size: $base_font_size_large
94
+ authors_font_color: 181818
95
+ revision_margin_top: $base_font_size * 1.25
96
+ #prose:
97
+ # margin_top: 0
98
+ # margin_bottom: $vertical_rhythm
99
+ block:
100
+ #margin_top: 0
101
+ #margin_bottom: $vertical_rhythm
102
+ padding: [$vertical_rhythm, $vertical_rhythm * 1.25, $vertical_rhythm, $vertical_rhythm * 1.25]
103
+ # code is used for source blocks (perhaps change to source or listing?)
104
+ caption:
105
+ font_style: italic
106
+ align: left
107
+ # FIXME perhaps set line_height instead of / in addition to margins?
108
+ margin_inside: $vertical_rhythm * 0.25
109
+ margin_outside: 0
110
+ code:
111
+ font_color: $base_font_color
112
+ #font_family: Liberation Mono
113
+ #font_size: floor($base_font_size * 0.9)
114
+ #font_size: 10
115
+ #padding: [9.5, 9.5, 9.5, 9.5]
116
+ # LiberationMono carries extra gap below line
117
+ #padding: [10, 10, 7.5, 10]
118
+ #line_height: 1.45
119
+ font_family: $literal_font_family
120
+ font_size: ceil($base_font_size)
121
+ #padding: [$base_font_size, $code_font_size, $base_font_size, $code_font_size]
122
+ padding: $code_font_size
123
+ line_height: 1.25
124
+ background_color: f5f5f5
125
+ border_color: cccccc
126
+ border_radius: $base_border_radius
127
+ border_width: 0.75
128
+ blockquote:
129
+ font_color: $base_font_color
130
+ font_size: $base_font_size_large
131
+ border_width: 5
132
+ border_color: $base_border_color
133
+ cite_font_size: $base_font_size_small
134
+ cite_font_color: 999999
135
+ sidebar:
136
+ border_color: $page_background_color
137
+ border_radius: $base_border_radius
138
+ border_width: $base_border_width
139
+ background_color: eeeeee
140
+ title_font_color: $heading_font_color
141
+ title_font_family: $heading_font_family
142
+ title_font_size: $heading_h4_font_size
143
+ title_font_style: $heading_font_style
144
+ title_align: center
145
+ example:
146
+ border_color: $base_border_color
147
+ border_radius: $base_border_radius
148
+ border_width: 0.75
149
+ background_color: transparent
150
+ admonition:
151
+ border_color: $base_border_color
152
+ border_width: $base_border_width
153
+ conum:
154
+ font_family: $literal_font_family
155
+ font_color: $literal_font_color
156
+ font_size: $base_font_size
157
+ line_height: 4 / 3
158
+ image:
159
+ align_default: left
160
+ scaled_width_default: 0.5
161
+ lead:
162
+ # QUESTION what about $base_font_size_large?
163
+ #font_size: floor($base_line_height_length * 0.8)
164
+ #font_size: floor($base_font_size * 1.15)
165
+ #line_height: 1.3
166
+ font_size: $base_font_size_large
167
+ line_height: 1.4
168
+ abstract:
169
+ #font_color: 404040
170
+ font_color: 5c6266
171
+ font_size: $lead_font_size
172
+ line_height: $lead_line_height
173
+ font_style: italic
174
+ thematic_break:
175
+ border_color: $base_border_color
176
+ margin_top: $vertical_rhythm * 0.5
177
+ margin_bottom: $vertical_rhythm * 1.5
178
+ description_list:
179
+ term_font_style: italic
180
+ description_indent: $horizontal_rhythm * 1.25
181
+ outline_list:
182
+ indent: $horizontal_rhythm * 1.5
183
+ # NOTE item_spacing applies to list items that do not have complex content
184
+ item_spacing: $vertical_rhythm / 2
185
+ #marker_font_color: 404040
186
+ table:
187
+ background_color: $page_background_color
188
+ #head_background_color: <hex value>
189
+ #head_font_color: $base_font_color
190
+ even_row_background_color: f9f9f9
191
+ #odd_row_background_color: <hex value>
192
+ foot_background_color: f0f0f0
193
+ border_color: dddddd
194
+ border_width: $base_border_width
195
+ # HACK accounting for line-height
196
+ cell_padding: [3, 3, 6, 3]
197
+ toc:
198
+ indent: $horizontal_rhythm
199
+ dot_leader_color: dddddd
200
+ #dot_leader_content: ". "
201
+ line_height: 1.4
202
+ # NOTE In addition to footer, header is also supported
203
+ footer:
204
+ font_size: $base_font_size_small
205
+ font_color: $base_font_color
206
+ # NOTE if background_color is set, background and border will span width of page
207
+ border_color: dddddd
208
+ border_width: 0.25
209
+ height: $base_line_height_length * 2.5
210
+ padding: [$base_line_height_length / 2, 1, 0, 1]
211
+ valign: top
212
+ #image_valign: <alignment> or <number>
213
+ # additional attributes for content:
214
+ # * {page-count}
215
+ # * {page-number}
216
+ # * {document-title}
217
+ # * {document-subtitle}
218
+ # * {chapter-title}
219
+ # * {section-title}
220
+ # * {section-or-chapter-title}
221
+ recto_content:
222
+ #right: '{section-or-chapter-title} | {page-number}'
223
+ #right: '{document-title} | {page-number}'
224
+ right: '{page-number}'
225
+ #center: '{page-number}'
226
+ verso_content:
227
+ #left: '{page-number} | {chapter-title}'
228
+ left: '{page-number}'
229
+ #center: '{page-number}'