Skip to content

Commit 4f3315d

Browse files
committed
add config and theme for eBook
1 parent 3badbe7 commit 4f3315d

File tree

5 files changed

+453
-4
lines changed

5 files changed

+453
-4
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*.html
22
*.pdf
3+
*.epub
34
.classpath
45
.project
56
.settings/
@@ -10,4 +11,6 @@ target
1011
*.svg
1112
*.html
1213
.factorypath
13-
/docs/.asciidoctor/
14+
.asciidoctor/
15+
*.ttf
16+
fonts.ttf.tgz

cfg/fonts/download-fonts.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Download the fonts
4+
5+
wget https://github.com/diguage/jdk-source-analysis/releases/download/source-fonts.ttf/fonts.ttf.tgz
6+
7+
tar -zxvf fonts.ttf.tgz
8+
9+
10+
# Backup download URL: https://github.com/adobe-fonts/source-han-serif/archive/1.001R.zip
11+
12+
# Maybe you have to convert the OTF fonts to TTF fonts by the otf2ttf tools of AFDKO(https://github.com/adobe-type-tools/afdko/)

cfg/plantuml.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
skinparam defaultFontName Hiragino Sans GB

cfg/theme/Source-theme.yml

Lines changed: 293 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,293 @@
1+
font:
2+
catalog:
3+
Source Han Serif SC:
4+
normal: SourceHanSerifSC-Regular.ttf
5+
bold: SourceHanSerifSC-Bold.ttf
6+
italic: SourceHanSerifSC-Medium.ttf
7+
bold_italic: SourceHanSerifSC-SemiBold.ttf
8+
#SourceHanSerifSC-Heavy.otf
9+
#SourceHanSerifSC-ExtraLight.otf
10+
#SourceHanSerifSC-Light.otf
11+
Source Code Pro:
12+
normal: SourceCodePro-Regular.ttf
13+
bold: SourceCodePro-Semibold.ttf
14+
italic: SourceCodePro-It.ttf
15+
bold_italic: SourceCodePro-BoldIt.ttf
16+
#SourceCodePro-Black.ttf
17+
#SourceCodePro-BlackIt.ttf
18+
#SourceCodePro-ExtraLight.ttf
19+
#SourceCodePro-ExtraLightIt.ttf
20+
#SourceCodePro-Light.ttf
21+
#SourceCodePro-LightIt.ttf
22+
#SourceCodePro-Medium.ttf
23+
#SourceCodePro-MediumIt.ttf
24+
#SourceCodePro-Bold.ttf
25+
#SourceCodePro-Semibold.ttf
26+
#SourceCodePro-SemiboldIt.ttf
27+
fallbacks:
28+
- Source Han Serif SC
29+
page:
30+
background-color: ffffff
31+
layout: portrait
32+
# NOTE multiply inches by 72 to get pt values
33+
#margin: [0.5 * 72, 0.67 * 72, 0.67 * 72, 0.67 * 72]
34+
margin: [1.2in, 1in, 1.2in, 1in]
35+
margin-inner: 1.2in
36+
margin-outer: 1in
37+
# size can be a named size (e.g., A4) or custom dimensions (e.g., [8.25in, 11.69in])
38+
size: A4
39+
numbering-start-at: body
40+
base:
41+
# color as hex string (leading # is optional)
42+
font-color: 333333
43+
# color as RGB array
44+
#font_color: [51, 51, 51]
45+
# color as CMYK array (approximated)
46+
#font_color: [0, 0, 0, 0.92]
47+
#font_color: [0, 0, 0, 92%]
48+
font-family: Source Han Serif SC
49+
# choose one of these font_size/line_height_length combinations
50+
#font_size: 14
51+
#line_height_length: 20
52+
#font_size: 11.25
53+
#line_height_length: 18
54+
#font_size: 11.2ArrayList
55+
#line_height_length: 16
56+
#font-size: 10.5
57+
# correct line height for Noto Serif metrics
58+
#line-height-length: 15
59+
font-size: 9
60+
line-height-length: 15
61+
line-height: $base_line_height_length / $base_font_size
62+
font-size-large: round($base_font_size * 1.25)
63+
font-size-small: round($base_font_size * 0.85)
64+
font-size-min: $base_font_size * 0.75
65+
font-style: normal
66+
align: left
67+
border-radius: 4
68+
border-width: 0.5
69+
border-color: eeeeee
70+
# FIXME vertical_rhythm is weird; we should think in terms of ems
71+
#vertical_rhythm: $base_line_height_length * 2 / 3
72+
# correct line height for Noto Serif metrics
73+
vertical_rhythm: $base_line_height_length
74+
horizontal_rhythm: $base_line_height_length
75+
link:
76+
font-color: 428bca
77+
# literal is currently used for inline monospaced in prose and table cells
78+
literal:
79+
font-color: b12146
80+
font-family: Source Code Pro
81+
heading:
82+
#font_color: 181818
83+
font-color: $base_font_color
84+
font-family: $base_font_family
85+
# h1 is used for part titles
86+
h1-font-size: floor($base_font_size * 2.6)
87+
# h2 is used for chapter titles
88+
h2-font-size: floor($base_font_size * 2.15)
89+
h3-font-size: round($base_font_size * 1.7)
90+
h4-font-size: $base_font_size_large
91+
h5-font-size: $base_font_size
92+
h6-font-size: $base_font_size_small
93+
font-style: bold
94+
#line_height: 1.4
95+
# correct line height for Noto Serif metrics
96+
line-height: 1.2
97+
margin-top: $vertical_rhythm * 0.2
98+
margin-bottom: $vertical_rhythm * 0.8
99+
#section:
100+
# indent: [0.5in, 0]
101+
title-page:
102+
align: right
103+
title:
104+
top: 50%
105+
font-size: $heading_h1_font_size * 1.25
106+
font-color: 999999
107+
line-height: 0.9
108+
subtitle:
109+
font-size: $heading_h3_font_size
110+
font-style: bold_italic
111+
line-height: 1
112+
authors:
113+
margin-top: $base_font_size * 1.25
114+
font-size: $base_font_size_large
115+
font-color: 181818
116+
content:
117+
name_only: "{author}"
118+
with_email: "{author} <{email}>"
119+
with_url: '{url}[{author} · {url}]'
120+
revision:
121+
margin-top: $base_font_size * 1.4
122+
#prose:
123+
# margin-top: 0
124+
# margin-bottom: $vertical_rhythm
125+
# margin-inner: 0
126+
# text-indent: 0
127+
block:
128+
#margin_top: 0
129+
#margin_bottom: $vertical_rhythm
130+
padding: [$vertical_rhythm, $vertical_rhythm * 1.25, $vertical_rhythm, $vertical_rhythm * 1.25]
131+
# code is used for source blocks (perhaps change to source or listing?)
132+
caption:
133+
font-style: italic
134+
align: left
135+
# FIXME perhaps set line_height instead of / in addition to margins?
136+
margin-inside: $vertical_rhythm * 0.25
137+
margin-outside: 0
138+
code:
139+
font-color: $base_font_color
140+
#font_family: Liberation Mono
141+
#font_size: floor($base_font_size * 0.9)
142+
#font_size: 10
143+
#padding: [9.5, 9.5, 9.5, 9.5]
144+
# LiberationMono carries extra gap below line
145+
#padding: [10, 10, 7.5, 10]
146+
#line_height: 1.45
147+
font-family: $literal_font_family
148+
font-size: ceil($base_font_size)
149+
#padding: [$base_font_size, $code_font_size, $base_font_size, $code_font_size]
150+
padding: $code_font_size
151+
line-height: 1.25
152+
background-color: f5f5f5
153+
border-color: cccccc
154+
border-radius: $base_border_radius
155+
border-width: 0.75
156+
blockquote:
157+
font-color: $base_font_color
158+
font-size: $base_font_size_large
159+
border-width: 5
160+
border-color: $base_border_color
161+
cite:
162+
font-size: $base_font_size_small
163+
font-color: 999999
164+
sidebar:
165+
border-color: $page_background_color
166+
border-radius: $base_border_radius
167+
border-width: $base_border_width
168+
background-color: eeeeee
169+
title:
170+
font-color: $heading_font_color
171+
font-family: $heading_font_family
172+
font-size: $heading_h4_font_size
173+
font-style: $heading_font_style
174+
align: center
175+
footnotes:
176+
item-spacing: 5
177+
margin-top: 10
178+
example:
179+
border-color: $base_border_color
180+
border-radius: $base_border_radius
181+
border-width: 0.75
182+
background-color: transparent
183+
admonition:
184+
border-color: $base_border_color
185+
border-width: $base_border_width
186+
conum:
187+
font-family: $literal_font_family
188+
font-color: $literal_font_color
189+
font-size: $base_font_size
190+
line-height: 4 / 3
191+
image:
192+
align-default: left
193+
scaled-width-default: 0.5
194+
lead:
195+
# QUESTION what about $base_font_size_large?
196+
#font_size: floor($base_line_height_length * 0.8)
197+
#font_size: floor($base_font_size * 1.15)
198+
#line_height: 1.3
199+
font-size: $base_font_size_large
200+
line-height: 1.4
201+
abstract:
202+
#font_color: 404040
203+
font-color: 5c6266
204+
font-size: $lead_font_size
205+
line-height: $lead_line_height
206+
font-style: italic
207+
thematic-break:
208+
border-color: $base_border_color
209+
margin-top: $vertical_rhythm * 0.5
210+
margin-bottom: $vertical_rhythm * 1.5
211+
description-list:
212+
term-font-style: italic
213+
description-indent: $horizontal_rhythm * 1.25
214+
outline-list:
215+
indent: $horizontal_rhythm * 1.5
216+
# NOTE item_spacing applies to list items that do not have complex content
217+
item-spacing: $vertical_rhythm / 2
218+
#marker_font_color: 404040
219+
table:
220+
background-color: $page_background_color
221+
#head_background_color: <hex value>
222+
#head_font_color: $base_font_color
223+
even_row_background_color: f9f9f9
224+
#odd_row_background_color: <hex value>
225+
foot:
226+
background-color: f0f0f0
227+
border-color: dddddd
228+
border-width: $base_border_width
229+
# HACK accounting for line-height
230+
cell:
231+
padding: [3, 3, 6, 3]
232+
toc:
233+
indent: $horizontal_rhythm
234+
dot_leader_color: dddddd
235+
#dot_leader_content: ". "
236+
line_height: 1.4
237+
# NOTE In addition to footer, header is also supported
238+
header:
239+
font-size: $base_font_size_small
240+
font-style: bold
241+
font-color: $base_font_color
242+
# NOTE if background_color is set, background and border will span width of page
243+
border-color: dddddd
244+
border-width: 0.25
245+
height: $base_line_height_length * 4
246+
padding: [1, 1, $base_line_height_length * 5 / 12, 1]
247+
vertical-align: bottom
248+
recto:
249+
left:
250+
content: '{document-title}'
251+
# center:
252+
# content: '{page-number} / {page-count}'
253+
right:
254+
content: '{chapter-title}'
255+
verso:
256+
left:
257+
content: '{document-title}'
258+
# center:
259+
# content: '{page-number} / {page-count}'
260+
right:
261+
content: '{chapter-title}'
262+
footer:
263+
font-size: $base_font_size_small
264+
font-color: $base_font_color
265+
# NOTE if background_color is set, background and border will span width of page
266+
border-color: dddddd
267+
border-width: 0.25
268+
height: $base_line_height_length * 4
269+
padding: [$base_line_height_length * 5 / 12, 1, 0, 1]
270+
vertical-align: top
271+
#image_valign: <alignment> or <number>
272+
# additional attributes for content:
273+
# * {page-count}
274+
# * {page-number}
275+
# * {document-title}
276+
# * {document-subtitle}
277+
# * {chapter-title}
278+
# * {section-title}
279+
# * {section-or-chapter-title}
280+
recto:
281+
left:
282+
content: 'https://www.diguage.com[D瓜哥 · https://www.diguage.com/]'
283+
# center:
284+
# content:
285+
right:
286+
content: '{page-number} / {page-count}'
287+
verso:
288+
left:
289+
content: 'https://www.diguage.com[D瓜哥 · https://www.diguage.com/]'
290+
# center:
291+
# content:
292+
right:
293+
content: '{page-number} / {page-count}'

0 commit comments

Comments
 (0)