diff options
Diffstat (limited to 'Master/texmf-dist/doc/lualatex/novel/noveldocs-05-fonts.html')
-rw-r--r-- | Master/texmf-dist/doc/lualatex/novel/noveldocs-05-fonts.html | 549 |
1 files changed, 549 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/lualatex/novel/noveldocs-05-fonts.html b/Master/texmf-dist/doc/lualatex/novel/noveldocs-05-fonts.html new file mode 100644 index 00000000000..dfeeb50fe1b --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/novel/noveldocs-05-fonts.html @@ -0,0 +1,549 @@ +<!DOCTYPE html> +<html lang="en"> +<head> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> +<title>Class novel - 5 - Fonts</title> +<link rel="stylesheet" type="text/css" href="html-resources/novel-doc.css"/> +</head> + +<body> +<div id="master"> + + +<div id="toc"> + +<p>Document class "novel"</p> + +<p><a href="#a5">5. Fonts</a></p> + + +<ul> +<li><a href="#a5.1">5.1 General Considerations</a> + <ul> + <li><a href="#a5.1.1">5.1.1 Licensing</a></li> + <li><a href="#a5.1.2">5.1.2 Technical</a></li> + <li><a href="#a5.1.3">5.1.3 Appearance</a></li> + <li style="margin-bottom:0px;"><a href="#a5.1.4">5.1.4 The Default Fonts</a><br/> + <span style="visibility:hidden">5.1.4 </span>Libertinus and NovelDeco</li> + </ul></li><!-- end 5.1 --> +<li><a href="#a5.2">5.2 Font Names, Files, Features</a> + <ul> + <li><a href="#a5.2.1">5.2.1 Font Family vs. File Name</a></li> + <li><a href="#a5.2.2">5.2.2 Set/New by Family/Filename</a></li> + <li><a href="#a5.2.3">5.2.3 Open Type Features</a><br/> + <span style="visibility:hidden">5.2.3 </span>kerning, ligatures, numbers,<br/> + <span style="visibility:hidden">5.2.3 </span>letters, and many others</li> + <li><a href="#a5.2.4">5.2.4 Scale Pseudo-Feature</a></li> + <li><a href="#a5.2.5">5.2.5 Color and Opacity</a></li> + <li><a href="#a5.2.6">5.2.6 \CreateFeature{}</a></li> + </ul></li><!-- end 5.2 --> +<li><a href="#a5.3">5.3 Setting and Defining Fonts</a> + <ul> + <li><a href="#a5.3.1">5.3.1 General-Purpose Fonts</a><br/> + <span style="visibility:hidden">5.3.1 </span>main, sans, mono</li> + <li style="margin-bottom:0px;"><a href="#a5.3.2">5.3.2 Novel-Specific Fonts</a><br/> + <span style="visibility:hidden">5.3.2 </span>chapter, header, and others</li> + <li style="margin-bottom:0px;"><a href="#a5.3.3">5.3.3 New Font Commands</a></li> + <li><a href="#a5.3.4">5.3.4 Which Font Features?</a></li> + <li><a href="#a5.3.5">5.3.5 Local Feature Modifications</a></li> + </ul></li><!-- end 5.3 --> +<li><a href="#a5.4">5.4 Microtype Setup</a></li> + +</ul> + + + + +<p> </p> + + +</div><!-- end toc --> + + + +<div id="main"> +<a id="thetop"></a> + + +<h1>Documentation for <code>novel</code> document class</h1> +<p>Documentation version: 1.0.6.</p> + +<div class="pagetopage"> +<p><b>User Guide</b></p> +<p><a href="noveldocs-01-overview.html">1. Overview</a></p> +<p><a href="noveldocs-02-class-options.html">2. Class Options</a></p> +<p><a href="noveldocs-03-metadata-pdfx.html">3. Metadata, PDF/X</a></p> +<p><a href="noveldocs-04-layout.html">4. Page Layout</a></p> +<p>5. Choosing Fonts</p> +<p><a href="noveldocs-06-header-footer.html">6. Headers, Footers</a><br/> +<p><a href="noveldocs-07-text-size-style.html">7. Text Sizes, Styles</a></p> +<p><a href="noveldocs-08-images.html">8. Using Images</a></p> +<p><a href="noveldocs-09-chapters-displays.html">9. Chapters, Display Pages</a></p> +</div> + +<a id="a5"></a> +<h2 style="clear:none">5. Fonts</h2> + +<p>This page describes how to choose fonts and font features, and how to apply fonts within your document. If you are looking for information about how to specify the master text point size, see <a href="noveldocs-04-layout.html#a4.2.3">Page 4</a>. If you are looking for information about how to change the size of text within the body of your document, or about how to style text (such as italics), then see <a href="noveldocs-07-text-size-style.html">Page 7</a>.</p> +<p>Forget TeX PostScript fonts such as <code>cmr</code> and encodings such as <code>T1</code>. This is the Twenty-First Century. You will be using Unicode, Open Type fonts, and font features.</p> +<p>You may not have to choose or configure any fonts. The <code>novel</code> class is pre-configured with fonts carefully chosen for print fiction. They come with the SIL Open Font License, and can be used for commercial purposes. So, before you panic about having to learn a new way to handle fonts, try some test documents using the defaults.</p> + + +<a id="a5.1"></a> +<h3>5.1 General Considerations</h3> + +<p>Many TeX fonts are only available in older Type 1 format (PostScript) or even as bitmap metafonts. Do not use them.</p> + +<p>In some other cases, a TeX font package provides both the older format, and a newer Open Type (*.otf or *.ttf) format. The different formats will have different font names. Sometimes the difference is very slight. Carefully look at the font name for the Open Type format. Remember that most on-line discussions will refer to the older fonts, simply because they have been around longer.</p> + +<p>Do not attempt to load a font by the <code>\RequirePackage</code> or <code>\usepackage</code> commands. That will cause TeX to look for the older PostScript fonts, which will probably fail with an eror message about being unable to find metrics. And, even if the fonts happen to load, they will be the wrong ones. Instead, if you choose to use fonts other than the defaults, load them via the font setting commands described on this page.</p> + +<a id="a5.1.1"></a> +<h4>5.1.1 Licensing Issues</h4> + +<p>Presumably, you are writing your novel for commercial value, and do not intend to give anything away for free. For that reason, avoid fonts licensed under the GPL (GNU Public License) unless it has the font exception clause. Some TeX fonts are licensed under GPL, so watch out.</p> + +<p>Beware of fonts "free for personal use" from download sites. Your commercial application is not "personal use." Of course, if you like the font, you may purchase its commercial license.</p> + +<p>Also beware of fonts generically labeled as "freeware" with no particular designer name. If you don't know who created the font, then how do you know that it can be given away for free? Even if there is a designer name, some of them had second thoughts about "freeware." They intended the fonts to be free only if you give your own work away for free. But they didn't mention it. Maybe they have no legal recourse, but you don't want them making anonymous negative reviews of your book.</p> + +<p>You have numerous fonts already installed in your operating system, and perhaps others that came bundled with a particular application. If you intend to use those fonts, carefully read their licenses. It is often the case that fonts bundled with an application may <em>only</em> be used for documents created within, or processed by, that application.</p> + +<p>Always look for a Copyright notice, which can be identified with a particular person or organization. Copyright is good! It means that someone is claiming authorship of the font software. Only the Copyright owner has the right to give the font away for free, or license it to you after payment (often through an intermediary).</p> + +<p>If you prefer free fonts, the most widely accepted license is the <em>SIL Open Font License</em>. This allows you to use the font for commercial purposes, embed it in PDF, modify it to suit your needs (if you change the font name), and even re-distribute the modifications. The default fonts chosen for <code>novel</code> use this license.</p> + + +<a id="a5.1.2"></a> +<h4>5.1.2 Technical Issues</h4> + +<p>Many fonts have technical errors, even among professional fonts. Some of the errors are so minor that they are not worth fixing. This is particularly true for glyphs that are missing extrema.</p> + +<p>However, beware of fonts that are based on traced artwork. The late 1990s had an explosion of amateur dingbat and decorative fonts produced this way, by scanning images from old books and digitizing the scan. The resulting vector glyphs rarely meet standards, and often are quite awful. The problem is that when a commercial printer renders your PDF to print, the printer's software is very different from what you have on your home computer. A technically erroneous glyph might look OK at home, but be rejected commercially.</p> + +<p>If you have the knowledge, you can open a font in font editor software (such as FontForge) and ask it for validation. Missing extrema are rarely a problem, even if a lot of them are missing. Self-intersecting glyphs are not a problem if the the glyph is composed of two elements stuck together, such as Ç composed of C with separate cedilla. However, a self-intersecting glyph may be a problem if its lines criss-cross each other. Open paths, and outer paths drawn the wrong way, are often a problem. If the errors are confined to glyphs that you will not be using, then it can pass.</p> + + +<a id="a5.1.3"></a> +<h4>5.1.3 Appearance Issues</h4> + +<p>There are general expectations for book fonts, in terms of character sizes and shapes, and weights. Many of the widely-used TeX fonts, including Latin Modern, are unacceptable in fiction for this reason. The most commonly-used font in word processors, Times New Roman, is only marginally acceptable for fiction, and only because it is so often used by amateur writers who don't know how to change the font (but write books advising you to change your lifestyle).</p> + +<p>The best way to assess a font is to print it to paper. Computer screens rarely show details, except at large magnification. Depending on whom you ask for an opinion, fiction is most easily read when there are about 60 to 66 characters (including spaces) per line. To evaluate a font for the main text, print out some paragraphs about 4" to 4.25" wide, and scale the font's point size so that you get an average number of characters per line in that range. Be sure to do that: Adobe Garamond Pro at 12pt, Libertinus Serif at 11.4pt, and Libre Caslon Text at 9.6pt (!) provide about the same number of characters per line of text. At the proper point size, some fonts will look too dark, and others will look too light.</p> + +<p>Things to look for: Are the lowercase letters too tall? If they are, then it is hard for readers in many Western languages to find where sentences start, by looking for capital letters. Also, there is less white space between lines, which makes the text appear dense and harder to read. Is the shape of the characters so natural that you don't notice them? That's good! It is your writing, not the font, that is to be noticed. Remember that some fonts are designed for use at large size, in posters; such fonts tend to look mechanical in fiction. Other fonts are designed for computer screens; the letters will be too widely-spaced in fiction. Nearly all modern fonts have decent kerning and important ligatures, so that's not usually a decisive factor.</p> + +<p>The prevailing rule: If you notice the font, it's wrong.</p> + + +<a id="a5.1.4"></a> +<h4>5.1.4 The Default Fonts</h4> + +<p>After considerable examination of fonts, both within and without TeX, I settled on the <em>Libertinus</em> font family. This is a fork of the well-known <em>[Linux] Libertine</em> and <em>Biolinum</em> fonts. Libertinus is available only as Open Type, and can be installed as TeX package <code>libertinus</code>, or downloaded separately. Note that <code>\RequirePackage{libertinus}</code> and <code>\usepackage{libertinus}</code> <em>do not work</em>. You have to get the fonts yourself.</p> + +<p>Libertinus Serif has a favorable combination of quality, character set, Open Type features, glyph design, and licensing. Its character shapes are very good for flowing text, as in fiction. Do not confuse [Linux] Libertine or Libertinus with <em>Liberation</em>, which is a font resembling Times New Roman with a "word processor" look about it.</p> + +<p>If you don't have Libertinus, then <code>novel</code> will look for [Linux] Libertine and Biolinum. If you don't have those either, then solely for the purpose of providing minimal working examples, the Latin Modern fonts will be used as a last resort. But don't rely on Latin Modern for an actual book! Set your own Open Type fonts, or install Libertinus or Libertine/Biolinum.</p> + +<p>Class <code>novel</code> is bundled with its own custom font, NovelDeco. This font provides some hard-to-find capabilities that you might find useful.</p> + +<p>Libertinus, Libertine/Biolinum, and NovelDeco are licensed under the SIL Open Font License.</p> + +<p>Remember: You do not have to use TeX fonts. If you have the license for a font such as Adobe Garamond Pro, and wish to use it, you can easily do so.</p> + + + +<a id="a5.2"></a> +<h3>5.2 Font Names, Files, and Features</h3> + +<p>If you have used Open Type fonts before, then much of this will be familiar to you. But do glance through it. The use of exotic and context-dependent features will not be discussed, partly because they are rarely used in fiction, and partly because I lack experience in using them.</p> + +<p>You will be using <code>fontspec</code> syntax to select your own fonts. Much of what follows is a digested portion of the full <code>fontspec</code> documentation. There are many more features, and ways to use them, than will be described below.</p> + + +<a id="a5.2.1"></a> +<h4>5.2.1 Font (Family) Name vs. Font File Name</h4> + +<p>A <em>font file</em> is an individual file, with its own <em>file name</em>, including file extension. For example, libertinusserif-regular.otf and libertinusserif-italic.otf are two different font files. This much is obvious.</p> + +<p>A <em>font family name</em>, often merely called <em>font name</em>, refers to one or more font files that are variations of the same basic font. Some fonts are so unique that the family consists of just one file. For example, the NovelDeco font family consists of the one file NovelDeco.otf. Typically, a font family has four files, consisting of Regular, Italic, Bold, and BoldItalic variants. Even though there are four font files, there is a single font family name. Many font families have more than four files, including Semibold and Light weights, and Condensed tracking. It is up to the font designer to decide whether a Condensed variation of the "Bubble Turble" font should be treated as a member of the "Burble Turble" family, or as a separate "Burble Turble Condensed" family.</p> + +<p>The font (family) name can be learned by opening font files in your system font viewer. Currently, the Windows 10 font viewer uses "Font name" and the Ubuntu font viewer puts the font name in more prominent type. A font (family) name may contain more than one word, with or without spaces, and may contain a general classification such as <em>serif</em>, <em>sans</em>, or <em>mono</em>, because those are actually different families. But it will not contain words such as <em>regular</em>, <em>medium</em>, <em>semibold</em>, <em>bold</em>, or <em>italic</em>; those are for individual members of the same family. Within TeX, some of the older PostScript fonts have been re-worked as newer TrueType and Open Type fonts. The family names are slightly different, so pay attention.</p> + + +<p class="centerimg"> +<img src="html-resources/win10libser.png" width="268" height="184" alt="Windows 10 font viewer"/> +<img src="html-resources/ublibser.png" width="431" height="176" alt="Ubuntu font viewer"/> +</p> + + + +<a id="a5.2.2"></a> +<h4>5.2.2 Set/New by Font Name vs. File Name</h4> + +<p>When you set an existing font, or create a new font command, you can use either the font (family) name, or the specific font file name. However, there may be a big difference in results!</p> + +<p style="margin-top:10px"><b>By family name:</b></p> +<p><img class="floatright" style="padding-top:12px" src="html-resources/fontbyfamily.png" width="338" height="42" alt="font family defined"/> When you use the <em>font family name</em>, you configure all of the Regular, Italic, Bold, and BoldItalic variants. The usual TeX commands will be applied:</p> +<p>Preamble:</p> +<p class="code" style="clear:both"><code>\NewFontFamily\rway{Raleway}</code></p> +<p>Document Body:</p> +<p class="code"><code>{\rway I came, \textbf{I saw}, \emph{I conquered}, \textsc{I left}.}</code></p> + + +<p style="margin-top:10px"><b>By file names:</b></p> +<p><img class="floatright" style="padding-top:12px" src="html-resources/fontbyfilenamei.png" width="335" height="44" alt="font file defined"/> However, if you specify the <em>font file name</em>, then <em>only</em> that font file will be used, regardless of requests for bold or italic. Small caps will be honored, if the specific file has them:</p> +<p>Preamble:</p> +<p class="code" style="clear:both"><code>\NewFontFamily\rwayi{Raleway-Regular-Italic.otf}</code></p> +<p>Document Body:</p> +<p class="code"><code>{\rwayi I came, \textbf{I saw}, \emph{I conquered}, \textsc{I left}.}</code></p> + + +<p style="margin-top:10px"><b>File Name Combinations:</b></p> +<p><img class="floatright" style="padding-top:12px" src="html-resources/frankenfont.png" width="312" height="41" alt="frankenfont"/> What you write is what you get. You can customize a font family by individually selecting its members. Here is the syntax.</p> + +<p>Preamble:</p> +<p class="code" style="clear:both"><code>\NewFontFamily\frankenfont[% note the % at linebreaks<br/> + ItalicFont=BaskervilleF-Italic.otf,%<br/> + BoldFont=libertinusserif-semibold.otf,%<br/> + BoldItalicFont=texgyrepagella-bolditalic.otf,%<br/> +]{Raleway-Medium.otf}</code></p> + +<p>Document Body:</p> +<p class="code"><code>{\frankenfont I came, \textbf{I saw}, \emph{I conquered}, \textsc{I left}.}</code></p> + + +<p style="margin-top:10px"><b>Semibold, Light, etc.:</b> The above syntax is especially useful when you wish to specify semibold (if available), rather than bold. It is also a way to select something such as light versions:</p> + +<p class="code"><code>\NewFontFamily\rwlight[% note the % at linebreaks<br/> + ItalicFont=Raleway-Light-Italic.otf,%<br/> + BoldFont=Raleway-Medium.otf,%<br/> + BoldItalicFont=Raleway-Medium-Italic.otf,%<br/> +]{Raleway-Light.otf}</code></p> + +<p>Note that the font file in braces is the one used as the "regular" font, in this definition.</p> + + +<a id="a5.2.3"></a> +<h4>5.2.3 Open Type Features</h4> + +<p>Features are variations, contained within a single font file. In the bad old days, when you wanted true small caps, you had to load a separate font file that had them (and did not have ordinary lowercase letters). Now, if an Open Type font file has the "smcp" feature, you obtain the small caps from within the same file, by asking for them. Requests for the feature may be made on-the-fly, or pre-loaded for global use.</p> + +<p>Here are several of the most frequently-used features, relevant to fiction writing. There are many more, and most fonts have only a few of them. Even when a font has a feature, it may be limited to some portion of the characters. For example, it is common for small caps to be available only for Latin-1 letters, even though the font also contains Greek and Cyrillic. To put this another way: The availability of a feature does not tell you its breadth of coverage. Unless the font has documentation showing coverage of its features, the only way to find out is to create and print a test page.</p> + + +<table class="preconf"> +<caption> +Some Frequently-Used Open Type Features +</caption> +<thead> +<tr> +<th>Description</th> +<th>Open Type code </th> +<th>fontspec code</th> +</tr> +</thead> +<tbody> +<tr> +<td><p>kerning</p></td> +<td><p>kern</p></td> +<td><p>Kerning=On<br/><em>enabled by default</em></p></td> +</tr> +<tr> +<td><p>common ligatures</p></td> +<td><p>liga</p></td> +<td><p>Ligatures=Common<br/><em>enabled: mainfont, sansfont</em></p></td> +</tr> +<tr> +<td><p>Tex ligatures</p></td> +<td><p>tlig</p></td> +<td><p>Ligatures=TeX<br/><em>enabled by default</em></p></td> +</tr> +<tr> +<td><p>lowercase letters to small caps</p></td> +<td><p>smcp</p></td> +<td><p>Letters=SmallCaps</p></td> +</tr> +<tr> +<td><p>uppercase letters to small caps</p></td> +<td><p>c2sc</p></td> +<td><p>Letters=UppercaseSmallCaps</p></td> +</tr> +<tr> +<td><p>lining numerals</p></td> +<td><p>lnum</p></td> +<td><p>Numbers=Lining</p></td> +</tr> +<tr> +<td><p>oldstyle numerals</p></td> +<td><p>onum</p></td> +<td><p>Numbers=OldStyle<br/><em>enabled: mainfont, sansfont</em></p></td> +</tr> +</tbody> +</table> + +<p>• Kerning is the automatic adjustment of spacing between letters, so that they fit together nicely. Common ligatures are substitutions, such as a combined <code>ff</code> character for two consecutive <code>f</code> characters. It is up to the font designer to determine which ligatures, if any, are common.</p> + +<p>• TeX ligatures (such as replacing <code>``</code> with <code>“</code> and <code>---</code> with <code>—</code>) are not actually an Open Type feature, but they are treated that way by the software. All of these are enabled by default. The <code>fontspec</code> manual explains how to disable them, if necessary.</p> + +<p>• The SmallCaps feature applies only to lowercase letters; ordinary capitals remain ordinary capitals. UppercaseSmallCaps deals only with converting ordinary capitals to small caps. If you want both, use both. In most fonts that have them, small caps are slightly taller than lowercase, and slightly more widely spaced. What distinguishes real small caps from fake ones (obtained by scaling ordinary capitals) is that the weight and spacing are more compatible with surrounding text.</p> + +<p class="centerimg"><img src="html-resources/smallcapsrealfake.png" width="478" height="43" alt="real vs fake small caps"/></p> + +<p>• Lining numerals are the ones most familiar to you, from math or accounting. They sit on the baseline and have the height of capital letters. That's just right for doing calculations, and doesn't look bad for things such as page numbers and chapter numbers.</p> +<p>• When lining numerals are mingled with flowing text, they may stand out too much. OldStyle numerals are more like flowing text: Most of the numerals are at lowercase height, with ascenders and descenders. Compare the first number as OldStyle, the second as Lining:</p> + +<p class="centerimg"><img src="html-resources/jollybeers.png" width="499" height="52" alt="oldstyle vs lining numerals"/></p> + +<p>Most fonts use Lining numerals as their default. A few default to OldStyle numerals. Thus, you should explicitly call for the kind of numerals you wish to use.</p> + +<p>• True OldStyle numerals have a flat top on <em>one</em>, and a very round <em>zero</em>: <img src="html-resources/10trueold.png" width="37" height="13" alt="true oldstyle 10"/> This may be a bit distracting. Some fonts use a transitional form, where the one has a tilted top (like big 1) and the zero is not so round: <img src="html-resources/10transold.png" width="37" height="13" alt="transitional oldstyle 10"/> Others offer you a choice, via an Open Type "style set." See the <code>fontspec</code> manual for how to code style sets.</p> + +<p>• There are many more Open Type features, most of which are not useful in ordinary fiction writing. Fonts rarely have more than a few features. Some features (such as the ones shown above) have a specific meaning. Other features, such as "style sets", have whatever meaning the font designer assigns them; Thus the "ss03" feature of one font may do something very different from "ss03" in a different font.</p> + + +<a id="a5.2.4"></a> +<h4>5.2.4 Scale as Pseudo-Feature</h4> + +<p>Although it is not an Open Type feature, <code>Scale=<em>number</em></code> may be written like a feature. <code>Scale</code> globally adjusts the size of the font, relative to what it would otherwise be. If a local font size command is also applied, then the result is the compounded value.</p> +<p>If the font will be mingled with other fonts in the same place, Scale can tweak a font so that it does not stand out. If Scale does not exceed 1, then the baselineskip will not be affected. Over 1 risks spreading lines to accomodate the extra size; this should not be done for fonts that will appear in the flowing main text. But over 1 is acceptable for display fonts that do not wrap lines and do not mingle with main text.</p> +<p>Example: <em>Orbitron</em> is a special-purpose font with a mechanical or futuristic look. Its characters are much larger and heavier than would be found in book fonts. If I wish to mingle Orbitron with ordinary text, I might load the font like this:</p> + +<p class="code"><code>\NewFontFace\orbitron[Scale=0.6]{Orbitron} % Preamble</code></p> + +<p>Then in the document body, I could use it like this, where I have added <code>\textls</code> to spread the letters by a tiny bit:</p> + +<p class="code"><code>The message was brief: \textls{\orbitron DIE, EARTHLING.} Captain Withens smiled as he oiled his ray-gun. But ray-guns don't use oil.\par</code></p> + +<p class="centerimg"><img src="html-resources/charscaletext.png" width="522" height="63" alt="charscale text"/> + +<p>Scale is more often used for fonts that are pre-defined to have a special meaning and location, such as chapter titles or page headers. There, the font is not mingled with ordinary text, and it is OK to use a larger Scale. Then, it is not necessary to use local font scaling commands each time the font is used.</p> + + +<a id="a5.2.5"></a> +<h4>5.2.5 Color and Opacity</h4> + +<p>Even though the <code>fontspec</code> syntax allows you to set <code>Color</code> and <code>Opacity</code> as pseudo-features when you define a font, <em>the novel class blocks these features.</em> If you attempt to set them as features in a font definition, an error will result. The same applies if you attempt to add them, using <code>\addfontfeature</code>. However, you can still make use of grayscale using ordinary, local color commands.</p> +<p>When you use the <code>graytext</code> class option, you may write text in grayscale, using commands from the included <code>xcolor</code> package. You should only do this for text that is in special locations. For example, if you begin each chapter with a number that is very large, you might wish to make that number gray, so that it does not overpower the main text.</p> +<p>To avoid possible conflicts, the color specification should be chosen from a limited list of names. In order from dark to light: black, blue, violet, darkgray, purple, red, teal, olive, magenta, gray, brown, green, orange, cyan, lightgray, lime, pink, yellow, white. They will all be rendered in <em>shades of gray</em> (of course, black and white will be themselves). You may also choose from this more convenient list: black, gray1, gray2, gray3, gray4, gray5, gray6, gray7, gray8, gray9, white.</p> +<p>If <code>graytext</code> is not chosen as class option, then any color (even white) will be rendered as black.</p> + + +<a id="a5.2.6"></a> +<h4>5.2.6 \CreateFeature{<em>code</em>}{<em>substitutions</em>}</h4> + +<p>Once in a while, a font has a glyph that you would like to use, but it is not included in any of the font's Open Type feature sets. So, how to you grab that particular glyph? For example: One well-known font has a glyph named <em>emdash.alt</em>, which is not as long as the font's ordinary <em>emdash</em> glyph, and looks better in text. Unfortunately, <em>emdash.alt</em> is not in any of the font's style sets. Without some trickery, only a program such as InDesign can grab that glyph.</p> +<p>Thanks to the included <code>fontspec</code> 2016 update, <code>novel</code> has the necessary trickery. Command <code>\CreateFeature</code> creates a fake Open Type feature code, and assigns your list of substitutions to that code. Use comma-separated entries if there are multiple substitutions. For the case in question:</p> + +<p class="code"><code>\CreateFeature{myem}{emdash=emdash.alt}</code></p> + +<p>The code <code>myem</code> was randomly chosen as something that is not already defined among Open Type feature codes. Once specified, the fake feature may be used in any font definition, such as this:</p> + +<p class="code"><code>\SetMainFont[RawFeature=+myem]{Adobe Garamond Pro}</code></p> + +<p>Of course, the fake feature has no effect if the font does not have the subsitution. Note that this technique is only used for a list of subtitutions, not for ligatures or any context-dependent features.</p> + + + +<a id="a5.3"></a> +<h3>5.3 Setting and Defining Fonts</h3> + +<p>Some font commands are pre-defined by <code>fontspec</code>, for general purposes. These indicate the kind of font: main (meaning serif), sans, or mono. They may be used wherever you wish, for any purpose. Only the <em>mainfont</em> has a particular meaning, as the standard default font for your book text.</p> + +<p>Other pre-defined font commands are specific to <code>novel</code>. These fonts are used in specific places, or for specific purposes. They are called by other macros, and are not normally available for general purposes.</p> + +<p>Whether the font command is pre-defined by <code>fontspec</code> or by <code>novel</code>, it is "set". But you can also create your own font commands, which are "new". The syntax is explained below.</p> + +<p>When more than one feature is used, they must be separated by commas.</p> + + + +<a id="a5.3.1"></a> +<h4>5.3.1 Setting Pre-Defined, General-Purpose Font Commands</h4> + +<p>As a matter of coding style, I use capital camel case ForImportantSettings. Many commands, such as <code>\SetMainFont</code>, are merely an alias for the lowercase commands such as <code>\setmainfont</code>, and the commands may be used interchangeably.</p> + +<p>Several standard font selection commands are not specific to <code>novel</code>. You may never need them, but here they are:</p> + +<div class="fontcommand"> +<pre><b>mainfont</b></pre> +<p>Intended Usage: serif. Normal text.</p> +<p>Default features: OldStyle numbers, kerning, common ligatures, TeX ligatures.</p> +<p>Preamble: <code>\SetMainFont[<em>features</em>]{<em>font</em>}</code></p> +<p>Document: <code>\rmfamily{<em>text</em>}</code></p> +<p>Pre-Configured Font: Libertinus Serif, using Semibold instead of Bold.</p> +<p>Backup Font: If you do not have Libertinus Serif, then Linux Libertine O will be tried.</p> +</div> + +<div class="fontcommand"> +<pre><b>sansfont</b></pre> +<p>Intended Usage: sans-serif. Rarely used in fiction.</p> +<p>Default features: OldStyle numbers, kerning, common ligatures, TeX ligatures.</p> +<p>Preamble: <code>\SetSansFont[<em>features</em>]{<em>font</em>}</code></p> +<p>Document: <code>\sffamily{<em>text</em>}</code></p> +<p>Pre-Configured Font: Libertinus Sans</p> +<p>Backup Font: If you do not have Libertinus Sans, then Linux Biolinum O will be tried.</p> +</div> + +<div class="fontcommand"> +<pre><b>monofont</b></pre> +<p>Intended Usage: monospaced. Rarely used in fiction.</p> +<p>Default features: TeX ligatures.</p> +<p>Preamble: <code>\SetMonoFont[<em>features</em>]{<em>font</em>}</code></p> +<p>Document: <code>\ttfamily{<em>text</em>}</code></p> +<p>Pre-Configured Font: Libertinus Mono</p> +<p>Backup Font: If you do not have Libertinus Mono, then Linux Libertine Mono O will be tried.</p> +</div> + +<p>In all of the above cases, if neither the default nor backup font is found, and you do not set the font yourself, then Latin Modern (Open Type) fonts will be used, but only because you have them.</p> + +<p>• You should never need math mode in a novel. To prevent the software from loading Computer Modern fonts, package <code>unicode-math</code> is used. Note that in <code>novel</code>, the dollar sign <code>$</code> has its ordinary meaning as dollar, once the Preamble completes. It is <em>not</em> a means to enter or leave math mode.</p> + + + +<a id="a5.3.2"></a> +<h4>5.3.2 Setting Novel-Specific, Pre-Defined Font Commands</h4> + +<p>Class <code>novel</code> comes with a variety of pre-configured header/footer styles and chapter titles. These are described in detail on other documentation pages. You do not have to set these unless you wish to do so, because all of them (except <code>decofont</code> will default to variations on the main font.</p> +<p>Each of these font commands has an "intended" usage, shown in the following map. When you allow <code>novel</code> to style your document, it will automatically choose the right font for the right place. But if you create custom styles, you will have to specify the fonts.</p> + +<p class="centerimg"><img src="html-resources/fonts-in-use.png" width="660" height="530" alt="map of standard font locations"/></p> + +<div class="fontcommand"> +<pre><b>chapterfont</b></pre> +<p>Intended Usage: chapter titles.</p> +<p>Default features: kerning, TeX ligatures.</p> +<p>Preamble: <code>\SetChapterFont[<em>features</em>]{<em>font</em>}</code></p> +<p>Document: <code>{\chapterfont <em>text</em>}</code></p> +<p>Pre-Configured Font: Duplicate of mainfont, but at Scale=1.6.</p> +</div> + +<div class="fontcommand"> +<pre><b>subchfont</b></pre> +<p>Intended Usage: chapter subtitles</p> +<p>Default features: kerning, TeX ligatures.</p> +<p>Preamble: <code>\SetSubchFont[<em>features</em>]{<em>font</em>}</code></p> +<p>Document: <code>{\subchfont <em>text</em>}</code></p> +<p>Pre-Configured Font: Duplicate of mainfont, but at Scale=1.2.</p> +</div> + +<div class="fontcommand"> +<pre><b>headfont</b></pre> +<p>Intended Usage: page header and footer</p> +<p>Default features: kerning, TeX ligatures.</p> +<p>Preamble: <code>\SetHeadFont[<em>features</em>]{<em>font</em>}</code></p> +<p>Document: <code>{\headfont <em>text</em>}</code></p> +<p>Pre-Configured Font: Duplicate of mainfont, but at Scale=0.92.</p> +</div> + +<div class="fontcommand"> +<pre><b>decofont</b></pre> +<p>Intended Usage: special decorations and acronyms</p> +<p>Most usage of <em>decofont</em> is indirect, via <code>\decoglyph</code> and <code>\acronym</code> commands.</p> +<p>Default features: kerning, TeX ligatures.</p> +<p>Preamble: <code>\SetDecoFont[<em>features</em>]{<em>font</em>}</code></p> +<p>Document: <code>{\decofont <em>text</em>}</code></p> +<p>Pre-Configured Default: NovelDeco.otf <em>see explanation below</em></p> +</div> + +<p>• The defaults will automatically track a change to the mainfont. For example, if you choose Adobe Garamond Pro as the mainfont, then the chapterfont (and all the others except decofont) will be variations of Adobe Garamond Pro. You may still manually set them to other fonts or with other features.</p> + +<p>• In <code>novel</code>, certain styles use the fonts according to their descriptive command name. For example, <code>chapterfont</code> is intended for chapter titles. If you use one of the pre-defined chapter title commands, this font will be automatically selected, without the need for you to write <code>{\chapterfont <em>title</em>}</code>. If you choose to create your own chapter styles, you do not have to use <code>chapterfont</code>. But if you do, it will be easier to keep track of things. Similarly, you could use <code>chapterfont</code> outside of chapter titles, but that could lead to confusion if you lose track of your own coding.</p> + +<p>• The same applies to the other pre-defined fonts. Each has a place where it is used by default in pre-defined styles. If you write your own style code, then you should choose the appropriate font (but it is not required). And, the font can be used elsewhere in the document, for other purposes.</p> + +<p>• Most applications of <code>decofont</code> are indirect. Instead of requesting arbitrary text in this font, you use commands such as <code>\decoglyph</code> or <code>\acronym</code> for specific purposes. The <code>decofont</code> is NovelDeco.otf. Its font license allows modification (if you know how), but then you must change its internal font name and file name. In that case, you can use <code>\SetDecoFont</code> to point to your own derivative of NovelDeco. Do not use this command to choose an entirely different font, or macros that depend on it will fail, perhaps without warning. If you need an entirely different font for your own purposes, create a new font using the command shown below.</p> + + +<a id="a5.3.3"></a> +<h4>5.3.3 Creating New Font Commands</h4> + +<p>If you wish to create a new font command, so that you can apply it to text, the syntax differs from the "Set" commands shown above.</p> +<p>Suppose that you wish to create a font command <code>\drabble</code> which will be used like this:</p> +<p class="code"><code>{\drabble This text is in the font selected by the drabble command}</code></p> +<p>Here is how you you define it:</p> +<p class="code"><code>\NewFontFamily\drabble[<em>features</em>]{<em>font family name</em>}</code></p> +<p>The syntax begins with <code>\NewFontFamily</code>, followed by the macro name you wish to create, followed by the optional Open Type features, and finally the font family name.</p> +<p>If the font is in a family by itself, without accompanying italic or bold variants, use this:</p> +<p class="code"><code>\NewFontFace\drabble[<em>features</em>]{<em>font name</em>}</code></p> +<p>Note that the new font command works "inside the braces":</p> +<p class="code"><code>{\drabble text}</code>.</p> +<p>If it is part of a family, then the usual commands for selecting italic and bold will choose the appropriate fonts.</p> +<p>• When you define new fonts, kerning and TeX ligatures are enabled by default. Any other features (such as common ligatures) must be explicitly specified by you.</p> + + + +<a id="a5.3.4"></a> +<h4>5.3.4 Which Open Type Features Are In a Font?</h4> + +<p>You have a font. It has Open Type features. But which features does it have? There are several ways to find out, but the simplest and most reliable way is to request a feature, and see what happens. For example:</p> + +<p class="code"><code> +% !TeX program = LuaLaTeX<br/> +% !TeX encoding = UTF-8<br/> +\documentclass{novel}<br/> +\setlength\parindent{0pt}<br/> +%<br/> +\NewFontFace\testlibserit[VerticalPosition=Superior]{libertinusserif-italic.otf}<br/> +\NewFontFace\testcin[VerticalPosition=Superior]{Cinzel-Regular.otf}<br/> +%<br/> +\begin{document}<br/> +Libertinus Serif, Italic:\\{\testlibserit 0123456789 abcdefghijklmnopqrstuvwxyz \#‡}\par<br/> +\null<br/> +Cinzel, Regular:\\{\testcin 0123456789 abcdefghijklmnopqrstuvwxyz \#‡}\par<br/> +\end{document}\par</code></p> + + +<p>The resulting PDF shows that Libertinus Serif, Italic has numbers and lowercase letters as superiors. Cinzel, Regular does not have this feature (if it doesn't have it for these characters, it is not likely to have it for any others).</p> + +<p>• Sometimes a font has features that you would like to use, but you do not know they are there. For example, the font linlibertine-regular.otf normally has capital W like most fonts, with three peaks. In its feature <code>ss05</code>, it has an alternative W with four peaks, like Garamond fonts. You can find that information in several ways: (1) Does the font come with documentation? Many do. (2) Is it described on a web site that offers the font? (3) Get a font editor, such as the free FontForge, and open the font. Look at the Element > Font Info > Lookups menu. Then you can discover which features it has, and which characters are contained in each feature. You can also look at the glyph drawings.</p> + +<p>• Just remember that there is no specific meaning to a style set, such as <code>ss05</code>. It does whatever the font designer wants it to do, which varies from font to font.</p> + + +<a id="a5.3.5"></a> +<h4>5.3.5 Local Modifications to Open Type Features</h4> + +<p>If you specify a particular Open Type feature, it will always be generally for that font command. So if you define a new font command with <code>Letters=SmallCaps</code> as a feature (and if the font actually has them), then small caps will be used for that font, whether or not you locally request them with a command such as <code>\textsc</code>.</p> + +<p>Often, you can add (or sometimes remove) features on a local basis. For example, suppose that you defined the font without using is <code>ss03</code> style set. You can locally add that feature to some text, using a command that looks like this:</p> + +<p class="code"><code>{\addfontfeature{<em>which feature</em>} <em>applied to this text</em>}</code></p> + +<p>The above code assumes that you are already using the font in that location. You cannot apply <code>ss03</code> from one font to an entirely different font!</p> + +<p>See the <code>fontspec</code> documentation for details of <code>\addfontfeature</code>.</p> + +<p>As an alternative the changing features locally, you can define different font commands to call the same underlying font, but with different features. For example, that is how <code>novel</code> defines the default <code>\chapterfont</code> and <code>\headfont</code>. Unless you manually change them, these fonts are the same as the main font. However, these fonts use Lining numbers instead of OldStyle, do not enable common ligatures, and are at different scales.</p> + +<p>Two ways to accomplish the same thing:</p> + +<p class="code"><code> +\NewFontFamily\baskf{BaskervilleF}<br/> +\NewFontFamily\baskftab[Numbers=Monospaced]{BaskervilleF} % tnum feature<br/> +\begin{document}<br/> +Some text {\baskftab hello 123} is here.<br/> +Some text {\baskf\addfontfeature{Numbers=Monospaced} hello 123} is here. +</code></p> + + +<a id="a5.4"></a> +<h3>5.4 Microtype Setup</h3> + +<p>The included <code>microtype</code> package comes with standard settings that are, in my opinion, too extreme for fiction. Although there are font to font differences, most modern book fonts have similar properties, as far as <code>microtype</code> is concerned. For this reason, a custom configuration file <code>novel-microtype.cfg</code> is included, and automatically used by <code>novel</code>.</p> + +<p>Not all <code>microtype</code> features are available, but the most important ones (protrusion, expansion, tracking) are. The default expansion setting is 20, which corresponds to the ability to tweak for about one character per line of book text. It is large enough to be useful, small enough to be inconspicuous. You may change it using standard <code>\microtypesetup</code> commands, if you wish.</p> + +<p>If you do not explicitly request a configuration file, perhaps by only changing stretch and shrink, then <code>novel-microtype.cfg</code> will still be used.</p> + + + +</div><!-- end main --> + +<div id="finish"></div> + +</div><!-- end master --> + +</body> +</html> + |