mirror of
https://github.com/captn3m0/google-sre-ebook.git
synced 2024-09-10 13:46:41 +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:
|
||||
|
||||
- Make
|
||||
- Ruby
|
||||
- `gem install bundler`
|
||||
- `bundle install`
|
||||
@ -79,6 +80,33 @@ BOOK_SLUG='sre_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
|
||||
|
||||
- metadata is not complete. There are just too many authors
|
||||
|
@ -12,6 +12,13 @@ export ${BOOKS[${BOOK_SLUG^^}]}
|
||||
# Common vars.
|
||||
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 \
|
||||
# # Remove the /sre/ directories
|
||||
# Save stuff in html/ directory
|
||||
@ -96,6 +103,7 @@ pandoc --from=html \
|
||||
-V subparagraph \
|
||||
-V geometry=margin=2cm \
|
||||
-V fig_caption=false \
|
||||
${PDF_OPTIONS[@]} \
|
||||
--columns=60 \
|
||||
complete.html
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user