From 6b9c748b268e3e8cc785287f5d31bc7e15db2e76 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 25 Apr 2016 21:50:26 +0000
Subject: csplain (25apr16)

git-svn-id: svn://tug.org/texlive/trunk@40747 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/csplain/fonts/cs-heros.tex | 298 ++++++++++++++++++-----
 1 file changed, 243 insertions(+), 55 deletions(-)

(limited to 'Master/texmf-dist/tex/csplain/fonts/cs-heros.tex')

diff --git a/Master/texmf-dist/tex/csplain/fonts/cs-heros.tex b/Master/texmf-dist/tex/csplain/fonts/cs-heros.tex
index 92d9b08a7eb..c2f9b698dc6 100644
--- a/Master/texmf-dist/tex/csplain/fonts/cs-heros.tex
+++ b/Master/texmf-dist/tex/csplain/fonts/cs-heros.tex
@@ -1,66 +1,254 @@
-% The file cs-heros.tex (C) Petr Olsak, 2012
-% Use "\input cs-heros" to set the Termes fonts family in text mode
-
-\message{FONT: Heros -
-   \string\rm, \string\it, \string\bf, \string\bi, 
-   \string\caps\string\rm..., \string\narrow}
-
-\ifx\sizespec\undefined \def\sizespec{}\fi
-\ifx\font\corkencoded \def\tmp{ec}\else \def\tmp{cs}\fi
-
-\ifx\font\unicoded  
-   \def\famname{texgyreheroscn} \input unifam
-   \let\tenrmn=\tenrm \let\tenbfn=\tenbf \let\tenitn=\tenit \let\tenbin=\tenbi
-   \let\tenrmnc=\tenrmc \let\tenbfnc=\tenbfc \let\tenitnc=\tenitc \let\tenbinc=\tenbic
-   \def\famname{texgyreheros} \input unifam
-\else
-
-\font\tenrm=\tmp-qhvr  \sizespec
-\font\tenbf=\tmp-qhvb  \sizespec
-\font\tenit=\tmp-qhvri \sizespec
-\font\tenbi=\tmp-qhvbi \sizespec
-
-\font\tenrmc=\tmp-qhvr-sc  \sizespec
-\font\tenbfc=\tmp-qhvb-sc  \sizespec
-\font\tenitc=\tmp-qhvri-sc \sizespec
-\font\tenbic=\tmp-qhvbi-sc \sizespec
-
-\font\tenrmn=\tmp-qhvcr  \sizespec
-\font\tenbfn=\tmp-qhvcb  \sizespec
-\font\tenitn=\tmp-qhvcri \sizespec
-\font\tenbin=\tmp-qhvcbi \sizespec
-
-\font\tenrmnc=\tmp-qhvcr-sc  \sizespec
-\font\tenbfnc=\tmp-qhvcb-sc  \sizespec
-\font\tenitnc=\tmp-qhvcri-sc \sizespec
-\font\tenbinc=\tmp-qhvcbi-sc \sizespec
+% The file cs-heros.tex (C) Petr Olsak, 2012, 2016
+% Use "\input cs-heros" to set the TG Heros font family in text mode
+
+% See end of this file for more information
+
+\ifx\ffdecl\undefined \input ff-mac \fi
+
+\ffdecl [TG Heros] {\rm \bf \it \bi} {\caps \cond} {} {TX} {8z 8t U}
+
+\ffvars {r}{b}{ri}{bi} 
+\def\caps{\ffsetV{caps}{-sc}\ffsetX}  \def\nocaps{\ffsetV{caps}{}\ffsetX}
+\def\cond{\ffsetV{cond}{c}\ffsetX}    \def\nocond{\ffsetV{cond}{}\ffsetX}
+\def\capsV{} 
+\def\condV{} 
+
+\ismacro\fotenc{8t}\ifttrue
+
+   \font\tenrm = ec-qhvr  \sizespec
+   \font\tenbf = ec-qhvb  \sizespec
+   \font\tenit = ec-qhvri \sizespec
+   \font\tenbi = ec-qhvbi \sizespec
+
+   \def\ffnamegen{ec-qhv\condV\ffvarV\capsV}
 
 \fi
 
-\tenrm
+\ismacro\fotenc{8z}\iftrue
+
+   \font\tenrm = cs-qhvr  \sizespec
+   \font\tenbf = cs-qhvb  \sizespec
+   \font\tenit = cs-qhvri \sizespec
+   \font\tenbi = cs-qhvbi \sizespec
+
+   \def\ffnamegen{cs-qhv\condV\ffvarV\capsV}
+   \input chars-8z
 
-\ifx\regfontdefault\undefined \else
-   \regfontdefault
-   \regfont\tenrmc \regfont\tenitc
-   \regfont\tenbfc \regfont\tenbic
-   \regfont\tenrmn \regfont\tenitn
-   \regfont\tenbfn \regfont\tenbin
-   \regfont\tenrmnc \regfont\tenitnc
-   \regfont\tenbfnc \regfont\tenbinc   
 \fi
 
