From 758952605ea8cb1b7cf926076f591007d8d98b7e Mon Sep 17 00:00:00 2001 From: Charlotte Koch Date: Thu, 16 Feb 2023 16:44:34 -0800 Subject: First commit --- .gitignore | 6 +++ Gemfile | 3 ++ LICENSE | 23 +++++++++ README.md | 33 ++++++++++++ fonts/EBGaramond-COPYING | 93 ++++++++++++++++++++++++++++++++++ fonts/EBGaramond-Initials.ttf | Bin 0 -> 262724 bytes fonts/EBGaramond-InitialsF1.ttf | Bin 0 -> 202440 bytes fonts/EBGaramond-InitialsF2.ttf | Bin 0 -> 8692 bytes fonts/EBGaramond08-Italic.ttf | Bin 0 -> 180220 bytes fonts/EBGaramond08-Regular.ttf | Bin 0 -> 280540 bytes fonts/EBGaramond12-AllSC.ttf | Bin 0 -> 184628 bytes fonts/EBGaramond12-Italic.ttf | Bin 0 -> 330352 bytes fonts/EBGaramond12-Regular.ttf | Bin 0 -> 498588 bytes fonts/EBGaramondSC08-Regular.ttf | Bin 0 -> 261780 bytes fonts/EBGaramondSC12-Regular.ttf | Bin 0 -> 412464 bytes fonts/Tuffy-Bold.ttf | Bin 0 -> 105220 bytes fonts/Tuffy-BoldItalic.ttf | Bin 0 -> 87864 bytes fonts/Tuffy-COPYING | 5 ++ fonts/Tuffy-Italic.ttf | Bin 0 -> 87444 bytes fonts/Tuffy-Regular.ttf | Bin 0 -> 132864 bytes fonts/TuffyInfant-Regular.ttf | Bin 0 -> 119168 bytes fonts/TuffyScript-Regular.ttf | Bin 0 -> 119744 bytes lib/willora_pdf_converter.rb | 19 +++++++ mk/willora.mk | 57 +++++++++++++++++++++ themes/poppy-theme.yml | 105 +++++++++++++++++++++++++++++++++++++++ 25 files changed, 344 insertions(+) create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 LICENSE create mode 100644 README.md create mode 100644 fonts/EBGaramond-COPYING create mode 100644 fonts/EBGaramond-Initials.ttf create mode 100644 fonts/EBGaramond-InitialsF1.ttf create mode 100644 fonts/EBGaramond-InitialsF2.ttf create mode 100644 fonts/EBGaramond08-Italic.ttf create mode 100644 fonts/EBGaramond08-Regular.ttf create mode 100644 fonts/EBGaramond12-AllSC.ttf create mode 100644 fonts/EBGaramond12-Italic.ttf create mode 100644 fonts/EBGaramond12-Regular.ttf create mode 100644 fonts/EBGaramondSC08-Regular.ttf create mode 100644 fonts/EBGaramondSC12-Regular.ttf create mode 100644 fonts/Tuffy-Bold.ttf create mode 100644 fonts/Tuffy-BoldItalic.ttf create mode 100644 fonts/Tuffy-COPYING create mode 100644 fonts/Tuffy-Italic.ttf create mode 100644 fonts/Tuffy-Regular.ttf create mode 100644 fonts/TuffyInfant-Regular.ttf create mode 100644 fonts/TuffyScript-Regular.ttf create mode 100644 lib/willora_pdf_converter.rb create mode 100644 mk/willora.mk create mode 100644 themes/poppy-theme.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d7cfe98 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.adoc +*.pdf +*.swo +*.swp +Gemfile.lock +vendor/ diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..5657762 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" +gem "asciidoctor-pdf" +gem "rghost" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ec2b441 --- /dev/null +++ b/LICENSE @@ -0,0 +1,23 @@ +Copyright 2023 Charlotte Koch. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..887a479 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# WilloraPDF + +**WilloraPDF** is a free and open source document preparation system for +professional publishing. + +It is a collection of themes, tools and other goodies for +[Asciidoctor-PDF][]. **WilloraPDF is designed to empower self-publishers** +and lower the barrier to entry for authors who want their work +professionally printed. + +It is currently a **work in progress,** being developed alongside my debut +novel. Version 1.0 of WilloraPDF will be released when the first paperback +and/or hardcover editions are printed for my book! Then you'll know for certain +that WilloraPDF _can_ be used to publish actual, real-life books. + + +## Use cases + +- Typesetting for printed text with no (or very few) illustrations +- Render PDFs for local home printing or actual bookbinding +- Generate properly formatted manuscripts + + +## How it works + +1. Write your book in the [AsciiDoc][] markup language +2. Choose a theme, trim size and other settings +3. Feed your book into WilloraPDF +4. A good-looking PDF document comes out! + + +[Asciidoctor]: https://asciidoctor.org/ +[Asciidoctor-PDF]: https://docs.asciidoctor.org/pdf-converter/latest/ diff --git a/fonts/EBGaramond-COPYING b/fonts/EBGaramond-COPYING new file mode 100644 index 0000000..6049b0c --- /dev/null +++ b/fonts/EBGaramond-COPYING @@ -0,0 +1,93 @@ +Copyright (c) 2010-2013 Georg Duffner (http://www.georgduffner.at) + +All "EB Garamond" Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/fonts/EBGaramond-Initials.ttf b/fonts/EBGaramond-Initials.ttf new file mode 100644 index 0000000..266bd4d Binary files /dev/null and b/fonts/EBGaramond-Initials.ttf differ diff --git a/fonts/EBGaramond-InitialsF1.ttf b/fonts/EBGaramond-InitialsF1.ttf new file mode 100644 index 0000000..957ded3 Binary files /dev/null and b/fonts/EBGaramond-InitialsF1.ttf differ diff --git a/fonts/EBGaramond-InitialsF2.ttf b/fonts/EBGaramond-InitialsF2.ttf new file mode 100644 index 0000000..fe27add Binary files /dev/null and b/fonts/EBGaramond-InitialsF2.ttf differ diff --git a/fonts/EBGaramond08-Italic.ttf b/fonts/EBGaramond08-Italic.ttf new file mode 100644 index 0000000..76c8113 Binary files /dev/null and b/fonts/EBGaramond08-Italic.ttf differ diff --git a/fonts/EBGaramond08-Regular.ttf b/fonts/EBGaramond08-Regular.ttf new file mode 100644 index 0000000..ec558aa Binary files /dev/null and b/fonts/EBGaramond08-Regular.ttf differ diff --git a/fonts/EBGaramond12-AllSC.ttf b/fonts/EBGaramond12-AllSC.ttf new file mode 100644 index 0000000..e97914f Binary files /dev/null and b/fonts/EBGaramond12-AllSC.ttf differ diff --git a/fonts/EBGaramond12-Italic.ttf b/fonts/EBGaramond12-Italic.ttf new file mode 100644 index 0000000..c453410 Binary files /dev/null and b/fonts/EBGaramond12-Italic.ttf differ diff --git a/fonts/EBGaramond12-Regular.ttf b/fonts/EBGaramond12-Regular.ttf new file mode 100644 index 0000000..d00050e Binary files /dev/null and b/fonts/EBGaramond12-Regular.ttf differ diff --git a/fonts/EBGaramondSC08-Regular.ttf b/fonts/EBGaramondSC08-Regular.ttf new file mode 100644 index 0000000..1be871e Binary files /dev/null and b/fonts/EBGaramondSC08-Regular.ttf differ diff --git a/fonts/EBGaramondSC12-Regular.ttf b/fonts/EBGaramondSC12-Regular.ttf new file mode 100644 index 0000000..ef44b24 Binary files /dev/null and b/fonts/EBGaramondSC12-Regular.ttf differ diff --git a/fonts/Tuffy-Bold.ttf b/fonts/Tuffy-Bold.ttf new file mode 100644 index 0000000..9df0646 Binary files /dev/null and b/fonts/Tuffy-Bold.ttf differ diff --git a/fonts/Tuffy-BoldItalic.ttf b/fonts/Tuffy-BoldItalic.ttf new file mode 100644 index 0000000..e409820 Binary files /dev/null and b/fonts/Tuffy-BoldItalic.ttf differ diff --git a/fonts/Tuffy-COPYING b/fonts/Tuffy-COPYING new file mode 100644 index 0000000..17f5c79 --- /dev/null +++ b/fonts/Tuffy-COPYING @@ -0,0 +1,5 @@ +I have placed these fonts in the Public Domain. This is all 100% my +own work. Usage is totally unrestricted. If you want to make +derivative works for any purpose, please go ahead. + +-Thatcher Ulrich http://tulrich.com diff --git a/fonts/Tuffy-Italic.ttf b/fonts/Tuffy-Italic.ttf new file mode 100644 index 0000000..f4724ef Binary files /dev/null and b/fonts/Tuffy-Italic.ttf differ diff --git a/fonts/Tuffy-Regular.ttf b/fonts/Tuffy-Regular.ttf new file mode 100644 index 0000000..4d7a4c7 Binary files /dev/null and b/fonts/Tuffy-Regular.ttf differ diff --git a/fonts/TuffyInfant-Regular.ttf b/fonts/TuffyInfant-Regular.ttf new file mode 100644 index 0000000..a1aef1f Binary files /dev/null and b/fonts/TuffyInfant-Regular.ttf differ diff --git a/fonts/TuffyScript-Regular.ttf b/fonts/TuffyScript-Regular.ttf new file mode 100644 index 0000000..916b506 Binary files /dev/null and b/fonts/TuffyScript-Regular.ttf differ diff --git a/lib/willora_pdf_converter.rb b/lib/willora_pdf_converter.rb new file mode 100644 index 0000000..8fb9d4a --- /dev/null +++ b/lib/willora_pdf_converter.rb @@ -0,0 +1,19 @@ +# +# WilloraPDF +# Charlotte Koch +# + +# With guidance from: +# - https://docs.asciidoctor.org/pdf-converter/latest/extend/create-converter/ +# - https://docs.asciidoctor.org/pdf-converter/latest/extend/use-cases/#custom-thematic-break +class WilloraPDFConverter < Asciidoctor::Converter.for('pdf') + register_for 'pdf' + + # My custom thematic break, which is just a blank space the size of the main + # font. (The default thematic break draws a horizontal rule.) + def convert_thematic_break(node) + theme_margin(:thematic_break, :top) + move_down(theme.base_font_size) + theme_margin(:thematic_break, ((block_next = next_enclosed_block node) ? :bottom : :top), block_next || true) + end +end diff --git a/mk/willora.mk b/mk/willora.mk new file mode 100644 index 0000000..b459c93 --- /dev/null +++ b/mk/willora.mk @@ -0,0 +1,57 @@ +# +# willora.mk +# Charlotte Koch +# + +# XXX this should be generated w/ a configure-step? +WILLORABASE?= ${.CURDIR} + +NAME?= mybook +PDF_OUT?= ${NAME}.pdf +ADOC_TOTAL= ${NAME}.adoc + +BUNDLE?= bundle +THEME?= poppy +THEMEDIR?= ${WILLORABASE}/themes +FONTDIR?= ${WILLORABASE}/fonts +MEDIA?= prepress + +CUSTOM_PDF_CONVERTER= ${WILLORABASE}/lib/willora_pdf_converter.rb + +########## ########## ########## + +# XXX: Figure out why I can't do this: +# 'asciidoctor-pdf -a optimize' +# > GPL Ghostscript 9.50: Can't find initialization file gs_init.ps. +# https://docs.asciidoctor.org/pdf-converter/latest/optimize-pdf/ + +${PDF_OUT}: ${THEMEDIR}/${THEME}-theme.yml ${CUSTOM_PDF_CONVERTER} ${ADOC_TOTAL} Gemfile.lock + ${BUNDLE} exec sciidoctor-pdf \ + -v \ + -r ${CUSTOM_PDF_CONVERTER} \ + -d book \ + -o ${.TARGET} \ + -a pdf-fontsdir=${FONTDIR} \ + -a pdf-theme=${THEME} \ + -a pdf-themesdir=${THEMEDIR} \ + -a media=${MEDIA} \ + -a text-align=justify \ + ${ADOC_TOTAL} + +${ADOC_TOTAL}: ${CHAPTERS} + rm -f ${.TARGET} +.for chapter in ${CHAPTERS} + dos2unix < ${chapter} | sed -E \ + -e 's,[[:space:]]--[[:space:]],\&\#8212;,g' \ + -e 's,\é,\&\#233;,g' >> ${.TARGET} + printf '\n\n' >> ${.TARGET} +.endfor + +Gemfile.lock: + ${BUNDLE} install + +########## ########## ########## + +.PHONY: clean +clean: + rm -f ${PDF_OUT} ${ADOC_TOTAL} diff --git a/themes/poppy-theme.yml b/themes/poppy-theme.yml new file mode 100644 index 0000000..e17c1a5 --- /dev/null +++ b/themes/poppy-theme.yml @@ -0,0 +1,105 @@ +# +# WilloraPDF +# "Poppy" Asciidoctor PDF theme +# +# - IngramSpark 5.25"x8" Perfectbound (paperback) +# - Using my edition of "The Poppy War" as a template +# +--- + +extends: base + +font: + catalog: + merge: false + EBGaramond: + normal: EBGaramond08-Regular.ttf + italic: EBGaramond08-Italic.ttf + bold: EBGaramond12-Regular.ttf + WaterGothic: + normal: WatGoth1.ttf + italic: WatGoth1.ttf + bold: WatGoth1.ttf + Cabin: + normal: Cabin-Regular.ttf + italic: Cabin-Italic.ttf + bold: Cabin-Bold.ttf + Tuffy: + normal: Tuffy-Regular.ttf + italic: Tuffy-Italic.ttf + bold: Tuffy-Bold.ttf + +running-content: + start-at: 4 + +page: + layout: portrait + margin: [0.75in, 0.5in, 0.5in, 0.5in] + margin-inner: 0.5in + size: [5.25in, 8in] + numbering: + start-at: 4 + +base: + font-color: #000000 + font-family: EBGaramond + font-size: 12pt + line-height: 1.25 + +title-page: + text-align: center + title: + font-family: WaterGothic + font-size: 34pt + authors: + font-size: 16pt + +prose: + text-indent-inner: 12pt + margin-bottom: 0 + margin-inner: 0 + +verse: + font-family: EBGaramond + border-left-width: 0 + +heading: + h1: + font-family: Tuffy + font-style: normal + text-align: center + margin-page-top: 2.0in + h2: + font-family: Tuffy + font-style: normal + text-align: center + margin-page-top: 1.0in + margin-bottom: 0.5in + +# "Real" Poppy style +header: + font-family: Tuffy + font-size: 9pt + height: 0.75in + line-height: 1.0 + verso: + left: + content: '{page-number}' + center: + content: 'CHARLOTTE KOCH' + recto: + center: + content: 'THE WOLFSKULL STANDARD' + right: + content: '{page-number}' + +# Plain style +#header: +# height: 0.75in +# line-height: 1.0 +# verso: +# center: +# content: '{page-number}' +# recto: +# center: +# content: '{page-number}' -- cgit v1.2.3