mirror of
https://github.com/captn3m0/google-sre-ebook.git
synced 2024-09-21 00:56:58 +00:00
Configurable font size in PDF
This commit is contained in:
parent
8087055b50
commit
d8a848cfe5
28
README.md
28
README.md
@ -62,6 +62,7 @@ The build for the above Docker image can be audited at <https://hub.docker.com/r
|
|||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
|
- Make
|
||||||
- Ruby
|
- Ruby
|
||||||
- `gem install bundler`
|
- `gem install bundler`
|
||||||
- `bundle install`
|
- `bundle install`
|
||||||
@ -79,6 +80,33 @@ BOOK_SLUG='sre_book' ./generate.sh
|
|||||||
BOOK_SLUG='srw_book' ./generate.sh
|
BOOK_SLUG='srw_book' ./generate.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### PDF options
|
||||||
|
|
||||||
|
Any option can be passed to `pandoc` by `PDF_OPT_` prefix, for example:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
PDF_OPT_GEOMETRY=margin=1.5cm \
|
||||||
|
PDF_OPT_DOCUMENTCLASS=extbook \
|
||||||
|
PDF_OPT_FONTSIZE=14pt \
|
||||||
|
PDF_OPT_MAINFONT=LiberationSerif-Regular.ttf \
|
||||||
|
PDF_OPT_MAINFONTOPTIONS=BoldFont=LiberationSerif-Bold.ttf,ItalicFont=LiberationSerif-Italic.ttf,BoldItalicFont=LiberationSerif-BoldItalic.ttf \
|
||||||
|
PDF_OPT_MONOFONT=LiberationMono-Regular.ttf \
|
||||||
|
PDF_OPT_MONOFONTOPTIONS=BoldFont=LiberationMono-Bold.ttf,ItalicFont=LiberationMono-Italic.ttf,BoldItalicFont=LiberationMono-BoldItalic.ttf \
|
||||||
|
PDF_OPT_SANSFONT=LiberationSans-Regular.ttf \
|
||||||
|
PDF_OPT_SANSFONTOPTIONS=BoldFont=LiberationSans-Bold.ttf,ItalicFont=LiberationSans-Italic.ttf,BoldItalicFont=LiberationSans-BoldItalic.ttf \
|
||||||
|
BOOK_SLUG=sre_book ./generate.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Default options passed to `pandoc` in `generate.sh` are overloaded by `PDF_OPT_` prefix, see `PDF_OPT_GEOMETRY` in above example.
|
||||||
|
|
||||||
|
Fonts in above axample are packed to `fonts-liberation2` on **Ubuntu**.
|
||||||
|
|
||||||
|
See more details:
|
||||||
|
|
||||||
|
* <https://pandoc.org/MANUAL.html#fonts>
|
||||||
|
* <https://ctan.org/pkg/extsizes>
|
||||||
|
* <https://ctan.org/pkg/fontspec>
|
||||||
|
|
||||||
# Known Issues
|
# Known Issues
|
||||||
|
|
||||||
- metadata is not complete. There are just too many authors
|
- metadata is not complete. There are just too many authors
|
||||||
|
@ -12,6 +12,13 @@ export ${BOOKS[${BOOK_SLUG^^}]}
|
|||||||
# Common vars.
|
# Common vars.
|
||||||
IMGS_DOMAIN="lh3.googleusercontent.com"
|
IMGS_DOMAIN="lh3.googleusercontent.com"
|
||||||
|
|
||||||
|
PDF_OPTIONS=()
|
||||||
|
for i in ${!PDF_OPT_*}; do
|
||||||
|
declare -n val=$i
|
||||||
|
key=${i#PDF_OPT_}
|
||||||
|
PDF_OPTIONS+=("-V" "${key,,}=${val}");
|
||||||
|
done
|
||||||
|
|
||||||
# Make sure that links are relative \
|
# Make sure that links are relative \
|
||||||
# # Remove the /sre/ directories
|
# # Remove the /sre/ directories
|
||||||
# Save stuff in html/ directory
|
# Save stuff in html/ directory
|
||||||
@ -96,6 +103,7 @@ pandoc --from=html \
|
|||||||
-V subparagraph \
|
-V subparagraph \
|
||||||
-V geometry=margin=2cm \
|
-V geometry=margin=2cm \
|
||||||
-V fig_caption=false \
|
-V fig_caption=false \
|
||||||
|
${PDF_OPTIONS[@]} \
|
||||||
--columns=60 \
|
--columns=60 \
|
||||||
complete.html
|
complete.html
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user