-\def\caps#1{{\escapechar=-1 \expandafter}%
-  \expandafter\csname\expandafter\tenonlytext\string#1c\endcsname}
-\def\tenonlytext{ten}
+\ismacro\fotenc{U}\iftrue
+
+   \font\tenrm = "[texgyreheros-regular]:\fontfeatures"    \sizespec
+   \font\tenbf = "[texgyreheros-bold]:\fontfeatures"       \sizespec
+   \font\tenit = "[texgyreheros-italic]:\fontfeatures"     \sizespec
+   \font\tenbi = "[texgyreheros-bolditalic]:\fontfeatures" \sizespec
 
-\def\narrow{% Switches to Narrow variants
-  \let\tenrm=\tenrmn \let\tenbf=\tenbfn
-  \let\tenit=\tenitn \let\tenbi=\tenbin 
-  \let\tenrmc=\tenrmnc \let\tenbfc=\tenbfnc
-  \let\tenitc=\tenitnc \let\tenbic=\tenbinc \tenrm}
+   \def\ffnamegen{"[texgyreheros\condV-\ffvarV]:\capsV\fontfeatures"} 
 
-\ifx\font\corkencoded\else \ifx\font\unicoded\else \input chars-8z \fi\fi
+   \ffvars {regular} {bold} {italic} {bolditalic}
+   \def\caps{\ffsetV{caps}{+smcp;}\ffsetX}
+   \def\cond{\ffsetV{cond}{cn}\ffsetX}
+
+\fi
+\tenrm % don't remember to initialize the family with normal font.
+
+\def\narrow{\cond\fam}
+
+\ifx\loadmathfonts\relax \endinput \fi
 \ifx\mathpreloaded X\else \input tx-math \fi                     
 
