From 7e9483d0ffc2a400507c250df50dcf5ad3ef0cf8 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 8 May 2006 22:54:19 +0000 Subject: Add font-selection mechanism to the paper backend. Since we have no way to load font metrics dynamically, we're restricted to the fonts whose metrics are compiled into Halibut. Font structures aren't reused when the same font is specified twice, nor are unused fonts removed from the output. Finally, the default configuration overflows lines in the manual, but this would need a change to Halibut's grammar to fix. Still, what's there works. [originally from svn r6667] --- doc/index.but | 27 ++++++++++++++++ doc/output.but | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 119 insertions(+), 5 deletions(-) (limited to 'doc') diff --git a/doc/index.but b/doc/index.but index f244d0b..f347cfe 100644 --- a/doc/index.but +++ b/doc/index.but @@ -430,9 +430,36 @@ directive \IM{\\cfg\{paper-footer-distance\}} \c{paper-footer-distance} configuration directive \IM{\\cfg\{paper-footer-distance\}} \cw{\\cfg\{paper-footer-distance\}} +\IM{\\cfg\{paper-base-fonts\}} \c{paper-base-fonts} configuration directive +\IM{\\cfg\{paper-base-fonts\}} \cw{\\cfg\{paper-base-fonts\}} + \IM{\\cfg\{paper-base-font-size\}} \c{paper-base-font-size} configuration directive \IM{\\cfg\{paper-base-font-size\}} \cw{\\cfg\{paper-base-font-size\}} +\IM{\\cfg\{paper-title-fonts\}} \c{paper-title-fonts} configuration directive +\IM{\\cfg\{paper-title-fonts\}} \cw{\\cfg\{paper-title-fonts\}} + +\IM{\\cfg\{paper-title-font-size\}} \c{paper-title-font-size} configuration directive +\IM{\\cfg\{paper-title-font-size\}} \cw{\\cfg\{paper-title-font-size\}} + +\IM{\\cfg\{paper-chapter-fonts\}} \c{paper-chapter-fonts} configuration directive +\IM{\\cfg\{paper-chapter-fonts\}} \cw{\\cfg\{paper-chapter-fonts\}} + +\IM{\\cfg\{paper-chapter-font-size\}} \c{paper-chapter-font-size} configuration directive +\IM{\\cfg\{paper-chapter-font-size\}} \cw{\\cfg\{paper-chapter-font-size\}} + +\IM{\\cfg\{paper-section-fonts\}} \c{paper-section-fonts} configuration directive +\IM{\\cfg\{paper-section-fonts\}} \cw{\\cfg\{paper-section-fonts\}} + +\IM{\\cfg\{paper-section-font-size\}} \c{paper-section-font-size} configuration directive +\IM{\\cfg\{paper-section-font-size\}} \cw{\\cfg\{paper-section-font-size\}} + +\IM{\\cfg\{paper-code-fonts\}} \c{paper-code-fonts} configuration directive +\IM{\\cfg\{paper-code-fonts\}} \cw{\\cfg\{paper-code-fonts\}} + +\IM{\\cfg\{paper-code-font-size\}} \c{paper-code-font-size} configuration directive +\IM{\\cfg\{paper-code-font-size\}} \cw{\\cfg\{paper-code-font-size\}} + \IM{\\cfg\{paper-index-columns\}} \c{paper-index-columns} configuration directive \IM{\\cfg\{paper-index-columns\}} \cw{\\cfg\{paper-index-columns\}} diff --git a/doc/output.but b/doc/output.but index c9614cd..9148751 100644 --- a/doc/output.but +++ b/doc/output.but @@ -1497,18 +1497,89 @@ columns. entry and its page number. If the gap is smaller, the page number is moved to the next line. -\S2{output-paper-fonts} Fonts +\S2{output-paper-fonts} \ii{Fonts} + +The directives in this section control which fonts Halibut uses for +various kinds of text. Directives for setting the font normally take +three font names, the first of which is used for normal text, the +second for emphasised text, and the third for code. Any fonts which +aren't specified are left unchanged. Fonts are named using their +PostScript names and must be ones whose metrics are compiled into +Halibut. These are: + +\b \cw{Times-Roman} + +\b \cw{Times-Italic} + +\b \cw{Times-Bold} + +\b \cw{Times-BoldItalic} + +\b \cw{Helvetica} + +\b \cw{Helvetica-Oblique} + +\b \cw{Helvetica-Bold} + +\b \cw{Helvetica-BoldOblique} + +\b \cw{Courier} + +\b \cw{Courier-Oblique} + +\b \cw{Courier-Bold} + +\b \cw{Courier-BoldOblique} + +\ii{Font sizes} are specified in PostScript \i{points} (72 to the inch). + +\dt \I{\cw{\\cfg\{paper-title-fonts\}}}\cw{\\cfg\{paper-title-fonts\}\{}\e{normal-font}\cw{\}}[\cw{\{}\e{emph-font}\cw{\}}[\cw{\{}\e{code-font}\cw{\}}]] + +\dd Specifies the fonts to use for text in the document title. + +\dt \I{\cw{\\cfg\{paper-title-font-size\}}}\cw{\\cfg\{paper-title-font-size\}\{}\e{points}\cw{\}} + +\dd Specifies the \i{font size} of the document title. + +\dt \I{\cw{\\cfg\{paper-chapter-fonts\}}}\cw{\\cfg\{paper-chapter-fonts\}\{}\e{normal-font}\cw{\}}[\cw{\{}\e{emph-font}\cw{\}}[\cw{\{}\e{code-font}\cw{\}}]] + +\dd Specifies the fonts to use for text in chapter titles. + +\dt \I{\cw{\\cfg\{paper-chapter-font-size\}}}\cw{\\cfg\{paper-chapter-font-size\}\{}\e{points}\cw{\}} + +\dd Specifies the \i{font size} of chapter titles. + +\dt \I{\cw{\\cfg\{paper-section-fonts\}}}\cw{\\cfg\{paper-section-fonts\}\{}\e{level}\cw{\}\{}\e{normal-font}\cw{\}}[\cw{\{}\e{emph-font}\cw{\}}[\cw{\{}\e{code-font}\cw{\}}]] + +\dd Specifies the fonts to use for text in section headings at the \e{level} +specified. + +\dt \I{\cw{\\cfg\{paper-section-font-size\}}}\cw{\\cfg\{paper-section-font-size\}\{}\e{level}\cw{\}\{}\e{points}\cw{\}} + +\dd Specifies the \i{font size} of section headings at the \e{level} +specified. + +\dt \I{\cw{\\cfg\{paper-base-fonts\}}}\cw{\\cfg\{paper-base-fonts\}\{}\e{normal-font}\cw{\}}[\cw{\{}\e{emph-font}\cw{\}}[\cw{\{}\e{code-font}\cw{\}}]] + +\dd Specifies the fonts to use for text in the body text. \dt \I{\cw{\\cfg\{paper-base-font-size\}}}\cw{\\cfg\{paper-base-font-size\}\{}\e{points}\cw{\}} -\dd Specifies the font size of body text. +\dd Specifies the \i{font size} of body text. + +\dt \I{\cw{\\cfg\{paper-code-fonts\}}}\cw{\\cfg\{paper-code-fonts\}\{}\e{bold-font}\cw{\}}[\cw{\{}\e{italic-font}\cw{\}}[\cw{\{}\e{normal-font}\cw{\}}]] + +\dd Specifies the fonts to use for text in code paragraps. The +\e{bold-font} is used for bold text, the \e{italic-font} for +emphasised text, and the \e{normal-font} for normal code. -\# FIXME: actually, this doesn't appear to do anything at all - most -font sizes are still hardcoded. +\dt \I{\cw{\\cfg\{paper-code-font-size\}}}\cw{\\cfg\{paper-code-font-size\}\{}\e{points}\cw{\}} + +\dd Specifies the \i{font size} of text in code paragraphs. \dt \I{\cw{\\cfg\{paper-pagenum-font-size\}}}\cw{\\cfg\{paper-pagenum-font-size\}\{}\e{points}\cw{\}} -\dd Specifies the font size to use for page numbers. +\dd Specifies the font size to use for \i{page numbers}. \S2{output-paper-misc} Miscellaneous @@ -1567,7 +1638,23 @@ The default page size corresponds to 210\_\u00D7{x}\_297\_mm, i.e., \c \cfg{paper-index-gutter}{36} \c \cfg{paper-index-minsep}{18} \c +\c \cfg{paper-base-fonts}{Times-Roman}{Times-Italic}{Courier} \c \cfg{paper-base-font-size}{12} +\c \cfg{paper-code-fonts}{Courier-Bold}{Courier-Oblique}{Courier} +\c \cfg{paper-code-font-size}{12} +\c \cfg{paper-title-fonts}{Helvetica-Bold}{Helvetica-BoldOblique}{Courier-Bold} +\c \cfg{paper-title-font-size}{24} +\c \cfg{paper-chapter-fonts}{Helvetica-Bold}{Helvetica-BoldOblique}{Courier-Bold} +\c \cfg{paper-chapter-font-size}{20} +\c \cfg{paper-section-fonts}{0}{Helvetica-Bold}{Helvetica-BoldOblique}{Courier-Bold} +\c \cfg{paper-section-font-size}{0}{16} +\c \cfg{paper-section-fonts}{1}{Helvetica-Bold}{Helvetica-BoldOblique}{Courier-Bold} +\c \cfg{paper-section-font-size}{1}{14} +\c \cfg{paper-section-fonts}{2}{Helvetica-Bold}{Helvetica-BoldOblique}{Courier-Bold} +\c \cfg{paper-section-font-size}{2}{13} +\c ... and so on for all section levels below this ... +\e iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii +\c \c \cfg{paper-pagenum-font-size}{12} \c \c \cfg{paper-rule-thickness}{1} -- cgit v1.1