Skip to content

Commit

Permalink
add config and theme for eBook
Browse files Browse the repository at this point in the history
  • Loading branch information
diguage committed Mar 3, 2020
1 parent 3badbe7 commit 4f3315d
Show file tree
Hide file tree
Showing 5 changed files with 453 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.html
*.pdf
*.epub
.classpath
.project
.settings/
Expand All @@ -10,4 +11,6 @@ target
*.svg
*.html
.factorypath
/docs/.asciidoctor/
.asciidoctor/
*.ttf
fonts.ttf.tgz
12 changes: 12 additions & 0 deletions cfg/fonts/download-fonts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
#
# Download the fonts

wget https://github.com/diguage/jdk-source-analysis/releases/download/source-fonts.ttf/fonts.ttf.tgz

tar -zxvf fonts.ttf.tgz


# Backup download URL: https://github.com/adobe-fonts/source-han-serif/archive/1.001R.zip

# Maybe you have to convert the OTF fonts to TTF fonts by the otf2ttf tools of AFDKO(https://github.com/adobe-type-tools/afdko/)
1 change: 1 addition & 0 deletions cfg/plantuml.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
skinparam defaultFontName Hiragino Sans GB
293 changes: 293 additions & 0 deletions cfg/theme/Source-theme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
font:
catalog:
Source Han Serif SC:
normal: SourceHanSerifSC-Regular.ttf
bold: SourceHanSerifSC-Bold.ttf
italic: SourceHanSerifSC-Medium.ttf
bold_italic: SourceHanSerifSC-SemiBold.ttf
#SourceHanSerifSC-Heavy.otf
#SourceHanSerifSC-ExtraLight.otf
#SourceHanSerifSC-Light.otf
Source Code Pro:
normal: SourceCodePro-Regular.ttf
bold: SourceCodePro-Semibold.ttf
italic: SourceCodePro-It.ttf
bold_italic: SourceCodePro-BoldIt.ttf
#SourceCodePro-Black.ttf
#SourceCodePro-BlackIt.ttf
#SourceCodePro-ExtraLight.ttf
#SourceCodePro-ExtraLightIt.ttf
#SourceCodePro-Light.ttf
#SourceCodePro-LightIt.ttf
#SourceCodePro-Medium.ttf
#SourceCodePro-MediumIt.ttf
#SourceCodePro-Bold.ttf
#SourceCodePro-Semibold.ttf
#SourceCodePro-SemiboldIt.ttf
fallbacks:
- Source Han Serif SC
page:
background-color: ffffff
layout: portrait
# NOTE multiply inches by 72 to get pt values
#margin: [0.5 * 72, 0.67 * 72, 0.67 * 72, 0.67 * 72]
margin: [1.2in, 1in, 1.2in, 1in]
margin-inner: 1.2in
margin-outer: 1in
# size can be a named size (e.g., A4) or custom dimensions (e.g., [8.25in, 11.69in])
size: A4
numbering-start-at: body
base:
# color as hex string (leading # is optional)
font-color: 333333
# color as RGB array
#font_color: [51, 51, 51]
# color as CMYK array (approximated)
#font_color: [0, 0, 0, 0.92]
#font_color: [0, 0, 0, 92%]
font-family: Source Han Serif SC
# choose one of these font_size/line_height_length combinations
#font_size: 14
#line_height_length: 20
#font_size: 11.25
#line_height_length: 18
#font_size: 11.2ArrayList
#line_height_length: 16
#font-size: 10.5
# correct line height for Noto Serif metrics
#line-height-length: 15
font-size: 9
line-height-length: 15
line-height: $base_line_height_length / $base_font_size
font-size-large: round($base_font_size * 1.25)
font-size-small: round($base_font_size * 0.85)
font-size-min: $base_font_size * 0.75
font-style: normal
align: left
border-radius: 4
border-width: 0.5
border-color: eeeeee
# FIXME vertical_rhythm is weird; we should think in terms of ems
#vertical_rhythm: $base_line_height_length * 2 / 3
# correct line height for Noto Serif metrics
vertical_rhythm: $base_line_height_length
horizontal_rhythm: $base_line_height_length
link:
font-color: 428bca
# literal is currently used for inline monospaced in prose and table cells
literal:
font-color: b12146
font-family: Source Code Pro
heading:
#font_color: 181818
font-color: $base_font_color
font-family: $base_font_family
# h1 is used for part titles
h1-font-size: floor($base_font_size * 2.6)
# h2 is used for chapter titles
h2-font-size: floor($base_font_size * 2.15)
h3-font-size: round($base_font_size * 1.7)
h4-font-size: $base_font_size_large
h5-font-size: $base_font_size
h6-font-size: $base_font_size_small
font-style: bold
#line_height: 1.4
# correct line height for Noto Serif metrics
line-height: 1.2
margin-top: $vertical_rhythm * 0.2
margin-bottom: $vertical_rhythm * 0.8
#section:
# indent: [0.5in, 0]
title-page:
align: right
title:
top: 50%
font-size: $heading_h1_font_size * 1.25
font-color: 999999
line-height: 0.9
subtitle:
font-size: $heading_h3_font_size
font-style: bold_italic
line-height: 1
authors:
margin-top: $base_font_size * 1.25
font-size: $base_font_size_large
font-color: 181818
content:
name_only: "{author}"
with_email: "{author} <{email}>"
with_url: '{url}[{author} · {url}]'
revision:
margin-top: $base_font_size * 1.4
#prose:
# margin-top: 0
# margin-bottom: $vertical_rhythm
# margin-inner: 0
# text-indent: 0
block:
#margin_top: 0
#margin_bottom: $vertical_rhythm
padding: [$vertical_rhythm, $vertical_rhythm * 1.25, $vertical_rhythm, $vertical_rhythm * 1.25]
# code is used for source blocks (perhaps change to source or listing?)
caption:
font-style: italic
align: left
# FIXME perhaps set line_height instead of / in addition to margins?
margin-inside: $vertical_rhythm * 0.25
margin-outside: 0
code:
font-color: $base_font_color
#font_family: Liberation Mono
#font_size: floor($base_font_size * 0.9)
#font_size: 10
#padding: [9.5, 9.5, 9.5, 9.5]
# LiberationMono carries extra gap below line
#padding: [10, 10, 7.5, 10]
#line_height: 1.45
font-family: $literal_font_family
font-size: ceil($base_font_size)
#padding: [$base_font_size, $code_font_size, $base_font_size, $code_font_size]
padding: $code_font_size
line-height: 1.25
background-color: f5f5f5
border-color: cccccc
border-radius: $base_border_radius
border-width: 0.75
blockquote:
font-color: $base_font_color
font-size: $base_font_size_large
border-width: 5
border-color: $base_border_color
cite:
font-size: $base_font_size_small
font-color: 999999
sidebar:
border-color: $page_background_color
border-radius: $base_border_radius
border-width: $base_border_width
background-color: eeeeee
title:
font-color: $heading_font_color
font-family: $heading_font_family
font-size: $heading_h4_font_size
font-style: $heading_font_style
align: center
footnotes:
item-spacing: 5
margin-top: 10
example:
border-color: $base_border_color
border-radius: $base_border_radius
border-width: 0.75
background-color: transparent
admonition:
border-color: $base_border_color
border-width: $base_border_width
conum:
font-family: $literal_font_family
font-color: $literal_font_color
font-size: $base_font_size
line-height: 4 / 3
image:
align-default: left
scaled-width-default: 0.5
lead:
# QUESTION what about $base_font_size_large?
#font_size: floor($base_line_height_length * 0.8)
#font_size: floor($base_font_size * 1.15)
#line_height: 1.3
font-size: $base_font_size_large
line-height: 1.4
abstract:
#font_color: 404040
font-color: 5c6266
font-size: $lead_font_size
line-height: $lead_line_height
font-style: italic
thematic-break:
border-color: $base_border_color
margin-top: $vertical_rhythm * 0.5
margin-bottom: $vertical_rhythm * 1.5
description-list:
term-font-style: italic
description-indent: $horizontal_rhythm * 1.25
outline-list:
indent: $horizontal_rhythm * 1.5
# NOTE item_spacing applies to list items that do not have complex content
item-spacing: $vertical_rhythm / 2
#marker_font_color: 404040
table:
background-color: $page_background_color
#head_background_color: <hex value>
#head_font_color: $base_font_color
even_row_background_color: f9f9f9
#odd_row_background_color: <hex value>
foot:
background-color: f0f0f0
border-color: dddddd
border-width: $base_border_width
# HACK accounting for line-height
cell:
padding: [3, 3, 6, 3]
toc:
indent: $horizontal_rhythm
dot_leader_color: dddddd
#dot_leader_content: ". "
line_height: 1.4
# NOTE In addition to footer, header is also supported
header:
font-size: $base_font_size_small
font-style: bold
font-color: $base_font_color
# NOTE if background_color is set, background and border will span width of page
border-color: dddddd
border-width: 0.25
height: $base_line_height_length * 4
padding: [1, 1, $base_line_height_length * 5 / 12, 1]
vertical-align: bottom
recto:
left:
content: '{document-title}'
# center:
# content: '{page-number} / {page-count}'
right:
content: '{chapter-title}'
verso:
left:
content: '{document-title}'
# center:
# content: '{page-number} / {page-count}'
right:
content: '{chapter-title}'
footer:
font-size: $base_font_size_small
font-color: $base_font_color
# NOTE if background_color is set, background and border will span width of page
border-color: dddddd
border-width: 0.25
height: $base_line_height_length * 4
padding: [$base_line_height_length * 5 / 12, 1, 0, 1]
vertical-align: top
#image_valign: <alignment> or <number>
# additional attributes for content:
# * {page-count}
# * {page-number}
# * {document-title}
# * {document-subtitle}
# * {chapter-title}
# * {section-title}
# * {section-or-chapter-title}
recto:
left:
content: 'https://www.diguage.com[D瓜哥 · https://www.diguage.com/]'
# center:
# content:
right:
content: '{page-number} / {page-count}'
verso:
left:
content: 'https://www.diguage.com[D瓜哥 · https://www.diguage.com/]'
# center:
# content:
right:
content: '{page-number} / {page-count}'
Loading

0 comments on commit 4f3315d

Please sign in to comment.