-% end of cs-heros.tex
+\endinput
+
+--------------------------------------------------------------
+
+For users
+=========
+
+There are four basic font selectors: \rm, \bf, \it, \bi. They are ready
+to print text in Heros (like Helvetica) variants after \input cs-heros.
+
+You can use "modifiers" of these basic variants: \cond, \caps. They can be
+independently combined but must be immediately followed by \rm, \bf, \it,
+\bi or \fam. Examples:
+
+\cond\rm       ... Normal condensed.
+\caps\cond\it  ... Caps & small-caps plus condensed italics.
+\caps\fam      ... Caps & small-caps, now all basic selectors.
+                   \rm, \bf, \it, \bi keeps this modification.
+
+All font selectors and their modifiers do setting locally inside TeX group.
+
+Note, that \modifier\fam keeps the currently selected basic variant. This
+variant is modified by \modifier\fam and all consecutive basic variant
+selectors are modified too. So, you can select all font features
+independently to others.
+
+{\it Italics \caps\fam caps italics, \bf caps bold \it caps italic.}
+
+but \modifier\rm (or \modifier\bf etc.) sets only one individual font.
+
+{\it Italic \caps\rm caps \bf normal bold}
+
+The TX math fonts are loaded together with this text family. If you need not
+load special fonts then you can set \let\loadmathfonts=\relax before \input
+cs-heros. Of course, you can input any different math font collection, for
+example \input ntx-math.
+
+You can combine fonts from more families. Load the main family last. You can
+use \ffletfont\newselector = {mod+var}{size} for keeping variants from
+previous loading. Example:
+
+\input cs-heros 
+\ffletfont \titlefont = {\cond\bf}{at14pt} % Heros condensed for titles
+\input cs-termes % Termes at 10 pt for normal text
+
+If you are using XeTeX or LuaTeX then the U (unicode) encoding is used and
+OTF fonts are loaded. You can use \useff{text} in such case. This works like
+another modifier and does modification of font-features. Use 
+otfinfo -f file.otf to inspect the font features of used font. Example:
+
+\useff{+onum;+salt}\bf  ... use Bold variant with oldstyle digits and
+                            stylistic alternatives
+\useff{+onum;+salt}\fam ... use given features for whole family.
+
+
+For font-file developers
+========================
+
+Use \ifx\ffdecl\undefined \input ff-mac \fi first. The ff-mac.tex macro file
+provides:
+
+\sizespec .. is empty or it keeps the special size specification of the font.
+\ffdecl .... prints font message and checks the font encoding.
+\ffvars .... declares four basic variants (values for \ffvarV)
+\setfmV, \setfm ... macros used in font modifiers
+\ismacro ... test if the macro is defined as given. 
+\fotenc .... encoding of text fonts.
+\fontfeatures ... default (or user defined) fontfeatures if Unicode 
+             fonts are used.
+\ffalias ... register alias of a font name.
+\regsizes .. register optical sizes.  
+
+You must declare four basic variants \tenrm, \tembf, \tenit and \tenbi
+using \font primitive. These four basic variants work immediately after
+font-file is read because \rm, \bf, \it and \bi expands to \tenrm, \tenbf,
+\tenit and \tenbi. 
+
+You can declare more cases for various font encondings. User can define font
+encoding by \def\fontenc{something}. Note, that ff-mac.tex keeps the \fotenc
+macro unchanged, but if it is not defined then it does:
+
+- \def\fotenc{8z} if CSplain is used without \input t1code nor \input ucode
+- \def\fotenc{8t} if \input t1code or pdfTeX without CSplain is used
+- \def\fotenc{U}  if \input ucode or XeTeX or LuaTeX is used
+
+8z means IL2 encoding (default in CSplain), 8t means T1 encoding and U means
+Unicode.
+
+If the family does not provide all four basic variants then keep missing
+variants undeclared and use parameter {!} in appropriate \ffvars parameter.
+
+Last two lines in the code above loads the default math fonts. The "X"
+letter (as \mathpreloaded) is reserved for TX fonts collection. The "A"
+letter is reserved for AMS math fonts.
+
+
+\ffdecl [Family Name] {basic selectors} {modifiers} {comment} {math} {enc}
+-------------------------------------------------------------------------
+
+This macro stops reading the file (with warning) if the \fotenc is not
+included in the provided encodings given in the last parameter. Else it
+prints the message about font family, its selectors, modifiers and appends
+the comment.
+
+
+\ffvars {normal} {bold} {italic} {bolditalic}
+---------------------------------------------
+
+This macro gives the values to the \ffvarV macro dependent on what basic
+variant is needed. The \ffvarV macro is used in \ffnamegen. See below.
+
+If you need to implement font modifier (say \modfoo), then define
+
+\def\modfoo{\ffsetV{foo}{text}\ffsetX}  \def\nomodfoo{\ffsetV{foo}{}\ffsetX}
+
+The \modfoo activate modifier and \nomodfoo deactivate it. The macro
+\ffsetV{foo}{text} define \fooV as text. So, you can use \fooV in \ffnamegen.
+
+Next, define default value for \fooV by \def\fooV{}.
+
+Finally, define the generic font name using \ffvarV and \fooV in it.
+These names are expanded to basic variant name given by \ffvars and the
+actual value of \fooV given by \ffsetV. For example, if the metric names of
+the font family are
+
+   baaRMwhat.tfm    ... normal 
+   baaBFwhat.tfm    ... bold
+   baaRMwhatFF.tfm  ... normal modified by FF
+   baaBFwhatFF.tfm  ... bold modified by FF
+
+then declare \ffvars {RM} {BF} {!} {!} and define
+
+  \def\modfoo{\ffsetV{foo}{FF}\ffsetX} \def\nomodfoo{\ffsetV{foo}{}\ffsetX} 
+
+and finaly define \ffnamegen as:
+
+  \def\ffnamegen{baa\ffvarV what\fooV}
+
+The font modifiers are based on the fact that font names of fonts includes
+these modifiers flags at given place in the name and they are independent
+one to another.
+
+All (modified) variants can be used in all various sizes by standard
+resizing tools given in CSplain or OPmac.
+
+
+\ffalias {virtual-name} {real-name}
+-----------------------------------
+
+The \ffalias macro provides substitution of virtual-name by real-name.
+The virtual-name is a result of the expansion of \ffnamegen and real-name is
+definitely used.
+
+Example. Suppose that baaBFwhatFF.tfm is not present and when the \modfoo\bf
+is used then error during loading baaBFwhatFF.tfm occurs. To avoid this, you
+can declare:
+
+\ffalias {baaBFwhatFF} {baaRMwhatFF}
+
+Now, the baaRMwhatFF.tfm is used instead baaBFwhatFF.tfm.
+
+
+\regsizes {modifiers} {data} 
+----------------------------
+
+You can use \ffoptV in the \ffnamegen. It includes the optical size value of
+the font. For example, Antykwa Poltawkiego includes:
+
+ec-antpr6.tfm ec-antpr8.tfm ec-antpr10.tfm ec-antpr12.tfm ex-antpr17.tfm
+
+and analogical names are used for all basic variants {r}{b}{ri}{bi} and for
+\caps variants. You can see to the cs-polta.tex file that the \ffnamegen is
+defined by \def\ffnamegen{ec-antp\ffvarV\ffoptV\capsV}.
+
+If the \ffoptV is used in \ffnamegen then you must register optical 
+sizes for all variants and modified variants into internal data structure. 
+The \regsizes macro does this. Code from cs-polta.tex looks like this:
+
+\regsizes {}          {0 =6 7 =8 9 =10 11 =12 14 =17}
+\regsizes {\wli}      {0 =6 7 =8 9 =10 11 =12 14 =17}
+\regsizes {\caps}     {0 =6 7 =8 9 =10 11 =12 14 =17}
+\regsizes {\wli\caps} {0 =6 7 =8 9 =10 11 =12 14 =17}
+
+There are two independent modifiers \wli and \caps, so there are four
+possible modifications. These modifications are included in the first
+parameter. The second "data" parameter includes couples
+"bondary =optsize boundary =optsize" etc. If the desired size is 11.5pt (for
+example) then it fits to the bounaries [11pt, 14pt), thus the value 12 is
+used in the \ffoptV macro.
+
+The \regsizes is implemented by \regtfm macro, see the ams-math.tex file.
+
+You cannot combine \ffalias together with \regsizes. 
 
+----------------------------------------
-- 
cgit v1.2.3

