From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/generic/ofs/doc/ofsdoc-e.pdf | Bin 0 -> 252623 bytes macros/generic/ofs/doc/ofsdoc-e.tex | 2394 ++++++++++++++++++++ macros/generic/ofs/doc/ofsdoc.pdf | Bin 0 -> 264614 bytes macros/generic/ofs/doc/ofsdoc.tex | 2402 +++++++++++++++++++++ macros/generic/ofs/doc/papers/eurotex2003-ofs.pdf | Bin 0 -> 130321 bytes macros/generic/ofs/doc/papers/eurotex2003-ofs.tex | 1089 ++++++++++ macros/generic/ofs/doc/papers/ofs-slt.pdf | Bin 0 -> 136978 bytes macros/generic/ofs/doc/papers/ofs-slt.tex | 1004 +++++++++ 8 files changed, 6889 insertions(+) create mode 100644 macros/generic/ofs/doc/ofsdoc-e.pdf create mode 100644 macros/generic/ofs/doc/ofsdoc-e.tex create mode 100644 macros/generic/ofs/doc/ofsdoc.pdf create mode 100644 macros/generic/ofs/doc/ofsdoc.tex create mode 100644 macros/generic/ofs/doc/papers/eurotex2003-ofs.pdf create mode 100644 macros/generic/ofs/doc/papers/eurotex2003-ofs.tex create mode 100644 macros/generic/ofs/doc/papers/ofs-slt.pdf create mode 100644 macros/generic/ofs/doc/papers/ofs-slt.tex (limited to 'macros/generic/ofs/doc') diff --git a/macros/generic/ofs/doc/ofsdoc-e.pdf b/macros/generic/ofs/doc/ofsdoc-e.pdf new file mode 100644 index 0000000000..32cf716e5f Binary files /dev/null and b/macros/generic/ofs/doc/ofsdoc-e.pdf differ diff --git a/macros/generic/ofs/doc/ofsdoc-e.tex b/macros/generic/ofs/doc/ofsdoc-e.tex new file mode 100644 index 0000000000..1c7669c441 --- /dev/null +++ b/macros/generic/ofs/doc/ofsdoc-e.tex @@ -0,0 +1,2394 @@ +% A documentation for OFS package (pseudo English, sorry) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% July 2001 Petr Olsak + +\magnification\magstephalf % use plain or csplain + +\headline={\llap{\tt May 2004}\hfil See the ofsdoc.tex for Czech version + of this documentation.\global\headline={\hfil}} + +\hoffset=4pc +\voffset=1pc +\hsize=31.6pc +\vsize=49pc +\raggedbottom +\parindent=15pt +\emergencystretch=2em + +\font\smallbf=csb10 at7pt +\font\smalltt=cstt8 +\font\smallit=csti8 +\font\smallrm=csr8 +\font\titulfont=\fontname\tenbf\space scaled\magstep4 +\font\bigbf=\fontname\tenbf\space scaled\magstep1 + +\def\Red{} +\def\Black{} +\def\Blue{} +\def\Green{} +\def\beglink#1{} +\def\endlink{} +\def\aimlink#1{} + +\def\uv#1{``#1''} + +\ifx\pdfoutput\undefined\else %%%% pdfTeX is used %%%%%%%%%% +\ifnum\pdfoutput>0 + +\ifx \pdfstartlink\undefined %%% PDFTeX version <= 13 + \let\pdfstartlink=\pdfannotlink +\fi + +\def\beglink#1{% % Začátek textu odkazu, #1 je klíč odkazu + \Green \pdfstartlink height9pt depth3pt + attr{/Border[0 0 0]} goto name{#1}\relax} +\def\endlink{\pdfendlink\Black} + +\def\aimlink#1{% % Místo cíle odkazu, #1 je klíč odkazu + \expandafter\ifx \csname aim:#1\endcsname \relax + \expandafter\gdef \csname aim:#1\endcsname {}% + \vbox to0pt{\vss\hbox{\pdfdest name{#1} fith}\kern15pt}% + \fi +} +\def\pdfsetcmykcolor#1{\special{PDF:#1 k}} +\def\Red{\leavevmode\pdfsetcmykcolor{0.1 0.9 0.9 0}} +\def\Black{\leavevmode\pdfsetcmykcolor{0 0 0 1}} +\def\Green{\leavevmode\pdfsetcmykcolor{0.9 0.1 0.9 .3}} +\def\Blue{\leavevmode\pdfsetcmykcolor{0.9 0.9 0.1 0}} + +\pdfcompresslevel=9 +\pdfinfo{/Author (Petr Olsak) + /CreationDate (July 2001) + /ModDate (May 2004) + /Creator (TeX) + /Producer (pdfTeX) + /Title (OFS: Olsak's Font System) + /Subject (Documentation) + /Keywords (TeX, fonts) +} + +\fi\fi %%%%%%%%%%%%%%%%%%%%%%%%%%%% End of pdfTeX macros %%%%% + + +\def\PLAIN #1:{{\smallbf \Red PLAINTEX\Black\if|#1|\else\space#1\fi}:} +\def\LATEX #1:{{\smallbf \Red LATEX\Black \if|#1|\else\space#1\fi}:} +\def\OBA #1:{{\smallbf \Red PLAINTEX+LATEX\Black \if|#1|\else\space#1\fi}:} + +\newcount\secnum \newcount\subsecnum + +\def\sec #1\par{\ifnum\secnum>0 \goodbreak\fi\removelastskip + \vskip2\baselineskip + \subsecnum=0 \advance\secnum by1 + \noindent{\bigbf\llap{\the\secnum.\quad}#1}\par\nobreak\medskip} +\def\subsec #1\par{\removelastskip\bigskip + \advance\subsecnum by1 + \noindent{\bf \llap{\aimlink{\the\secnum.\the\subsecnum}% + \the\secnum.\the\subsecnum.\quad}#1}\par\nobreak\medskip} +\def\title #1\par{\vglue2\baselineskip + \centerline{\titulfont #1}\vskip2\baselineskip} + +\def\LaTeX{La\TeX} + +\catcode`<=13 +\def<#1>{\hbox{$\langle$\it#1\/$\rangle$}} +\def\,{\thinspace} + +{\obeyspaces \gdef\activespace{\obeyspaces\let =\ }} +\def\setverb{\def\do##1{\catcode`##1=12}\dospecials} +\def\begtt{\medskip\bgroup \setverb \catcode`@=0 \activespace + \parindent=0pt \catcode`\"=12 + \def\par##1{\endgraf\ifx##1\par\leavevmode\fi ##1} + \obeylines \startverb} +{\catcode`\|=0 \catcode`\\=12 +|gdef|startverb#1\endtt{|tt#1|egroup|medskip|testpar}} +\long\def\testpar#1{\ifx\par#1\else\noindent\fi#1} + +\catcode`"=13 +\def"{\hbox\bgroup\setverb\activespace\tt\readverb} +\def\readverb #1"{#1\egroup} + +\def\begitems{\medskip\bgroup \catcode`*=13 } +{\catcode`*=13 \gdef*{\item{$\bullet$}}} +\def\enditems{\medskip\egroup} + +\newwrite\indout +\immediate\openout\indout=\jobname.ind +\def\inl[#1]{\strut + \write\indout{\noexpand\indexentry{#1}{\the\pageno}}% + \vadjust{\vbox to0pt{\vss + \hbox to\hsize{\llap{{\aimlink{#1}\smalltt\Blue\char`\\ #1% + \ifx\extratext\empty\else\space\extratext\fi\Black}% + \kern2pt\quad}\strut\hfil}% + \hrule height0pt}}\def\extratext{}} +\def\inll[#1 #2]{\def\extratext{#2}\inl[#1]} +\def\indexentry #1#2{\expandafter \ifx \csname ind:#1\endcsname \relax + \expandafter \def \csname ind:#1\endcsname {#2}% + \else + \expandafter \edef \csname ind:#1\endcsname {% + \csname ind:#1\endcsname, #2}% + \fi +} +\def\pg[#1]{\csname ind:#1\endcsname} + +\chardef\back=`\\ + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\title OFS: The Ol\v s\'ak's Font System +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +The OFS is a \TeX{} macro for managing large sets of fonts. You can +select the appropriate fonts comfortably by the names from font +catalog used by a font foundry. It means you don't have to remember short +names of tfm files and/or short names of NFSS font families. The user +interface of this macro is the same in \LaTeX{} and in plain but there +are two independent implementations of this macro: first and more +elaborate: based only on plain macros; second: based on NFSS macros +for \LaTeX{} users. + +If a text in this documentation is applicable only for the plain\TeX{} +version of the OFS then the text is introduced by the word \PLAIN:. +If a text is applicable only for OFS version based on NFSS then it is +introduced by the word \LATEX:. + +After the OFS macro is loaded, the following message is printed: + +\begtt +@PLAIN: OFS (Olsak's Font System) based on plain initialized. @char` +@LATEX: OFS (Olsak's Font System) based on NFSS initialized. @char` +\endtt +Main features of the OFS: + +\begitems +* The user interface is the same for plain and for \LaTeX. +* You can use the "\fontusage" command which displays a short description + of OFS macros in terminal and in the log file. +* You can use the real font names from font catalog. +* You can use the font divided into two \TeX{} metrics (basic and + extended tfm) and they seem from the user's point of view to be only one + font. This is useful for fonts with more than 256 characters if you + don't want to use Omega. +* You can choose the \TeX{} internal encoding of fonts for your + language in the beginning of your document. This feature is commonly used + for Czech and Slovak languages: there are \TeX{} fonts which encode + the alphabets of these languages by Cork (T1 encoding) or by + ISO-8859-2 (IL2 encoding). T1 font encoding is common in LaTeX + world, whereas IL2 encoding is widely used in the Czech and Slovak + \TeX{} community. +* The OFS defines the language of declaration files. These files + define mapping of full names of fonts to \PLAIN: tfm + names or \LATEX: NFSS short names of the font families. +* \PLAIN: You can use individual variants of fonts in an indepent manner + in similar way as in NFSS (family, size, encoding, variant). +* \PLAIN: You can declare different fonts for different sizes + in the declaration files (usable for Computer Modern family first + of all). +* \PLAIN: The OFS includes support of the math fonts manipulation + when the PostScript fonts and/or fonts at different sizes are + used. +* Interactive macro "ofstex.tex" enables printing the paragraph samples + in the chosen font families, printing the font table, font registers, + samples of the mathematic and the lists of characters, including + their \TeX\ sequences. All to do is to write "tex ofstest [allfonts]" + or "csplain ofstest [allfonts]" on the command line and to follow + the orders on the terminal. +\enditems + +\sec The font families +%%%%%%%%%%%%%%%%%%%%%% + +The most current font families have the four commonly used variants: +normal: ("\rm"), bold ("\bf"), italic ("\it") +and bold italic ("\bi")\inll[rm \back bf \back it \back bi]. +These variants are called \uv{standard variants} in OFS. +After the font family is activated by "\setfonts" command (see +bellow), you can use the commands "\rm", "\bf", "\it" a "\bi" +as a variant switches for the current font family. The first three +commands are well known in plain and the fourth command switches into +BoldItalic variant and it is introduced in the OFS. + +Additional \uv{nonstandard variants} can be declared in some font families +and vice versa some \uv{standard variants} can be missing in +other font families. Only the "\rm" variant has to be present in all +families. + +The original names of fonts can be a little different from the names mentioned +above in some font families but the font switches names "\rm", "\bf", +"\it", "\bi" can be unchanged. For example the family Helvetica has +the variant \uv{Oblique}, but we are still using the "\it" switch +for this variant. + +If you want to use the font switches from another font families +at the same time, these switches can be declared by the "\fontdef" +command (see bellow). + +The font families are declared in the declaration files. These files +have the similar meaning in the plain\TeX{} as {\tt fd} files in NFSS. The +recommended suffix for the files are \PLAIN:~{\tt tex} (they map the +family names to \TeX{} metrics) or \LATEX: {\tt sty} (they map the +family names to the NFSS short family names). These files can include +more than one font family declaration. The names of these files are +chosen in order to you can recognize which families are declared +here. Examples: + +\begtt +@PLAIN: @LATEX: +sjannon.tex, sjannon.sty ... the big Jannon family by stormtype.com +a35.tex, a35.sty ... the basic 35 fonts by Adobe +\endtt + +The user chooses from these files only such files needed by his/her +document and writes the names of these files into the header of +the document. For more simplicity, \uv{global} files +include the \PLAIN: "\input" or \LATEX: the "\RequirePackage" +command for the single declaration files. Examples: + +\begtt +skatalog.tex, skatalog.sty ... all fonts by stormtype.com +allfonts.tex, allfonts.sty ... all fonts at your TeX installation +\endtt + +\sec The user interface +%%%%%%%%%%%%%%%%%%%%%%% + +\subsec The header +%%%%%%%%%%%%%%%%%% + +For example, let us suppose that we will use fonts from Jannon and +DynaGrotesk family by Storm Type Foundry. Their +declaration files are included in the "storm" directory. You can get +the \TeX{} metrics plus the OFS macro package from +"www.cstug.cz/stormtype". You can buy the real fonts from Storm Type +Foundry. See "www.stormtype.com" for more details. +We need to use +\PLAIN: "sjannon.tex", "sdynamo.tex"; +or \LATEX: "sjannon.sty", "sdynamo.sty". +declaration files. The first letter "s" +in their file name means that the fonts are made +by Storm Type Foundry. We can use the following line in the header of +our document: + +\begtt +@PLAIN: \input ofs [sjannon, sdynamo] % space before "[" is necessary +@LATEX: \usepackage [sjannon,sdynamo]{ofs} +\endtt + +Now we can use the families declared in "sjannon" and "sdynamo" +declaration files. +The "\showfonts"\inl[showfonts] command writes a list of available +families on terminal and to a log file. In the above case, the +"\showfonts" lists the following text: + +\begtt +OFS (l.1): The list of known font families: +defaults: + [CMRoman/] \rm, \bf, \it, \bi, \sl + [CMSans/] \rm, \bf, \it, - + [CMTypewriter/] \rm, - , \it, - , \sl + [Times/] \rm, \bf, \it, \bi + [Helvetica/] \rm, \bf, \it, \bi, \nrm, \nbf, \nit, \nbi + [Courier/] \rm, \bf, \it, \bi +sjannon.tex: + [JannonAntikva/] \rm, \bf, \it, \bi, \mr, \mi + [JannonText/] \rm, \bf, \it, \bi, \mr, \mi + [JannonCaps/] \rm, \bf, \it, \bi +sdynamo.tex: + [DynaGroteskDXE/] \rm, \bf, \it, \bi + [DynaGroteskRXE/] \rm, \bf, \it, \bi + [DynaGroteskLXE/] \rm, \bf, \it, \bi + ... ... +\endtt + +The first 6 families are declared in OFS internally (you need not write +any declaration file to use them). The next families are declared in +specified declaration files. + +Beside each family are listed option switches. The first +four switches set \uv{standard variants}. If a standard +variant is not available then a dash sign is listed instead of +the switch. The fifth and any other switches correspond to the +\uv{nonstandard variants}, if these exists. For example, +the JannonAntikva and JannonText families have the extra variants +medium and medium-italic ("\mr" and "\mi" switches are used here). + +If you use the "\fontusage"\inl[fontusage] command, then short +description of OFS use is printed to the terminal and into the log file. + +We mentioned the header in the form: + +\begtt +@PLAIN: \input ofs [, , ...] +@LATEX: \usepackage [,,...]{ofs} +\endtt +% +Instead of the header of this type you can also include definition +files directly. In such case, the "ofs.tex" +or "ofs.sty" do not have to be explicitly mentioned: + +\begtt +@PLAIN: \input \input ... +@LATEX: \usepackage {} \usepackage {} ... +\endtt +% +Example: + +\begtt +@PLAIN: \input sjannon \input sdynamo +@LATEX: \usepackage {sjannon} \usepackage {sdynamo} +\endtt +% +We don't recommend to mix the both variants of the header (in \LaTeX{} +specially). + +\subsec The {\tt\back setfonts} command +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Let us suppose\inl[setfonts] +that the "sjannon" and "sdynamo" +declaration files were given in the header for the next examples. +For example, +the command: + +\begtt +\setfonts [JannonText/12pt] +\endtt +% +sets the switches "\rm", "\bf", "\it", "\bi", "\mr" and "\mi". +These switches set variants of the JannonText family to +12pt font size. + +The current variant used before "\setfonts" command is saved, but the +family/size parameters of the current font are changed by this +command. For example, if the BoldItalic variant for the TimesRoman was a +current then the BoldItalic of JannonText family of size 12pt is +current font set by "\setfonts [JannonText/12pt]". If the new family +has the current variant switch undeclared then the "\rm" variant is +used. + +The "\setfonts" makes all changes locally, so that \TeX{} returns to +the previous font and font family after the group is ended. + +The parameters of the "\setfonts[/]" command can be empty: +the "\setfonts[/]" switches to the new font family but keeps +the current font size and the "\setfonts[/]" changes the font +size for all corresponded variant switches but keeps the current +family unchanged. The command "\setfonts[/]" is syntactically correct +but without any effect. + +The CMRoman/10pt is default / after OFS for plain\TeX{} +is initialized. + +The parameter , unless not empty has to be the same as the +name of a family listed by the "\showfonts". This parameter is case +sensitive. If the parameter does not match any font family from given +declaration files, the "\setfonts" command acts the same as the +"\showfonts" command: all available families are listed. Thus, you can +use the "\setfonts [?/]" with the same effect as the +"\showfonts". + +\LATEX: The parameter can be not only the \uv{long-named} +font family from "\showfonts" list, but the short name from NFSS can +be used too. For example, the "\setfonts[Times/]" and the +"\setfonts[ptm/]" has the same effect in \LaTeX. + +\OBA: +The parameter can be written in more ways: + +\begitems +* \dots{} example: "12", "17.4", +* \dots{} example: "12pt", "17.4pt", "10dd", +* "at" \dots{} example: "at12pt", "at17.4pt", "at10dd", +* "scaled" \dots{} example: "scaled1200", "scaled\magstep3", +* "mag" \dots{} example: "mag1.2", "mag.7", "mag2.0". +\enditems + +The first three possibilities have the same meaning. The keyword "at" is +optional and if you omit the keyword and the unit, the "atpt" +is used. We can use the "true.." unit if we need not the relative unit +associated by current "\magnification" factor: for example: +"17truept". If the "at" keyword is present then the unit can't be +omitted---it means: "at12" is not correct, but +"at12pt" or simply "12" are correct values. + +The "scaled" keyword has the same meaning as in \TeX{} primitive +"\font". For example, if the design size of the font is +"10pt" (this is a common value) then "scaled1200" is the same as +"at12pt". + +The last possibility (keyword "mag") is a new feature in OFS. +The new font size is calculated from the current font size by +multiplying by . +For example, by the command "\setfonts[/12pt]" followed by "\setfonts[/mag2.]" +the current font size is changed to 24\,pt. +The decimal point is required in the . +Another example: + +\begtt +\def\small{\setfonts[/mag.7]} +The text {\small is smaller \small and smaller \small and more smaller} +and the normal size is used here. +\endtt + +Note: the parameter in "\setfonts" command changes only the +font size but not the "\baselineskip". The user has to do the +"\baselineskip" setting by another way. +\LATEX: The "\setfonts" sets the "\baselineskip" to the current value +stored in NFSS. It means that if you want to change the +"\baselineskip" register for your goal, you have to do it +{\it after} "\setfonts" command in \LaTeX{}. + +You can set only one variant of a font family (not the whole family) by +the "\setfonts" command. This is done if the ``"-"'' is appended +to the parameter. In such case, the switches of the current +family are not changed and only the new font is set. The + means the name of variant switch here. Examples: + +\begtt +\setfonts [JannonText-it/12] ..... sets the italics of the JannonText + at 12 pt as the current font. + The \rm, \bf, etc. are unchanged +\setfonts [JannonText-rm/] ....... sets the normal variant of the + JannonText at the current size. +\setfonts [CMTypeWriter-sl/] ..... sets the cmsltt font as the current + font at the current size. +\endtt + +You can omit the family name even if the "-" is present. +The actual family is substituted in such case. Examples: + +\begtt +\setfonts [JannonText/12] +\setfonts [-bf/17] ... variant Bold of JannonText, size 17pt. + Selectors \rm, \bf, \it and \bi keeps its + original meaning: they switches between + variants of JannonText in 12pt size. For + example, the next command \setfonts[Times/] + sets the Times family in 12pt size. +BUT: +\setfonts [/17]\bf ... variant Bold of current family, size 17pt. + Selectors \rm, \bf, \it and \bi switches + in 17pt size now. +\endtt + +\LATEX: The text above about the keeping of original +meaning of variant switches is not true in \LaTeX{} because it may +break the NFSS philosophy. Thus, the commands +"\setfonts [-bf/17]" and "\setfonts [/17]\bf" has the same meaning in +\LaTeX. + + +\subsec The commands {\tt\back fontdef} and {\tt\back addcmd} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +The "\fontdef"\inl[fontdef] command declares a new font switch. + +\begtt +\fontdef \ [/] +\endtt +% +This declaration is roughly similar to + +\begtt +\gdef \ {\setfonts [/]} +\endtt + +\PLAIN: If the ``"-"'' is appended in and the +parameter is not empty and it is not specified by "mag" keyword +then the new declared control sequence "\" is not a macro +but it is implemented by "\global\font\". +It is called \uv{fixed font} in an~OFS terminology. +The user can implement his/her native "\" by "\fontdef" +without a knowledge about "tfm" filename. + +\LATEX: The declared "\" is always implemented as a macro +including the "\setfonts" command. The reason is that the user access +to native "\" is not simply possible in NFSS. + +\OBA: +You can type the exclamation mark \uv{!} instead of and the +family current in the moment the "\fontdef" command was used is substituted. +On the other hand the empty means that the family current in the moment +the "\" command was used is substituted. You can use the +exclamation mark \uv{!} instead of parameter with the same meaning. +Examples: + +\begtt +\setfonts [JannonAntikva/] +\fontdef \small [/7] % \small = \setfonts [/7pt] +\fontdef \sffam [DynaGroteskR/] % \sffam = \setfonts [DynagroteskR/] +\fontdef \bigf [Times/17] % \bigf = \setfonts [Times/17pt] +\fontdef \ttfam [Courier/] % \ttfam = \setfonts [Courier/] +\fontdef \mylogo [Times-rm/mag.8] % \mylogo = \setfonts [Times-rm/mag.8] + % the fontsize will be always + % 0.8 times of the current size. +\fontdef \timbf [Times-bf/12] % \timbf = fixed-font, the same as: + % \global\font\timbf=ptmb8z at12pt +\fontdef \jansmall [!/7] % \jansmall=\setfonts[JannonAntikva/7] +\fontdef \janbi [!-bi/17] % \janbi = fixed-font, the same as: + % \global\font\janbi=sjnbi8z at17pt +\fontdef \tt [Courier-rm/!] % \tt = fixed-font, the same as + % \global\font\tt=pcrr8u at10pt +\endtt + +The declaration of the "\" by "\fontdef" command is global +but the "\" itself has a local effect in the place where it is +used. + +Since OFS version Oct.~2002, the "\addcmd"\inl[addcmd] command is +supported, which makes possible to concentrate whole font +management in one place. The format of "\addcmd" is: + +\begtt +\addcmd \ {} +\endtt +% +The meaning is same as + +\begtt +\def\ {} +\endtt +% +You can include new into the original content of the macro +"\". The control sequence "\" has to be +defined as a macro without parameters or as unexpandable control +sequence (by "\font", "\chardef" etc.) before "\addcmd" is used. +The "\addcmd" redefines "\" as a macro without parameters in +all cases. You can apply "\addcmd" on the same "\" +more than once. + +Examples: + +\begtt +\setfonts [JannonText/] +\fontdef \footnotefont [!/7] +\addcmd \footnotefont {\rm \baselineskip=9pt \relax} +\fontdef \sectionfont [!/12] +\addcmd \sectionfont {\bf \let\it=\bi} +\endtt + +\subsec Test of a family name existence +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\PLAIN: + You are able to test the font family declaration in your own marcos, + it means whether the font is loaded from the file of declarations. + The sequence "\knownfam ? \iftrue"\inl[knownfam] + is used for such test. + This sequence expands to "\iftrue", if the font family is declared + otherwise expands to "\iffalse". The parameter has to be + brought in without the variant specification. + +\OBA: By reason of the backward compatibility with the older version of OFS + the "\ifknownfam []"\inl[ifknownfam] does the same as + "\knownchar" macro. + Since the version Feb.~2004 of the OFS for plain it is recommended + to use "\knownfam", because of correct alignment of the primitives + "\if*", "\else", "\fi". La\TeX\ user can define "\knownfam" quite easily. + +\subsec \LATEX: OFS and NFSS +%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +This section is intended only for \LaTeX{} users. +The command\inl[OFSfamily] + +\begtt +\OFSfamily [] +\endtt +% +converts the long family name to internal short NFSS family name. +For example + +\begtt +\OFSfamily [Times] +\endtt +% +expands to "ptm". The macro works only on expand processor level thus +we don't get the error message if the is not known. The +"\OFSfamily" expands to the text ``"unknown"'' in such case. +If you are using the "\OFSfamily" in your macro files and the +NFSS try to substitute the "unknown" family then you can be sure that +some misspelling occurs in parameter or the required family +is not known. + +The example: + +\begtt +\usepackage [sjannon, sdynamo] {ofs} +\edef\rmdefault {\OFSfamily [JannonAntikva]} +\edef\sfdefault {\OFSfamily [DynaGroteskR]} +\edef\ttdefault {\OFSfamily [Courirer]} +\endtt + +The meaning of the macros "\rmdefault", "\sfdefault", "\ttdefault" is +described in the NFSS documentation. + +OFS defines the command\inl[OFSfamilydefault] + +\begtt +\OFSfamilydefault [] +\endtt +% +which sets the basic family of the whole document. This family is used +in the plain text and in the chapter headers etc. too (if the used class +file is made by common \LaTeX{} conventions). The command +"\OFSfamilydefault" internally does: + +\begtt +\edef\familydefault {\OFSfamily []} +\endtt +% +and moreover it also cares for the case of the unknown . +If the is not known then the list of the supported families is +printed. + +\subsec The font encoding +%%%%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: The font encoding switching is the subject to the NFSS and OFS +defines nothing more (i.e., packages "fontenc" and "inputenc" +work as expected). + +\PLAIN (to the end of this section): +OFS sets the font encoding into CSfonts encoding by default. +If you need to use fonts encoded in another encoding (T1 by Cork, +for example) then you write "\def\fotenc{8t}"\inl[fotenc] +before the OFS is included and OFS will operate the fonts with this encoding. +The name ``"8t"'' is an example of T1 encoding. + +You can even switch the encoding inside the document: + +\begtt +\def\fotenc{8z} \setfonts[/] ... fonts in CSfont encoding +\def\fotenc{8t} \setfonts[/] ... fonts in encoding by Cork +\endtt + +Moreover there are tools in OFS for correct macros expansion, +that are dependent upon the font encoding (for example "\v", "\'", "\ae"). + +By default, OFS set "\loadingenc=0"\inl[loadingenc], +which means, that font encoding change nor the command "\setfonts" does not +change of the macros of the type "\v", "\ae". These macros hold their +original \hbox{plain} meaning. Such a feature will welcome plain users, +who dislikes too inteligent packages. + +But, if the document starts with "\loadingenc=1", for example: + +\begtt +\input ofs [a35,sjannon] \loadingenc=1 +\endtt +% +then \TeX{} checks during every run of the "\setfont" command, +whether all necessary files named "ofs-.tex" are loaded. +These files contain macro definitions dependent on the preset font encoding. +If these files are not loaded, \TeX{} loads them during the run of "\setfonts". +More informations on this topic can be found in the sections~\beglink{3.3}3.3\endlink{} +to~\beglink{3.5}3.5\endlink. + +The OFS package contains three basic files with macros definitions dependent +on the encoding: "ofs-8z.tex", "ofs-8t.tex" and "ofs-8c.tex". If you use another +font encoding, you can create a new similar file. Commands "\accentdef" +and "\characterdef" used in these files are described in details in the +\beglink{3.4}section~3.4\endlink. + +\subsec The fonts in mathematics +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: OFS for \LaTeX{} does nothing with the issue of math fonts. +You need to use some \LaTeX{} package or build on the capabilities of NFSS. + +\PLAIN (to the end of this section): +The command "\setfonts" and the control sequences declared by "\fontdef" +switch fonts in text mode only. Until you use the +"\setmath" command, all text between dollars is in Computer Modern in +10\,pt/7\,pt/5\,pt sizes (text/index/index of index). + +The "\setmath"\inl[setmath] command has the following syntax: + +\begtt +\setmath [//] +\endtt +% +The parameters set sizes of mathematical fonts and they +have same syntax as in the "\setfonts" command. +The keyword "mag" means the magnification to the size of +the current textual font. The empty parameter means the following +substitution: + +\begitems +* text size: "mag1.0" +* index size: "mag0.7" +* indexindex size: "mag0.5" +\enditems + +It means that "\setmath[//]" has the same effect as +"\setmath[mag1./mag.7/mag.5]". The +"\setsimplemath"\inl[setsimplemath] +command is defined in OFS as the equivalent of the +"\setmath[//]" command. + +The "\setmath" sets the mathematical fonts depending on the values of the +macros "\fomenc" and "\mathversion". The "\fomenc"\inl[fomenc] means the +mathematical encoding and the "\mathversion" means +the version of the math-families set. + +Mathematical encoding is set by the value of the macro +"\fomenc".\inl[fomenc]. +There exist following possibilities: + +\begitems +* If the default value "\def\fomenc{PS}" (PostScript fonts) is used + then "\setmath" sets the + italic from the current font family as a mathematical italic ("\fam1"). + It uses "\rm" from the current font family for + digits and a some other symbols. The variant selectors + "\rm", "\it", "\bf" and "\bi" work in math mode too. +% + Moreover, when "\def\fomenc{PS}" is used then the math symbols from "\fam2" and Greek + symbols (originally located in "\fam1") are used from PostScript + Symbol font. This font is much better visual compatible with most + Postscript fonts than the Computer Modern symbols. Other symbols (e.\,g.,~big operators + and big braces) stay in Computer Modern font because unfortunately + there is no common alternative for these glyphs. + +* If "\def\fomenc{CM}" is used then "\setmath" command keeps the Computer Modern + fonts in math formulae. It sets only the desired sizes given in the + parameters. + +* It is possible to use "\def\fomenc{AMS}" after loading the file "amsfn.tex". + Mathematic symbols are the same as while using "CM", but in addition + you can use all mathematics symbols from~AMS\TeX{}. + +* After loading the file "txfn.tex", you can use two new encodings: + "\def\fomenc{TX}" or "\def\fomenc{PX}". + In both cases the free TXfonts are used for mathematics, they are compatible + with the font families Times and Helvetica. If you choose the value "TX" then + pure TXfonts are used for all mathematic symbols, whereas + the value "PX" means that TXfonts + are going to be combined with italics and with the basic fontface of the actual + font family (similar to "PS" encoding). OFS supports all control sequences + of the mathematic symbols, as is mentioned in the TXfonts reference. There are + all symbols from the AMS\TeX{} and many more there. There are + hunderts sybols from TXfonts. + +* After loading the file "mtfn.tex", it is possible to use "\def\fomenc{MT}". + Mathematics will contain italics and basic fontface of the actual font family + as well. And it will be combined with the characters of the commercial version + of the mathematics fonts MathTimes. +\enditems + +OFS supports two versions of math formulae as default: normal and +bold version. The user can define another versions---see +\beglink{3.6}section 3.6\endlink. +The current version is set by the contents +of the "\mathversion"\inl[mathversion] +macro. You can say "\def\mathversion{normal}" or "\def\mathversion{bold}" +before "\setmath" command. The "normal" version is used as +default. Examples: + +\begtt +\setmath [//] $formula$ % formula in "normal" version +$\def\mathversion{bold}\setmath[//] formula$ % formula in "bold" version +\endtt + +\sec The inside of OFS for insiders +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: All auxiliary macros of OFS are defined in "ofs.sty" file with +the name "\ofs@macroname" in order to avoid the confusion with other +style files. The macros used in declaration files have the name +"\OFSmacroname". Moreover OFS defines user-level macros "\fontdef", "\showfonts", +"\fontusage", "\rm", "\bf", "\it" and "\bi". + +\PLAIN: All auxiliary macros of OFS are defined in "ofs.tex" file and +they are listed in index at the end of this document. The convention +with the~"@" character is not used because I personally hate this character in +macro names. + +\subsec Debugging +%%%%%%%%%%%%%%%%% + +\LATEX: Use the standard NFSS package "tracefnt" for tracing purposes. + +\medskip +\PLAIN: There are four commands for tracing OFS: +\begitems +* "\nofontmessages"\inl[nofontmessages] sets no tracing info. +* "\logfontmessages"\inl[logfontmessages] sets the tracing info to log file only. +* "\displayfontmessages"\inl[displayfontmessages] sets the tracing + info to log file and to terminal. +* "\detailfontmessages"\inl[detailfontmessages] sets the detailed + tracing info to log and to terminal (all "\font" primitives are traced). +\enditems +The "\logfontmessages" is initialized by default. + +The warnings about unaccessible characters or encodings are always displayed +on the terminal and they are written into the log file. If you want log output only, +you can write "\let\displaymessage=\wlog"\inl[displaymessage], +because OFS uses this sequence for displaying messages on the terminal. + +\subsec The robust and fragile commands +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: \LaTeX{}2e has its conventions to define robust commands. +The command "\setfonts" and the "\" declared by +"\fontdef" are robust, of course. They can be used in texts for table +of contents, indexes etc. + +\PLAIN (to the end of this section): +Plain\TeX{} does not solve the problem of fragile commands and its +users have their own solutions without any standardization. One +solution is used in OFS. + +What is a fragile command? We sometimes need to send some part of +text to auxiliary file (for table of contents, index, etc.). We +are doing it by "\write" primitive and in second run of \TeX{} this +file is "\input"-ted. The problem is that the "\write" primitive prints +the text to the file after all macro expansions and it may cause +problems. For example, if the font switch is implemented as a +complicated macro and it is used in "\write" parameter then the macro +is stored in the file after its expansion. +The error can occurs in most cases during the "\input" of such file. +We say that the \uv{fragile} +command was used in "\write" parameter and that this command +\uv{was got spilt} in auxiliary file. + +If the (potentially) fragile command defined in OFS is being +sent to the file then the +following message is printed on the terminal and to the log file during the +"\input" of the file: + +\begtt +ERROR !! The fragile command in the toc/ind/aux or similar file. +You can solve this problem by the following steps: +1. Remove the auxiliary file with this command. +2. Include the following macro code into your document header: + \let\orishipout=\shipout + \def\shipout#1#2{\setbox0=#1{#2}\bgroup + \let\expandaction=\noexpand \orishipout\box0 \egroup} +3. Run TeX on your document again and again... +See the OFS documentation for more info. +! The fragile command in auxiliary file +\endtt + +You can follow this hint to remove the problem. + +The detail explanation of this behavior follows. The "\setfonts" and +other (potentially) fragile macros are implemented in OFS by the +following way: + +\begtt +\def\macro {% + \ifx\expandaction\noexpand + \noexpand\macro + \else + \csname fragilecommand!\endcsname + + \fi +} +\endtt + +If "\expandaction"\inl[expandaction] does not have the meaning +"\noexpand" then the "\else" part of the macro +code is performed. The +"\csname fragilecommand!\endcsname"\inl[fragilecommand!] +expands to "\fragilecomand!" and this text occurs in auxiliary file. +If this file is included in next \TeX{} run then the +"\fragilecomand"\inl[fragilecommand] +runs and this command prints the +message with the hint mentioned above. + +If the user follows the hint then the "\expandaction" +has the meaning of "\noexpand" when the "\shipout" is active +(it means during the no-immediate "\write" parameter expansion). +The "\macro" expands to "\macro" and this text is stored in +auxiliary file. + +The "\shipout" is not re-defined in OFS by default---only a suggestion +is printed if fragile command in the "\write" parameter occurs. The +reason is that a plain\TeX{} +user may have his/her own redefinitions of "\output" routine or +"\shipout" primitive thus OFS for plain does not do any redefinitions at +this level itself. Unlike \LaTeX{} users the plain user needs exactly +to know how his macros work. + +The code above illustrate the definition of an abstract macro +"\macro". The similar code is used for the following actual macros in +OFS: "\setfonts" (\beglink{2.2}section~2.2\endlink), +"\setmath" (\beglink{2.7}section~2.7\endlink), +"\" declared by "\fontdef" +macro (\beglink{2.3}section~2.3\endlink), +"\setextrafont", "\printcharacter", "\printaccent" +(\beglink{3.4}section~3.4\endlink), +"\accentabove" and "\accentbelow" (\beglink{3.6}section~3.6\endlink). +If you use the hint above then these macros become \uv{robust} +in \LaTeX{} sense of this word. + +\subsec Declaration files +%%%%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: The declaration files for OFS are common \LaTeX{} style files +which includes mapping from long family names to NFSS family names +of one or more font families. These NFSS families are declared in +common~"fd" files. Use NFSS documentation to create "fd" files. +You can use the following commands in the OFS declaration files: + +\begitems +* "\OFSprocessoptions"\inl[OFSprocessoptions]: + This macro is undefined by default but it has the meaning "\relax" + during "ofs.sty" file is scanned and its options are included. + You can test by "\ifx" the value of this control sequence in order + to skip the "\RequirePackage{ofs}". +* "\OFSextraencoding {}"\inl[OFSextraencoding]: + The macro stores the into memory and does + "\input {ini.def}". + We assume that the corresponding definitions for + are included in this file. See "se1ini.def". This file includes the + declarations for extra encoding SE1 for fonts by Storm Type Foundry. + If the "ini.def" file was included already it is not + included again. Attention: use uppercase letters for + parameter but use lowercase letters in filename. +* "\OFSputfamlist {}"\inl[OFSputfamlist]: + The macro adds the into the list of family names. + This list is printed by "\showfonts" command or if unknown family is + used in "\setfonts". +* "\OFSdeclarefamily [] {}"\inl[OFSdeclarefamily] + This macro does an actual mapping from (long family name) + to the (short NFSS family name). Moreover, it stores the + line about this family name to the list of family names which is + printed by "\showfonts" command. +* "\OFSnormalvariants"\inl[OFSnormalvariants]: + This macro stores the list of standard switches + "\rm,"~"\bf," "\it," "\bi" into the list of family names which is + printed by "\showfonts" command. +\enditems + +\PLAIN (to the end of this section): +The declaration files have the extension "tex" and we assume that there is +a locking code in them so that the file will not be read twice. +If the "ofs.tex" is not included already then it have to be included at the +begin of declaration file. + +You have to define the mapping from long family names to "tfm" names in +the declaration files. You can use the following commands: + +\begitems +* "\protectreading "\inl[protectreading] --- + the flag about the reading is saved in the memory. + If the command is run with the same parameter once more, + the "\endinput" is executed. It means + that next declarations are protected against the multiple reading. +* "\ofsputfamlist {}"\inl[ofsputfamlist]: + The macro adds the into the list of family names. + This list is printed by "\showfonts" command or if unknown family is + used in "\setfonts". +* "\ofsdeclarefamily [] {}"\inl[ofsdeclarefamily]: + This macro declares the new font family with the name . + The is stored into the list of family names which is + printed by "\showfonts" command. If this family is used by + "\setfonts" then the are performed. We assume that the + include "\loadtextfam" command and (zero or more) + "\newvariant" commands. +* "\loadtextfam"\inl[loadtextfam]: + This macro loads four fonts with given metrics. See below for the syntax and + the detail explanation of this command. +* "\newvariant \ () ;;"\inl[newvariant]: + \null\space This macro sets the \uv{nonstandard} variant for given font family. + See below for the detail explanation of this command. +* "\modifyenc :;"\inl[modifyenc] --- the exceptions + are added with respect to the basic encoding, see~\beglink{3.5}section~3.5\endlink. +* "\fosize"\inl[fosize]: + The information about the actual font size of the last selected font + family is stored in this macro. The value of this macro can be in + one of the two forms: "at" or "scaled". This depends + on the form of parameter given in "\setfonts" command. +* "\fotenc"\inl[fotenc]: + The actual encoding is stored in this macro. The common values are: + "8z" for encoding by CS-fonts (by ISO-8859-2) or "8t" for encoding + by Cork. The part of "tfm" name (where encoding is specified) + is recommended for values of "\fotenc" macro. + If "\fotenc" is undefined at the time of OFS is initializing, the + OFS makes "\def\fotenc{8z}" else the "\fotenc" is unchanged. +* "\extranec"\inl[extraenc] --- macro, that stores the information + about the extra encoding. This information is copied from the parameter + , that is located in the "\laodatextfam" command. +* "\defaultextraenc"\inl[defaultextraenc] --- if you redefine this macro, the + extra encoding of the basic families and the families from~"a35.tex" can be + changed. The default value of this macro is "8c". +* "\setfontshook"\inl[setfontshook]: + This macro is called from "\setfonts" macro before from + "\ofsdeclarefamily" are performed. +* "\registertfm - "\inl[registertfm]: + You can declare different "tfm" names for different font sizes. + See \beglink{3.7}section~3.7\endlink{} for more details. +* "\registerenc : "\inl[registerenc] + --- enables the limitation of usage the font families only for + certain encodings. See~\beglink{3.9}section~3.9\endlink. +\enditems + +The "\loadtextfam" command used in declaration files +has the following syntax: + +\begtt +\loadtextfam () ;% + () ;% + () ;% + () ;;% +\endtt +% +The percent characters at the ends of lines here mean that no spaces are +allowed after semicolons. +You can save the long name of the used variant by "()" parameter. +This name us used only when the OFS is traced by "\logfontmessages" or +others commands. The parameters ``"() "'' are optional. +If this parameter is omitted then default value is stored: +"rm: ()", "bf: (Bold)", "it: (Italic)", "bi: (BoldItalic)". + +The parameters are the names of the "tfm" files for the +appropriate variants. The "\loadtextfam"\inl[loadtextfam] +does roughly the following work: + +\begtt +\font\tenrm= \fosize +\font\tenbf= \fosize +\font\tenit= \fosize +\font\tenbi= \fosize +\endtt +% +We assume that all parameters are written with the +"\fotenc" macro in order to make the switching to others +encodings possible. + +The parameter is the name of the extra encoding. If this +parameter is non-empty then the "\loadtextfam" command redefines +temporally the "\fotenc" macro: "\def\fotenc{}" and it +expands all parameters , , and + again. The results of these expansions are stored into +memory. They are the \uv{extra metrics} connected to the +\uv{basic metrics}. +If the parameter is empty then there are no +\uv{extra metrics} connected to \uv{basic metrics}. +One can use a macro which can need the access +to the extra metric concerned to the basic metric of the current font. +The macro for "\euro" character is the good example of these needs. + +Some (except of ) can be omitted. When the + is empty then the "\loadtextfam" command +does roughly the following work: + +\begtt +\def\tenXX{\message{WARNING: the needed font variant is missings}} +\endtt +% +It means that if the user needs the omitted variant then the message +is printed to the log file and to the terminal and no font change is done. + +The "\setfonts"\inl[setfonts] command does not change the meaning of +the macros "\rm", "\bf", "\it" and "\bi". It only changes the font +switches "\tenrm", "\tenbf", "\tenit",\inll[tenrm \back tenbf \back tenit] +and "\tenbi" respectively\inl[tenbi]. The first three font switches are known in +plain and the last one is introduced in OFS. +The macros "\rm", "\bf", "\it" and "\bi" store the information about +last selected variant into control sequence "\currentvariant"\inl[currentvariant]. +This information has the form of the letter "M" (for "\rm"), "F" (for "\bf"), +"T" (for "\it") and "I" (for "\bi"). It is stored by +"\let\currentvariant=" +because this code is not expanded. Thus we need not to implement a +special \uv{robust} code to the macros for variant switches. + +Note that the "\loadtextfam" command sets the font switches +"\tenrm", "\tenbf", "\tenit" and "\tenbi" to the fonts of arbitrary +size given by the contents of the "\fosize" macro. The word ``"ten"'' +in names of font switches is used only for the historical reasons and it does +not mean that the font is loaded at 10\,pt size. + +You can object that the repetitive calls of "\setfonts" runs the +font loading on the four fonts in given font family again and again. +This can be time consuming operation. But you are not right. \TeX{} +stores the font information from font loading in its internal memory +and if the "\font" primitive is applied again to the same font then +\TeX{} uses the information stored before and it needs not to load the +font again. + +If "\loadingenc>0"\inl[loadingenc] the command "\loadtextfam" reads +the file "ofs-\fotenc.tex" before fonts loading. +If the parameter is non-empty, it loads moreover the file +"ofs-.tex". These files are read only once. Empty lines +and ends of lines are ignored during reading. Reading is performed inside the +group. The character categories are locally set in accordance to +plain\TeX{} (and~"\catcode`@=11"). The "\globaldefs=1" is set. It means, +that all macros and values from the file "ofs-.tex" are +defined globally. +That does not matter, because newly loaded encoding files do not conflict +with the previous ones (see the commands "\characterdef" and "\accentdef" +in~\beglink{3.4}section~3.4\endlink). It does not matter at all, if there +are loaded more files, than is necessary at a given instant. It is not wise +to read the encoding file repeatedly, when the command "{...\setfonts...}" +is executed. This is the reason of the global definition. +If the user dislikes the global predefined macros (he/she wants to add the +article into the proceedings, where such a predefined macros can collide with +other articles), he lets the "\loadingenc=0". In this case, the +declaration files have to be loaded manually by "\input" command at +the beginning of the article. + +You can declare a nonstandard variant in of the +"\ofsdeclarefamily" by the "\newvariant"\inl[newvariant] command. +The "\newvariant" command does roughly the following: + +\begtt +\font\ten= \fosize +\def \ {\let\currentvariant= \ten} +\endtt +% +Moreover the "\newvariant" stores the \uv{extended metric} +connected to the \uv{basic metric} if the is not empty. + +If the OFS needs to return to the last \uv{nonstandard variant} then +it does it by the value of the "\currentvariant". If the new family +has the \uv{nonstandard variant} with the same as a previous +family then this variant is used and OFS does not switch to the "\rm" +variant. You can declare the variants of various families but the +similar \uv{type} with the same . +There are only ten digits thus we can distinguish only ten different +\uv{types} of \uv{nonstandard variants}. + +The macro "\setfonts" can change the meaning of the macros +"\loadtextfam" and "\newvariant" if the +"-" is specified in parameter of "\setfonts". +It is sufficient to load only one font in such case but not the whole +family. If the ``"-"'' is \uv{standard} then "\newvariant" is +redefined so that it do nothing and "\loadtextfam" is redefined in +order to load only one font of the variant specified. +If the "-" is is \uv{nonstandard} then "\loadtextfam" do +nothing and "\newvariant" loads the font only if it loads the variant +specified. + +We describe the operations of "\setfonts [/]"\inl[setfonts] +command here in detail. This command calculates and defines the +"\fosize" macro by the parameter. If the is not empty +and the "-" is not given then "\setfonts" performs +"\def\currentfamily{}"\inl[currentfamily]. On the other hand, +if the is empty then the "\currentfamily" is used for +restoring the family name. If the "-" is given then +"\setfonts" redefines the "\loadtextfam" and "\newvariant" macros at +the temporary time. This behavior is described in previous paragraph. +Then the "\setfonts" runs "\setfontshook" and +specified as a parameter of "\ofsdeclarefamily" of the +appropriate . It also runs macro "\runmodifylist"\inl[runmodifylist], +that at certain circumstances sets the exceptions from the chosen encodings +(see~\beglink{3.5}section~3.5\endlink). Finally the "\setfonts" runs +"\ignorespaces" at the end of its run in order to ignoring the possibly +forgotten space after ``"]"''. + +\subsec The font encoding and the character declaration +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\PLAIN: You can use the macro "\setextrafont"\inl[setextrafont] to +switch to the extra metric of the current font. If the extra metric +connected to the metric of current font is stored in \TeX{} memory (by +"\loadtexfam" or "\newvariant" command) then "\setextrafont" do roughly +the following work: + +\begtt +\font\extrafont= \extrafont@inl[extrafont] +\endtt + +\LATEX: You can use the macro "\setextrafont" to switch to the extra +encoding declared by "\OFSextraencoding" command. If this encoding is +declared then "\setextrafont" do roughly +the following work: + +\begtt +\fontencoding{}\selectfont +\endtt + +\OBA: +If you need to print the character from extra metric/encoding from +slot of position then you can use the macro +"\extchar "\inl[extchar]. + +\PLAIN (to the end of this section): +You can use the commands "\characterdef" and "\accentdef" to declare +the macros which depend on font encoding. See the "ofs-8t.tex" and +"ofs-8z.tex" for a good illustration. + +The "\characterdef"\inl[characterdef] has the following syntax: + +\begtt +\characterdef \ +% example: +\characterdef \promile 8z 141 +% or +\characterdef \ {} +% example: +\characterdef \promile 8t {\%\char24 } +\characterdef \promile * {\vrule height1ex width1ex\relax} + % in another encodings +\endtt + +If the current encoding is the same as then "\" +will expand to the token of category~12 with the code +or it expands to the . +All work is done at expand processor level when "\" is used. +You can declare the same "\" +for more encodings, see the "\promile" declarations in previous examples: + +\begtt +\def\fotenc{8z} \promile % expands to the token with the code 141 +\def\fotenc{8t} \promile % expands to the commands \%\char24 +\endtt + +Moreover you can simply declare the access to the extra encoding: + +\begtt +\characterdef \euro 8z 134 +\characterdef \euro 6s 37 + +\def\fotenc{8z} \euro % expands to the token of the code 134 +\def\fotenc{8t} \euro % expands to: {\setextrafont } +\endtt + +The second example is working only if the extra metric connected to +the current metric exists (see "\loadtextfam" and "\newvariant" commands) +and the extra metric has the "6s" encoding. If this is not valid then +the "\euro" prints the warning about inaccessibility of the "\euro" +character to the terminal and to the log file. + +Now, we explain the behavior of the "\characterdef"ed macros +in more details. The "\characterdef" command defines +the "\" as "\printcharacter{}",\inl[printcharacter] +it means that "\promile" expands to "\printcharacter{promile}" and "\euro" to +"\printcharacter{euro}" in our examples. +If you use the "\characterdef" twice to the same "\" then it +does not matter because the definition is still the same. +Moreover, "\characterdef" defines the special macro +"\:-" in order to this macro expands to the +token of given code or to the given . +The more work is done by the "\printcharacter" macro. +This macro checks if the "\:-\fotenc" is defined. +If it is true then "\printcharacter" expands to the contents of this +macro. Else "\printcharacter" checks if the extra metric is connected +to the current font. If it is true then "\printcharacter" checks if the +"\:-" is defined where is the +encoding of the extra metric. If it is true then +"\printcharacter" expands to +{\hbadness=1110\par} + +\begtt +{\setextrafont \:-} +\endtt +% +If all attempts fail then the "\printcharacter" try to print the default character +independent on encoding. It means, the "\printcharacter" checks if the +"\:-*" is defined and if true, it expands to this macro. + +If this is false then the "\printcharacterwarn{}" +is run.\inl[printcharacterwarn] +The implicit value of this macro prints out a warning, that the +character is not available. It is printed on the +terminal and into the log file. +No character is printed to "dvi" output. + +If we want to omit the warning printing, we can redefine the +"\printcharacterwarn" for example by following way: + +\begtt +\def\printcharacterwarn #1{?(#1)?} +\endtt + +The "\characterdef" does not redefine the defined control +sequences since the version OFS Mar. 2004. It defines only sequences, +that have the meaning "\undefined" or "\relax". Otherwise +(and also if the sequence is not defined by previous "\characterdef") +it prints the warning, that the definition is ignored. +The reason is that the encoding files declares by "\characterdef" command +enormous amount of new control sequences. But the programmer +have not to know all of them. It is possible, that he/she uses the same name +for his/her own macro. In this case, the "\characterdef" keeps the macro +defined by the programmer and lets the appropriate character unaccessible. +You have to write "\let\=\relax" befor of the "\characterdef" command +if it is really necessary to redefine some control sequences +(this procedure is needed for macros dependent on the encoding and +defined in plain\TeX). + +The macro "\safelet"\inl[safelet] has been added into OFS for the same reasons. +It acts similar to "\let", but resists to redefine the predefined control +sequences. The warning is printed by "\safeletwarn"\inl[safeletwarn] +macro instead of redefinition. + +You can use "\accentdef"\inl[accentdef] command to declaration of the +accent macros "\'", "\v", etc. depend on encoding. +This command has the following syntax: + +\begtt +\accentdef \ +% example: +\accentdef \v E 8z 204 % Ecaron +\accentdef \v e 8z 233 % ecaron +% or +\accentdef \ {} +% example: +\accentdef \v * 8z {\accent20 } % default caron in 8z +\accentdef \v * * {\blackbox } % default caron +\endtt + +If the current encoding is the same as then "\" +followed by expands to the token of category~12 with the code + or to the . This work is done at expand processor +level. If the declared is "*" then the "\" +expands to the token of given code or to the +given in the case of the +actual does not match with all declared . + +The possibility of the use of the extra metric is the same in +"\accentdef"-ed macros as in the "\characterdef"-ed macros. + +Now, we explain the functionality of the "\accentdef"-ed macros +in more details. The "\accentdef" command defines the "\" +as a macro with one non separated parameter~"#1" which expands to the +"\printaccent{}{#1}"\inl[printaccent]. For example, "\v E" +expands to "\printaccent{v}{E}". Moreover, "\accentdef" defines the +macro "\::-" in order to this macro expands to the +token of given code or to the given . +The more work is done by the "\printaccent" macro. +This command checks if the "\::-\fotenc" is +defined. If it is true then "\printaccent" expands to the contents of +this macro. Else the "\printaccent" checks if the extra metric is connected +to the current font. If it is true and if this extra metric has + encoding then "\printaccent" checks if the +"\::-" is defined. If it is true then +"\printaccent" expands to "{\setextrafont \::-}". +Else "\printaccent" checks if the macros "\:*:-\fotenc" +and "\:*:-" are defined in this order. +If the first one is defined then "\printaccent" expands to this macro +and appends the . If only the second one is defined then +"\printaccent" expands to: + +\begtt +{\setextrafont \:*:- } +\endtt +% +where is the font switch to the current font at the start +of "\printaccent" macro. If all attempts fail so far then +"\printaccent" try to use the macros "\::-*" +or "\:*:-* " in this order. If all the previous commands +fail, the "\printaccentwarn{}{}"\inl[printaccentwarn] is run. +The default value of this macro prints out on the terminal and into the log +file the warning about the unaccessibility of the accented character +and no character is printed on "dvi" output. + +Note that the character from extra metric inside the word breaks the +kerning around this character and breaks the possibility of +hyphenation of this word. It is extremely recommended that a basic +metric encodes all alphabet used in current language in order to +minimize switching to extra metric. For example, the "8t" and +"8z" encodings are good choice as basic metric for Czech and Slovak +languages. + +If we want to take out predeclared character\inl[characterdel] +(see so called in the next section), we can use the +commands"\characterdel" and "\accentdel".\inl[accentdel] +These commands have to have the same parameters like "\characterdef" and +"\accentdef" respectively and they take out the command definition +"\:-" and "\::-" +respectively. + +%The last part of this section is applied to the example of the inteligent +%"\Uppercase" definition: +% +%\begtt +%\def\Uppercase #1{\bgroup +% \let\expandaction=\noexpand % \euro stays unchanged +% +% \u{g} unchanged as well +% \def\ss{SS}\def\l{\L}\def\o{\O}\def\ae{\AE}\def\oe{\OE}% +% \edef\tmp{#1}\expandafter +% \egroup \expandafter\uppercase\expandafter{\tmp}% +%} % \uppercase changes \u{g} to \u{G}. +%\endtt + +\subsec \PLAIN: Macro files dependent on the encoding and encoding exceptions +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Commands "\characterdef" and "\accentdef" described in the previous +section redefines macros dependent on the encoding ("\v", "\ae", etc.). +In this section, we are going to describe the conception of placement +these macros. + +Macros declarations by means of "\characterdef" and "\accentdef" +have to be written into the files called "ofs-.tex" +(so called~{\it encoding files\/}). The command "\loadtextfam" (called +from the "\setfonts" macro) reads these declarations from these files while +"\loadingenc=1"\inl[loadingenc] is set. + +Every encoding contains its own basic set of characters and accented types. +This set is registered in the encoding file by the +"\characterdef" and "\accentdef" commands. Particular font families can contain +some additional characters or some characters can be missing in reference +to that basic set. These exceptions are declared by means of the command +"\modifydef"\inl[modifydef]: + +\begtt +\modifydef :; {} +\endtt +% +The contain the commands "\characterdef", "\accentdef", +"\characterdel" and "\accentdel". The "\*del" commands have to contain +the the same value of the character in the argument as in basic encoding set. +If any character has to be redefined, the commands "\*del" and "\*def" corresponding +to this character must be written one after another. + +The command "\modifyenc"\inl[modifyenc] used in the pearameter of the +"\ofsdeclarefamily" macro is a ``link to ''. You can mark +by "\modifyenc" command that the family +contains with respect to the basic encoding set. +The command has following notation: + +\begtt +\modifyenc :;% +\endtt +% +You can list more of one command for every font family +(these commands can contain different as well). +Nothing is done, if this command links to , that were not +yet declared. + +An example of the exceptions declaration "8z:csfonts" can be +found in the file "ofs-8z.tex" and links to them are used in families "CM*" +in the file "ofsdef.tex". + +Commands "\modifyenc" are run at each "\setfonts". As the matter of fact +these commands only stores their parameters into so called ``list of links'' +(to the macro "\newmodifylist"\inl[newmodifylist]). At each start of the "\setfonts", +the new list of links is created. The "\modifyenc" command stores its +parameter into this list +only if is equal to "\fotenc" or "\extraenc". The exception handling provides +the command "\runmodifylist" that is run on the end of the "\setfonts" command. +Its activity is an object of the next paragraphs. + +The macro "\runmodifylist"\inl[runmodifylist] compares the ``list of links'' +of the previous family ("\modifylist"\inl[modifylist]) with the ``list +of links'' of the newly +set family ("\newmodifylist"). The "\runmodifylist" finishes its activity, +if both lists are the same or "\modifylist" has the meaning "\relax". +Otherwise, the setting of exceptions is run: At first, meanings of +"\characterdef"$\leftrightarrow$"\characterdel" and +"\accentdef"$\leftrightarrow$"\accentdel" are exchanged and "\modifylist" is run. +In other words, the macros dependent on the encoding are returned +to the initial state (without exceptions). During this activity, +the deleting of the character is ignored, +if the character was declared immediatelly before +(see the rule about character redefinition above). +Next, the command "\runmodifylist" returns +the "\characterdef" and "\accentdef" into the initial state and run "\newmodifylist". +All the redefinitions, that takes place during this activity, are just local. +The mechanism of two lists ensures, that for example: + +\begtt +\setfonts [Family1/] ... \setfonts [Family2/] ... +\endtt +% +the exceptions of the actual encoding will be correctly set even +for the Family2, eventhough the Family1 has another set of exceptions +than Family2. + +The control sequence "\modifylist" has the meaning of the empty +macro after the OFS startup. The macro programmer can set +"\let\modifylist=\relax" to override every set of exceptions. +Note, that declaration commands "\modifydef" store into the memory +and execute them in order to define all declared sequences corresponding to +"\printcharacter" and "\printaccent" respectively. It means, that every +control sequence from all exceptions is defined (the message {\tt undefined +control sequence} is not displayed). Moreover OFS has perfect view whether the +control sequence is available or not in the actual family. The macro programmer +can then redefine macros "\print*warn". + +The command "\modifydef" slightly changes commands +"\accentdef", "\accentdel", etc. for a temporary time and then +it executes the +. The control sequence "\skipfirststep"\inl[skipfirststep] forbids the +execution of the macros in the during the activity of "\modifydef". +It acts just like "\relax", but during the execution of the by means +of "\modifydef" the whole part of behind this sequence is omited. + +Identifiers ":lccodes" and ":ienc" are reserved for usage +in the macros out of OFS. OFS does not consider the setting of the characters +"\lccode", "\uccode". A macro package taking care of these values can properly +define commands "\lccodes"\inl[lccodes] and "\lccodesloop" and runs +"\csname :lccodes\endcsname". These above mentioned commands are +not defined in OFS at all.\inl[lccodesloop] +The declarations ":lccodes" are loceted in the files "ofs-8t.tex" and +"ofs-8z.tex", eventhough they are not used in OFS. It bears upon the text +fonts encoding. An example of ":lccodes" usage is placed in the +macro called "lang.tex". Macro "inec.tex" uses ":ienc". More +informations can be found in the appropriate documentation. +{\hbadness=1617 \par} + +The declarations of the most commonly used exceptions are written directly +into the encoding files. The declarations of the less usual exceptions +(related only to some font families) can be written behind "\endinput" +of the declaration files. +You can use a command "\modifyread"\inl[modifyread] +in of "\ofsdeclarefamily": + +\begtt +\modifyread ;% +\endtt +% +This command reads the file from the first apperance +of the sequence "\modifytext"\inl[modifytext], but only if +the "\loadingenc" is positive. It is suitable to place the "\modifytext" +sequence behind "\endinput", so the "\modifyread" command +reads only that part of the file, which has not been read before. +Assigning is global during the reading, the empty lines and +ends of lines are omited. The file is not loaded repeatedly. + +This command gives you chance to concentrate the font families +declarations and encoding exceptions declarations into the single file. +\TeX\ reads the exceptions in the time it needs them, so the \TeX\ memory +is spared. An example is placed in the file "slido.tex". + +OFS offers testing macro as well, whether the control sequence corresponds +to the character, that is available in the font or not:\inl[knownchar] + +\begtt +\knownchar ? \iftrue character is available + \else character is unavailable or undefined \fi +% example: +\def\tryeuro{\knownchar \euro? \iftrue \euro \else Euro\fi} +\endtt + + +\subsec The auxiliary macros for accents and characters +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +You can declare the default accents in OFS\inl[accentabove] +not only by the "\accent" +primitive but by the macros "\accentabove" and "\accentbelow" too. +The syntax follows:\inl[accentbelow] + +\begtt +\accentabove {}{}{} +\accentbelow {}{}{} +\endtt + +The "\accentabove" command put the above the + with the between them. The "\accentbelow" +command does the same work, but put the below the +. In both cases characters are placed on the joint vertical axis +and if the font is slanted then this axis is slanted too. The width of +the resulting character is derived from the width of the +only. The macros are implemented by the "\vbox", "\vtop" and "\halign" +primitives with the calculation of the (possibly) slanted axis. + +The accented characters for accent above are commonly designed in the +height 1\,ex for most fonts. It means, that placing such character by +"\accentabove" command needs the "-1ex" compensation: + +\begtt +\accentabove {}{-1ex}{} +\endtt + +In such case, the "\accentabove" has the same behavior as the "\accent" +primitive. The difference is that you can compose more than one accent +by "\accentabove" and "\accentbelow" macros. You can try: + +\begtt +\it \accentabove {.}{.1ex}{\accentabove {,}{.1ex}{\v A}} +\endtt + +\PLAIN: +Unfortunately, the declaration macro "\accentdef" is not able to +declare a macros which construct more than two accents. Moreover, the +first accent has to be to join to the as one compact +character in the font. If you needs more accents then you can use the +macros "\accentabove" and "\accentbelow" directly in the document. + +\PLAIN: +Since the version OFS Feb. 2004, the macro "\ofshexbox"\inl[ofshexbox] +is available. It acts very similar to the plain one "\mathhexbox", +furthermore it can set the font in accordance to actual version. +You can declare the family of four metrics by means of the +command "\ofshexboxdef"\inl[ofshexboxdef]: + +\begtt +\ofshexboxdef {}{}{}{} +% example: +\ofshexboxdef 2 {cmsy}{cmbsy10}{cmsy}{cmbsy10} % an examle +\endtt +% +The command "\ofshexbox " prints out the requested +character. Its font is one of four declared ones and its size is defined by +the command "\fosize". The font choice depends on the actual version. If the +version is different than "\bf", "\it", "\bi", the is used. + +OFS declares only = 2 by default, because plain uses +only "\mathhexbox2..". The purpose of this macro was to define characters +"\S", "\dag", "\ddag", "\P" for CMfonts/CSfonts. The way of the definition +has to be independent on actual setting of mathematical fonts, but dependent +on actual size and version. See the file "ofs-8z.tex". + +We can easily define the "\euro" symbol by means of "\ofshexbox" for +every font encoding, where it is unavailable: + +\begtt +\ofshexboxdef {TS1}{tcrm1000}{tcbx1000}{tcti1000}{tcbi1000} +\characterdef \euro * {\ofshexbox{TS1}BF} +\endtt + +\subsec \PLAIN: The fonts in mathematics (the second apperance) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +The user interface to the math fonts was described in +\beglink{2.7}section 2.7\endlink. Now, it is the time to describe the principles of +math fonts in detail. + +The "\setmath"\inl[setmath] command calculates the text, index and +indexindex sizes from its parameters. +The results are stored into +macros "\textfosize"\inl[textfosize], +"\scriptfosize" and "\scriptscriptfosize"\inl[scriptfosize]. +The values are in the form +"at" or "scaled" depending on +the format of the parameters.\inl[scriptscriptfosize] +Then the "\setmath" runs the macro +"\mathfonts".\inl[mathfonts] +You can define the math fonts loading here but some +conventions are recommended, see below. +If the macro "\setmath" is run for the first time or the value "\fomenc" +has been changed, then the "\setmath" +runs the macro "\mathchars".\inl[mathchars] +You can define the math encoding by the +"\matchcode", "\mathchardef" etc. primitives here but some conventions +are recommended, see below. The OFS serves the default values of the +"\mathfonts" and "\mathchars" macros, see below. + +You can load a whole math family (text, index and indexindex size of +one font) in "\mathfonts" macro by the +"\loadmathfam"\inl[loadmathfam] command. This command has the +following syntax possibilities: + +\begtt +%% % font is declared by:: +\loadmathfam [/] % metrics +\loadmathfam [-/] % actual family version +\loadmathfam [/] % textual font switch +\loadmathfam [X/] % extending switch metrics +\endtt +% +Examples: + +\begtt +\loadmathfam 0[tenrm/] % metrics is in accordance to the switch \tenrm +\loadmathfam 5[-bi/] % actual text family metrics, version bi +\newmathfam \symbfam +\loadmathfam \symbfam [/psyr] % psyr metrics +\newmathfam \extitfam +\loadmathfam \extitfam [Xtenit/] % extending metrics for tenit switch +\endtt +% +This example shows, that the textual font with the "\tenrm" font +switch is used for math family~0. In the family~5, fonts are initiated +just like in the case of "\setfonts [-bi/]". A new family "\symbfam" +is declared as well. Fonts of the metric "psyr" are initiated into it. + +There exist a slight difference between usage of "\loadmathfam 5[tenbi/]" and +"\loadmathfam 5[-bi/]" command. In the first case, OFS finds out a metrics +of the "\tenbi" switch and the same metrics is then used for +all font sizes. The only modification is done by the key word "at". +The other case means, that different sizes can use different metrics, but only if +such a font ability is declared (see \beglink{3.8}section~3.8\endlink). + +The new family was in the example declared by means of the +"\newmathfam"\inl[newmathfam]. It is an alternative commnd to~"\newfam". +The reason for such a solution is evident. The plain macro "\newfam" is +defined as "\outer" one. It means that it is not possible to use it inside +any definition. Moreover the macro "\newmathfam" is local, so it spares some +place for user families, than plain one "\newfam". +New mathematical families are in the basic mathematical encodings +defided exactly by "\chardef". The command +"\lastfam="\inl[lastfam] sets the maximal +used value. Such a structure guarantees, that user can use "\newmathfam" later on +and the new family numbers are alocated with numbers greater than "\lastfam". + +Lets check out the the principle of the "\loadmathfam" macro activity. This macro +finds out a metrics, that corresponds to a given parameter. Next, the primitive "\font" +is executed three times: + +\begtt +\font \-Mt = \textfosize +\font \-Ms = \scriptfosize +\font \-Mss = \scriptscriptfosize +\textfont = \-Mt +\scriptfont = \-Ms +\scriptscriptfont = \-Mss +\endtt +% +Nevertheless is the text of the parameter "\loadmathfam", that +declares metrics (switch, version or metrics). + +The is generated as name of the or the name of the + if only the is given as parameter of the "\loadmathfam". + +The fonts of math family 3 are loaded without of the size changes +of index and indexindex fonts in plain\TeX. If you need this +feature then you can use the prefix "\noindexsize"\inl[noindexsize] +before "\loadmathfam". The macro "\loadmathfam" loads all three fonts +at the same "\textfosize" size. Example: + +\begtt +\noindexsize\loadmathfam 3[tenex/]% Standard extra symbols from CM +\endtt + +OFS defines four different macros for math font loading. Look at +"ofsdef.tex" file for these definitions. Which of these four macros is +used depends on the contents of macros "\fomenc" and "\mathversion" +We assume two possibilities of "\fomenc": "CM" or "PS" and two +possibilities of "\mathversion": "normal" and "bold". +OFS defines two macros with mathcodes. Which macro is used depends on +the contents of the macro "\fomenc". The list of these macros follows: + +\begitems +* "\loadCMnormalmath"\inl[loadCMnormalmath] + --- loads CM fonts in \uv{normal} version. +* "\loadCMboldmath"\inl[loadCMboldmath] + --- loads CM fonts in \uv{bold} version. +* "\loadPSnormalmath"\inl[loadPSnormalmath] + --- loads PostScript fonts in \uv{normal} version. +* "\loadPSboldmath"\inl[loadPSboldmath] + --- loads PostScript fonts in \uv{bold} version. +* "\setCMmathchars"\inl[setCMmathchars] + --- keeps the mathcodes from plain. +* "\setPSmathchars"\inl[setPSmathchars] + --- sets the mathcodes in order to some characters + are used from Symbol font. +\enditems + +OFS sets the following defaults in the "ofsdef.tex" file: + +\begtt +\ifx \fomenc\undefined \def\fomenc{PS}\fi +\def\mathversion{normal} +\def\defaultmathfonts{\csname load\fomenc\mathversion math\endcsname}@inl[defaultmathfonts] +\def\defaultmathchars{\csname set\fomenc mathchars\endcsname}@inl[defaultmathchars] +\def\mathfonts{\defaultmathfonts} +\def\mathchars{\defaultmathchars} +\endtt + +It is possible to add the another math families to the list of loaded +math families in "\loadmath" and "\mathchars" macros. You can do it, for example, by the +following code: + +The example how to add the Euler fraktur from AMS follows: + +\begtt +\input amsfn % here are declared metrics eufm and eufb +\addcmd\mathfonts{\def\tmpa{bold}% + \ifx\mathversion\tmpa \def\tmpa{b}\else\def\tmpa{b}\fi + \newmathfam\frakfam \loadmathfam\frakfam [/euf\tmpa]} +\def\frak#1{{\fam\frakfam#1}} +\endtt +% +Another examples of mathematical families declaration are located +in files "amsfn.tex", "txfn.tex" and "mtfn.tex". These files define +the implicit groups of the mathematical fonts for "AMS", "TX", "PX", "MT" +encodings. Finally they also contain comments (including examples), how to +load additional font families by means of the command "\addcmd". + +I would like to load all OFS font declarations in the~ini\TeX\ (see the Ok\TeX\ project), +but I want to spare the \TeX\ memory as much as possible too. So I suggest not to load +the large definitions containing declarations of mathematical fonts encodings by means +of "\mathchardef", etc. immediately, but during the first use in the document. +So the OFS version Apr. 2004 contains redefined macro "\setPSmathchars": + +\begtt +\def\setPSmathchars{\mathencread ofs-ps;} +\endtt +% +The command "\mathencread ;"\inl[mathencread] loads the encoding +commands included in the file . The file "ofs-ps.tex" contains encoding +commands for "PS" encoding, "ofs-ams.tex" contains encoding +commands for "AMS" encoding, etc. + +The files "ofs-ps.tex", "ofs-tx.tex" etc. contain encoding commands +``packed'' into groups and defined by the "\mathencdef"\inl[mathencdef] +command. By default, this command acts this way: ``define, run and forget''. Such a model +spares the memory, but a disadvantage of its procedure is, that during repeated +changes, encoding files are read over and over again. Mostly it does not matter at all, +because the mathematical encoding is the same for the whole document. +If this model is for somebody not suitable, the solution can be found in the macros +"\mathencread" and "\mathencdef". They can be redefined by the way, that +the files are read only once and during new execution of "\mathchars", +encoding commands are read out of remembered macros. + +The command "\mathencread ;" works in group. The catcodes +are set in accordance to plain\TeX\ ("\catcode`@=11" excluded) and the +".tex" is read. The "\globaldefs=1" are during the reading, the empty lines +and ends of lines are ignored. The commands "\mathencdef" run and forget defined +macros after group enclosure. It means, that these macros run the "\mathchardef" +commands in the sense of local settings. + +Let us explain an ensurance of restoring the delault values during +switching between mathematical encodings. The command "\setmath" +runs the macro "\mathcharsback"\inl[mathcharsback] in a time instant +before "\mathchars". It serves the restoring of the mathematical +encoding to the default state in accordance to plain\TeX{}. +This macro is set to "\relax" by default, because the mathematical +encoding is set in accordance to plain\TeX{}. +If the command "\setmathchars" changes the values preset in +the plain\TeX{}, it should also define the "\mathcharsback" macro. +A procedure of setting the values into the initial +state have to be stored in it. +A command "\mathencread ofs-cm;" can be used in the macro +"\mathcharsback", because the file "ofs-cm.tex" contains declarations +of the mathematical encoding in accordance to plain\TeX{}. + +If we insist on declaring our own mathematical encodings (different +from preprepared "PS", "CM", "AMS" etc.), the next principle has to be +fullfiled: in all versions of mathematical fonts (normal/bold/etc.) should be +set the numbers of the mathematical families by the same way +and ended by the same "\lastfam". Such a principle is necessary, because +after the version switching, the macro "\mathchars" is not run again. +It is not recomended to change especially the family numbers, that are linked +with the macro "\setmathchars". + +Let us now descibe another macros, that helps us with the mathematical +encoding declaration. +Macro "\hex"\inl[hex] converts a number to a singledigit hexadeximal +number. The usage of such a macro can be found in the files "ofs-ps.tex", +"ofs-tx.tex", etc. + +You can define the control sequences which are working in both: text +mode and math mode. You can use the +"\safemathchardef"\inl[safemathchardef] macro instead +"\mathchardef" primitive in "\mathchars" macro for this purpose: + +\begtt +\safemathchardef \ +\endtt + +If the "\" is not defined then "\safemathchardef" does the +same work as "\mathchardef" primitive. If the "\" is defined +(we assume that this definition is used in text mode) then +"\safemathchardef" saves the meaning of "\" in +"\T", it performs "\mathchardef \M = " +and it defines "\" by the following way: + +\begtt +\def \ {\ifmmode \expandafter \M + \else \expandafter \T \fi} +\endtt +% +Now, the "\" works in both: text and math mode. +If the "\safemathchardef" is applied on the same "\" +repetitively, then the second and another use of "\safemathchardef" +does nothing. + +We assume that all declarations of characters in text mode are +performed before the first use of "\setmath" and that the +"\safemathchardef" macros are used in "\mathchars" macro. + +The "\safemathaccentdef"\inl[safemathaccentdef] performs similar as +"\safemathchardef". Only the "\mathaccentdef"\inl[mathaccentdef] +macro is used instead +"\mathchardef" primitive. This macro does roughly the following: + +\begtt +\def \ {\mathaccent } +\endtt + +If you do not want to declare the whole new math family for only one +character or a few characters (the number of math families is +restricted to~16 for one formula in \TeX) then you can use the +"\pickmathfont"\inl[pickmathfont] macro. This macro has the following +syntax: + +\begtt +\pickmathfont {}{} +% example: +\mathbin {\pickmathfont {psybo}{\char"C4}} +\endtt +% +The "\pickmathfont" command uses the "\font" primitive with the given + and it prints the in this font. The result is an atom +of type Ord in the math list. The appropriate size is set +(text/index/indexindex) because the "\mathchoice" primitive is used by +"\pickmathfont" macro and the "\font" is loaded three times for each size. + +\subsec The different metrics for different sizes of font +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: This problem is solved in NFSS, see the syntax of the "fd" +files in NFSS documentation. OFS for \LaTeX{} does no more things. + +\PLAIN (to the end of this section): +There exist special font families (Computer Modern, for instance) +where the different metrics are used for the different font sizes. +This feature is implemented in OFS too. The parameter of the +commands "\loadtextfam", "\loadmathfam" and "\pickmathfont" can be +only the and not the name of "tfm" file exactly. +In such case, the is calculated from the font size and +from the data stored by a set of "\registertfm"\inl[registertfm] +commands. The +"\registertfm" has a following syntax: + +\begtt +\registertfm - +\endtt + +The and parameters have to include the unit and they +declares the interval of sizes with the following property: if the +desired size of font is in interval - then the +is used instead the . You need to use more +"\registertfm" commands to the same in order to use different + for different - intervals. +The - interval is closed interval (including the boundary +values) but the next "\registertfm" has a precedence over previous +one. Then you can construct the non closed intervals by the choose of +the right order of "\registertfm" commands. See the "ofsdef.tex" file +for an example. + +If the both parameters and are empty then the + is used when the "scaled" keyword is given in desired +font size or if desired font size does not lie in any declared +interval. You can use the "*" symbol in parameter---it +means the infinity. + +The command "\registertfm - - " +erases the previous registrations for a given . Moreover, it marks + as an unavailable font. OFS then acts, as if the corresponding +variant has not been declared at all. It gives us a possibility to mark +nonexisting variants of a declared family, but only for certain encodings +(see "cmssbxti" in the file "ofsdef.tex"). + +The parameters and are expanded during +the command "\registertfm" is working. Thus the "\fotenc" +macro should not be used in these parameters. But you can use an "\edef" +construction if necessary. + +The macro "\registerECfont"\inl[registerECfont] is an abbreviation +of the repeated execution of the command "\registertfm" to all EC fonts +sizes between "0500" up to "3583". +The macro "\registerECTTfont"\inl[registerECTTfont] is an abbreviation +for sizes "0800" do "3583", that are used for the typewriter fonts. +Definitions and usage of these macros are located in the file "ofsdef.tex". +Macros can be used for another fonts as well. But they have to have similarly +scaled sizes like EC fonts (LH fonts with Russian alphabet or the fonts +derived from CM~super). + +\subsec The limitations of usage the font family for certain encodings +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: The usage of a family in a given encoding is dependent on the +existence of "fd" file. It is all controlled by NFSS. + +\PLAIN (to the end of this section): +The OFS version Feb.~2004 introduces a command +"\registerenc"\inl[registerenc]. This command limits the usage of a declared font +family only for a certain encoding. If the user writes "\setfonts" and +requires the family in an unregistered encoding, the OFS prints out a +warning on the terminal and does not switch to the requested family. +It avoids an attempt to loading a nonexisting font metrics. The +command "\registerenc" has two parameters. + +\begtt +\registerenc : +\registerenc Times: 8t % example +\registerenc Times: 8z % Times is registered for two encodings +\endtt +% +If the family is not registered for any encoding, OFS then suggests, that +it is available in every encoding (dingbats fonts for example). + +The family usage is limited for a certain encoding by +"\registerenc" in declaration files. The user can add another +encoding by the command "\registerenc". The command +"\registerenc : * " means, that the family is available +for arbitrary encodings. + +The parameter can remain empty. In such case, +the "\registerenc" uses the family declared in the last +command "\ofsdeclarefamily". + +It is possible to find out, whether the family is registered +for actual value of the "\fotenc":\inl[registeredfam] + +\vbox \bgroup +\begtt +\registeredfam ? \iftrue + Family has the \fotenc registered or any encoding is enabled + or is not declared at all. + \else Family has registered the encoding, + but \fotenc is not among them + \fi +\endtt \egroup + +If "\setfonts[/]" is run for an undeclared family or for a family +with unavailable encoding then OFS prints out a warning on the terminal and +returns the "\setfontsOK"\inl[setfontsOK] with the value "\undefined". +The "\setfontsOK" has asigned the value "\relax", whenever the font is successfully +set. + + +\sec The license +%%%%%%%%%%%%%%%% + +The OFS package may be used by everybody without any license fees. +Everybody can re-distribute this package, if no changes in files +"readme.ofs", "ofs.tex", "ofsdef.tex", "ofs.sty", "ofs-8z.tex", +"ofs-8t.tex", "a35.tex", "a35.sty", "ofsdoc.tex", "ofsdoc-e.tex", +"ofsmtdef.tex" are done and +all these files are included in the re-distribution. Only +the author has a right to change these files and to change +version of this package. If you need to change the content of any +file mentioned above, you have to rename it. This package is +distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY. + +\bigskip +Prague 08/16/2001 \hfill the author: Petr Ol\v s\'ak +\bigskip + +\sec History +%%%%%%%%%%%% + +\noindent +8/16/2001 --- the first version introduced + +\noindent +10/24/2002 --- some petty changes realized in documentation, +considering the changes in the version OFS Oct.~2002. +The command "\addcmd" has been added. The optional +parameters "()" in the command "\loadtextfam" +were enabled. + +\bigskip +\noindent +12/29/2002: the English documentation in the file "ofsdoc-e.tex" is +written. This is more or less the translation of the Czech original +documentation from the file "ofsdoc.tex". Sorry for my poor English. + +I want to say a word of thanks to Mat\v ej Cepl (www.ceplovi.cz) +who has made a proofreading of this English version. + +\bigskip +\noindent +2/10/2004 --- All modifications consider only OFS for plain: + +\def\bod{\hangindent=1.2em \hangafter=1 \noindent + } + +\bod Handling the macro declarations dependent on encoding has been + improved as well as the exception declarations and registering of the + encoding for a chosen family. + See~\beglink{3.5}section~3.5\endlink{} and \beglink{3.9}section~3.9\endlink. + +\bod Added the possibility to redefine the family (by the additional loading + the declaring file, that modifies the properties of the default families). + +\bod Declaration of CMRoman, CMSans and CMTypewriter for 8t encoding + by means of EC fonts. + +\bod Added the support for extended encoding 8c. + +\bod Modified the declaration of the mathematical encoding called PS. + "\int", "\sum" and "\prod" produces greater characters + in the display mode. + +\bod Defined a macro "\ofshexbox" and "\ofshexboxdef". + +\bod A new version of the interactive macro "ofstest.tex". + +\bod Introduced the directory "\examples/". There will be continuously added + the exaples of OFS usage there. + +\noindent +3/12/2004 --- OFS for plain: + +\bod Encoding files are read directly from the "\loadtextfam". + That means the possibility to place the mapping metrics into the + encoding files by means of the command "\registerenc" + (I will use this ability for LANG). + +\bod "\characterdef" respects predefined macro an does not redefines it. + +\bod "\showfonts" reimplemented. It spares the memory and time, when + operates with the large font lists. Warning: if you have used macros, + that plays upon the internal macro "\listfamilies", this will not + operate any more. Since this version is not the obsolete "ofscatal.tex" + functional too. Instead of it is possible to use "ofstest.tex". + +\bod "ofstest.tex" modified. It operates with the newly imlemented list of + families "\ofslistfamilies". + +\noindent +4/2/2004 --- "\plaincatcodes" added before reading the files +"ofs-.tex". + +\bod "\safelet" and "\protectreading" introduced. + +\bod The space behind the in the "\accentdef" is optional. + +\bod Added the option "\loadmathfam [-/]". The + declaration for mathematical encodings "CM", "PS", "AMS", + "TX", "PX", "MT" has been extended and remade. + +\bod English documentation upgraded. Thaks to Tom\'a\v s Kom\'arek. + + +\sec Index of macros defined in OFS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +This index includes only the pointers to the pages where the macro is +introduced (not only mentioned). The macro name is written in the +margin on that place. The index is generated after first run of +\TeX{}. + +The internal or auxiliary macros in "ofs.tex" are listed here too +but they are not mentioned in the text, thus they have no pointer to +the page in this index. Only a short comment is appended here. The +version of OFS ({\smallbf PLAIN} or {\smallbf LATEX}) is listed near +the each macro name in this index. + +\bigskip +\immediate\closeout\indout +\input \jobname.ind + +\begingroup +\let\tt=\smalltt \let\it=\smallit \let\rm=\smallrm \rm +\baselineskip=10.3pt + +\def\inr #1 #2 #3;{\noindent{\tt + \expandafter \ifx \csname ind:#2\endcsname \relax + \back#1% + \else + \beglink{#2}\back#1\endlink + \fi}\quad + #3 \quad\pg[#2]\par} +\def\\#1 #2;{\inr #1 #1 #2;} +\def\pl{{\sevenrm (PLAIN)}} +\def\la{{\sevenrm (LATEX)}} +\def\oba{{\sevenrm (PLAIN+LATEX)}} + +\\accentabove \pl\vadjust{\nobreak}; +\par\nobreak +\\accentbelow \pl; +\\accentdef \pl; +\\accentdel \pl; +\\accentdefori \unskip, {\tt\back accentdelori} \pl~internal, + stores the default macro purport; +\\accentnodef \pl~internal, {\tt\back def\back \#1% + \char`\{\back printaccent\char`\{\char`\}\char`\{\#1\char`\}\char`\}}; +\\addcmd \oba; +\inr bf rm \oba; +\inr bi rm \oba; +\\bifam \pl~internal, math family for BoldItalic; +\\calculatemetricfile \pl~internal, defines {\tt\back metricfile} + by fontsize; +\\catcodesloop \pl~internal, sets the character categ. according to a given num.; +\\characterdef \pl; +\\characterdel \pl; +\\characterdefori \unskip, {\tt\back characterdelori} \pl~internal, + stores default macro purport; +\\characternodef \pl~internal, {\tt\back def\back % + \char`\{\back printcharacter\char`\{\char`\}\char`\}}; +\\currentfamily \pl; +\\currentfomenc \pl~internal, the name of last used math. encoding; +\\currentvariant \pl; +\\declaredfamily \pl~internal, contains the name of the last declared family; +\\defaultextraenc \pl; +\\defaultmathchars \pl; +\\defaultmathfonts \pl; +\\defpttotmpa \pl~internal, does {\tt\back def\back tmpa\char`\{pt\char`\}}, + if the unit is omited; +\\detailfontmessages \pl; +\\displayfontmessages \pl; +\\displaymessage \pl~internal; +\\docharacterdef \pl~internal, for use of {\tt\back characterdef} macro; +\\doextchar \pl~internal, for use of {\tt\back extchar} macro; +\\dosafemathdef \pl~internal, for use of {\tt\back safemath*def} macros; +\\donumbercharacterdef \pl~internal, for use of {\tt\back characterdef} macro; +\\endOFSmacro \pl~internal, the reading of {\tt[, ...]} + after {\tt\back input ofs}; +\\expandaction \pl; +\\extchar \oba; +\\extraenc \pl; +\\extrafont \pl; +\\fontdef \oba; +\\fontloadmessage \pl~internal, the tracing of {\tt\back font} primitives; +\\fontmessage \pl~internal, three values: nothing, + {\tt\back wlog} or {\tt\back displaymessage}; +\\fontprefix \pl~internal, two values: nothing or {\tt\back global}; +\\fontusage \oba; +\\fosize \pl; +\\fomenc \pl; +\\fotenc \pl; +\\fragilecommand \pl; +\\fragilecommand! \pl; +\\hex \pl; +\\ifknownfam \oba; +\\isunitpresent \pl~internal, solves the case of empty unit; +\inr it rm \oba; +\\knownchar pl; +\\knownfam pl; +\\lastfam pl; +\\lccodes \unskip, {\tt\back lccodesloop} \pl; +\\loadCMboldmath \pl; +\\loadCMnormalmath \pl; +\\loadingenc \pl; +\\loadmathfam \pl; +\\loadPSboldmath \pl; +\\loadPSnormalmath \pl; +\\loadtextfam \pl; +\\logfontmessages \pl; +\\mathaccentdef \pl; +\\mathchars \pl; +\\mathcharsback \pl; +\\mathencdef \pl; +\\mathencread \pl; +\\mathfonts \pl; +\\mathversion \pl; +\\metricfile \pl~internal, the metric name if {\tt\back font} +primitive is used; +\\metrictmpa \pl~internal, expands to the metric of {\tt\back tmpa} font; +\\modifydef \pl; +\\modifyenc \pl; +\\modifylist \pl; +\\modifyread \pl; +\\newfamily \pl~auxiliary, the given family name; +\\newmathfam \pl; +\\newmodifylist \pl; +\\newvariant \pl; +\\nofontmessages \pl; +\\noindexsize \pl; +\\noPT \pl~internal, removes {\tt pt} from~{\tt\back the} [TBN, pg.~80]; +\\ofsaddenctolist \pl~internal, adds parameter into the list {\tt\back newmodifylist}; +\\OFSdeclarefamily \la; +\\ofsdeclarefamily \pl; +\\OFSextraencoding \la; +\\OFSfamily \la; +\\OFSfamilydefault \la; +\\ofshexbox \pl; +\\ofshexboxdef \pl; +\\ofsinput \pl~internal, reads file with {\tt\back globaldefs=1}, ignores endlinechars; +\\ofslistfamilies \pl~internal, family list for {\tt\back showfonts}; +\\ofslistfamily \pl~internal, envokes the family in {\tt\back listfamilies}; +\\ofslistvariants \pl~internal, text for listing of variants to the log; +\\ofslisttext \pl~interní, envokes the text in {\tt\back listfamilies}; +\\ofsloadfont \pl~internal, loads one font; +\\ofsloadfontori \pl~internal, loads one font; +\\ofsmeaning \pl~internal, removes the word {\tt letter}/{\tt character} + from {\tt \back meaning}; +\\ofsmessageheader \pl~internal, header of the messages; +\\OFSnormalvariants \la; +\\OFSprocessoptions \la; +\\OFSputfamlist \la; +\\ofsputfamlist \pl; +\\ofsremovefromlist \pl~internal, erases the family from the list; +\\OFSversion \oba~internal, date and version of OFS; +\\orifosize \pl~auxiliary, saves {\tt\back fosize} value; +\\origTeX \pl~internal, original definition of \TeX{} logo; +\\oriloadfam \pl~auxiliary, saves {\tt loadtextfam} value; +\\pickmathfont \pl; +\\plaincatcodes \pl~internal, sets the chars categories according to plain\TeX{}; +\\printaccent \pl; +\\printaccentwarn \pl; +\\printcharacter \pl; +\\printcharacterwarn \pl; +\\processOFSoption \pl~internal, for use of {\back endOFSmacro}; +\\protectreading \pl; +\\readfamvariant \pl~internal, checks if the variant is given; +\\readfirsttoken \pl~internal, returns the first token of text separed +by {\tt:\back end}; +\\readfosize \pl~internal, inserts the {\tt\back fosize} value to + {\tt\back dimen0}; +\\readmag \pl~internal, calculates {\tt\back fosize} if + {\tt mag} is given; +\\readOFSoptions \pl~internal, for use of {\tt\back endOFSmacro}; +\\readothertokens \pl~internal, returns the second and other tokens to +{\tt:\back end}; +\\readsixdigits \pl~internal, for rounding algorithm; +\\registeredfam \pl; +\\registerECfont \pl; +\\registerECTTfont \pl; +\\registerenc \pl; +\\registertfm \pl; +\\restorefontid \pl~internal, restores font name, see {\tt\back savefontid}; +\\rm \oba; +\\runmodifylist \pl; +\\safelet \pl; +\\safeletwarn \pl; +\\safemathaccentdef \pl; +\\safemathchardef \pl; +\\savefontid \pl~internal, saves font name for Overfull messages; +\\savetokenname \pl~internal, similar to {\tt\back string} without backslash; +\\scriptfosize \pl; +\\scriptscriptfosize \pl; +\\separeofsvariant \pl~internal, separes the "()" in {\tt\back loadtextfam}; +\\setextrafont \oba; +\\setCMmathchars \pl; +\\setfonts \oba; +\\setfontshook \pl; +\\setfontsOK \pl; +\\setfontfamily \pl~internal, {\tt\back setfonts}, + if variant is not given; +\\setfosize \pl~internal, calculate the value of {\tt\back fosize}; +\\setmath \pl; +\\setPSmathchars \pl; +\\setsimplemath \pl; +\\setsinglefont \pl~internal, {\tt\back setfonts}, + if the variant is given; +\\setsinglefontname \pl~internal, removes the possible "at" from ; +\\sgfamily \pl~internal, the information about the family name; +\\sgvariant \pl~internal, the information about the variant; +\\showfonts \oba; +\\singlefont \pl~internal; +\\singlefontname \pl~internal, removes the {\tt at} from metric name; +\\skipfirststep \pl; +\\slantcorrection \pl~internal, for use of + {\tt\back accentabove} and {\tt\back accentbelow}; +\\storeofsvariant \pl~internal, separes optional parameter of {\tt\back loadtextfam}; +\\switchdeftodel \pl~internal, switches {\tt\back accent/characterdef} + with~{\tt\back *del}; +\\tenbi \pl; +\inr tenbf tenrm \pl; +\inr tenit tenrm \pl; +\\tenrm \pl; +\\testOFSoptions \pl~internal, for use of {\tt\back endOFSmacro}; +\\testtfmsize \pl~internal, for use of {\tt\back registertfm} macro; +\\testtfmsizeat \pl~internal, the auxiliary value of {\tt\back testtfmsize}; +\\testtfmsizescaled \pl~internal, the auxiliary value of {\tt\back testtfmsize}; +\\textfosize \pl; +\\tryloadenc \pl~internal, loads encoding files; +\\tmpa \oba~temporary; +\\tmpb \oba~temporary; +\\tmpc \pl~temporary; +\\warnmissingfont \pl~internal, message about missing variant; +\\warnM \unskip, {\tt\back warnF}, {\tt\back warnT}, {\tt\back warnI}, +\pl~internal, message about missing variant; +\\warnunregistered \pl~internal, print out, disabled encoding of a chosen family; + +\endgroup + +\sec References +%%%%%%%%%%%%%%% + +\noindent \hangindent=2\parindent +[TBN] Petr Ol\v s\'ak {\it \TeX{}book naruby}, Konvoj +1.~ed. 1997 (ISBN 80-7302-007-6), +2.~ed. 2001 (ISBN 80-85615-64-9), Brno, 466 pages. +Czech language. +PDF version of this book is free available on +{\tt http://math.feld.cvut.cz/olsak/tbn.html}. + + +\end + + + + + + + + + + diff --git a/macros/generic/ofs/doc/ofsdoc.pdf b/macros/generic/ofs/doc/ofsdoc.pdf new file mode 100644 index 0000000000..f6707b23b8 Binary files /dev/null and b/macros/generic/ofs/doc/ofsdoc.pdf differ diff --git a/macros/generic/ofs/doc/ofsdoc.tex b/macros/generic/ofs/doc/ofsdoc.tex new file mode 100644 index 0000000000..6d6fe9e42b --- /dev/null +++ b/macros/generic/ofs/doc/ofsdoc.tex @@ -0,0 +1,2402 @@ +% A documentation for OFS package +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% July 2001 Petr Olsak +% February 2004 + +% See the ofsdoce.tex for English version of this documentation + +\chyph % použijte csplain + +\headline={\llap{\tt May 2004}\hfil See the ofsdoc-e.tex for English version + of this documentation.\global\headline={\hfil}} + +\magnification\magstephalf + +\hoffset=4pc +\voffset=1pc +\hsize=31.6pc +\vsize=49pc +\raggedbottom +\parindent=15pt +\emergencystretch=2em + +\font\smallbf=csb10 at7pt +\font\smalltt=cstt8 +\font\smallit=csti8 +\font\smallrm=csr8 +\font\titulfont=\fontname\tenbf\space scaled\magstep4 +\font\bigbf=\fontname\tenbf\space scaled\magstep1 + +\def\Red{} +\def\Black{} +\def\Blue{} +\def\Green{} +\def\beglink#1{} +\def\endlink{} +\def\aimlink#1{} + +\ifx\pdfoutput\undefined\else %%%% pdfTeX is used %%%%%%%%%% +\ifnum\pdfoutput>0 + +\ifx \pdfstartlink\undefined %%% PDFTeX version <= 13 + \let\pdfstartlink=\pdfannotlink +\fi + +\def\beglink#1{% % Začátek textu odkazu, #1 je klíč odkazu + \Green \pdfstartlink height9pt depth3pt + attr{/Border[0 0 0]} goto name{#1}\relax} +\def\endlink{\pdfendlink\Black} + +\def\aimlink#1{% % Místo cíle odkazu, #1 je klíč odkazu + \expandafter\ifx \csname aim:#1\endcsname \relax + \expandafter\gdef \csname aim:#1\endcsname {}% + \vbox to0pt{\vss\hbox{\pdfdest name{#1} fith}\kern15pt}% + \fi +} +\def\pdfsetcmykcolor#1{\special{PDF:#1 k}} +\def\Red{\leavevmode\pdfsetcmykcolor{0.1 0.9 0.9 0}} +\def\Black{\leavevmode\pdfsetcmykcolor{0 0 0 1}} +\def\Green{\leavevmode\pdfsetcmykcolor{0.9 0.1 0.9 .3}} +\def\Blue{\leavevmode\pdfsetcmykcolor{0.9 0.9 0.1 0}} + +\pdfcompresslevel=9 +\pdfinfo{/Author (Petr Olsak) + /CreationDate (July 2001) + /ModDate (March 2004) + /Creator (TeX) + /Producer (pdfTeX) + /Title (OFS: Olsak's Font System) + /Subject (Documentation) + /Keywords (TeX, fonts) +} + +\fi\fi %%%%%%%%%%%%%%%%%%%%%%%%%%%% End of pdfTeX macros %%%%% + + +\def\PLAIN #1:{{\smallbf \Red PLAIN\Black\if|#1|\else\space#1\fi}:} +\def\LATEX #1:{{\smallbf \Red LATEX\Black \if|#1|\else\space#1\fi}:} +\def\OBA #1:{{\smallbf \Red PLAIN+LATEX\Black \if|#1|\else\space#1\fi}:} + +\newcount\secnum \newcount\subsecnum + +\def\sec #1\par{\ifnum\secnum>0 \goodbreak\fi\removelastskip + \vskip2\baselineskip + \subsecnum=0 \advance\secnum by1 + \noindent{\bigbf\llap{\the\secnum.\quad}#1}\par\nobreak\medskip} +\def\subsec #1\par{\removelastskip\bigskip + \advance\subsecnum by1 + \noindent{\bf \llap{\aimlink{\the\secnum.\the\subsecnum}% + \the\secnum.\the\subsecnum.\quad}#1}\par\nobreak\medskip} +\def\title #1\par{\vglue2\baselineskip + \centerline{\titulfont #1}\vskip2\baselineskip} + +\def\LaTeX{La\TeX} + +\catcode`<=13 +\def<#1>{\hbox{$\langle$\it#1\/$\rangle$}} +\def\,{\thinspace} + +{\obeyspaces \gdef\activespace{\obeyspaces\let =\ }} +\def\setverb{\def\do##1{\catcode`##1=12}\dospecials} +\def\begtt{\medskip\bgroup \setverb \catcode`@=0 \activespace + \parindent=0pt \catcode`\"=12 + \def\par##1{\endgraf\ifx##1\par\leavevmode\fi ##1} + \obeylines \startverb} +{\catcode`\|=0 \catcode`\\=12 +|gdef|startverb#1\endtt{|tt#1|egroup|medskip|testpar}} +\long\def\testpar#1{\ifx\par#1\else\noindent\fi#1} + +\catcode`"=13 +\def"{\hbox\bgroup\setverb\activespace\tt\readverb} +\def\readverb #1"{#1\egroup} + +\def\begitems{\medskip\bgroup \catcode`*=13 } +{\catcode`*=13 \gdef*{\item{$\bullet$}}} +\def\enditems{\medskip\egroup} + +\newwrite\indout +\immediate\openout\indout=\jobname.ind +\def\inl[#1]{\strut + \write\indout{\noexpand\indexentry{#1}{\the\pageno}}% + \vadjust{\vbox to0pt{\vss + \hbox to\hsize{\llap{{\aimlink{#1}\smalltt\Blue\char`\\ #1% + \ifx\extratext\empty\else\space\extratext\fi\Black}% + \kern2pt\quad}\strut\hfil}% + \hrule height0pt}}\def\extratext{}} +\def\inll[#1 #2]{\def\extratext{#2}\inl[#1]} +\def\indexentry #1#2{\expandafter \ifx \csname ind:#1\endcsname \relax + \expandafter \def \csname ind:#1\endcsname {#2}% + \else + \expandafter \edef \csname ind:#1\endcsname {% + \csname ind:#1\endcsname, #2}% + \fi +} +\def\pg[#1]{\csname ind:#1\endcsname} + +\chardef\back=`\\ + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\title OFS: Olšákův fontový systém +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +OFS je makro, které umožní přehledně +v~\TeX{}u vybírat rodiny fontů, jejichž názvy jsou v~souladu s~názvy +z~písmového katalogu. Toto makro je z~uživatelského +pohledu stejné v~plainu i \LaTeX{}u. Výklad použití OFS bude tedy +společný pro obě skupiny uživatelů. Pokud některý text platí jen +pro csplain (a podobné formáty), bude uveden slovem \PLAIN: a pokud +je text určen pro uživatele \LaTeX{}u2e, je uveden slovem \LATEX:. + +Pod skupinu \PLAIN: patří nejen csplain, plain a odvozené formáty, ale +též dnes už nepoužívaný \LaTeX2.09 bez NFSS. Pod skupinu \LATEX: bychom +mohli zařadit všechny formáty, které pracují s~NFSS~2, především tedy +\LaTeX 2e. + +Po zavedení příslušných maker v~záhlaví dokumentu (viz níže) se na +terminálu mimo jiné objeví: + +\begtt +@PLAIN: OFS (Olsak's Font System) based on plain initialized. @char` +@LATEX: OFS (Olsak's Font System) based on NFSS initialized. @char` +\endtt +Výhody OFS: + +\begitems +* Sjednocuje rozhraní pro uživatele \LaTeX{}u i plainu. +* Pomocí příkazu "\fontusage" dostaneme na terminál a do logu stručnou + informaci o~použití maker z~OFS. +* Umožňuje pracovat se skutečnými názvy písmových rodin tak, + jak jsou uvedeny v~písmovém katalogu a tím + nenutí uživatele si kromě těchto názvů pamatovat ještě + interní zkratky použité v~NFSS nebo v~názvech metrik fontů. +* Umožní pracovat s~fontem rozloženým do dvou metrik + (základní a rozšiřující) jakoby se jednalo o~jediný font. +* Umožní na začátku dokumentu vybrat oblíbené kódování základní + metriky, jsou-li metriky připraveny v~různých kódováních + (typicky kódování IL2 a T1). +* Definuje rozhraní pro vytváření pomocných souborů, které + obsahují konverzní informace mezi \uv{dlouhými názvy} fontů + z~katalogu a \PLAIN: názvy metrik + nebo \LATEX: zkratkami používanými v~NFSS. +* \PLAIN: Umožňuje podobnou nezávislost výběru jednotlivých + parametů fontů, jako NFSS v~\LaTeX{}u. +* \PLAIN: Definuje deklarační příkazy pro podchycení kódování fontů. +* \PLAIN: Je možné pro různé velikosti registrovat různé metriky, což + využijeme zejména u~rodiny Computer Modern. +* \PLAIN: Obsahuje nástroje na použití PostScriptových fontů + i v~matematické sazbě. +* Interaktivní makro "ofstest.tex" umožní tisknout vzorky odstavců ve + zvolených písmových rodinách, tisknout tabulky fontů, katalogy fontů, + vzorky matematické sazby a seznamy znaků ve fontech včetně jejich + \TeX{}ových sekvencí. Stačí napsat na příkazový řádek + "tex ofstest [allfonts]" nebo "csplain ofstest [allfonts]" + a řídit se pokyny na terminálu. +\enditems + + +\sec Členění písmových rodin +%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Makro OFS vychází z~toho, že většina dnes dodávaných písmových rodin +obsahuje čtyři řezy: základní ("\rm"), tučný ("\bf"), kurzívu ("\it"), +a tučnou kurzívu ("\bi")\inll[rm \back bf \back it \back bi]. +Těmto řezům budeme říkat \uv{standardní varianty}. +Po zavedení rodiny příkazem "\setfonts" (viz níže) lze pak +přepínat pomocí "\rm", "\bf", "\it" a "\bi" mezi variantami v~dané +rodině. První tři uvedené přepínače jsou známé z~plainu +(v~\LaTeX{}u přetrvávají z~dob zašlé slávy LaTeXu2.09) +a čtvrtý přepíná do varianty BoldItalic. + +Některé rodiny mohou deklarovat přepínače dalších +\uv{nadstandardních variant} a u~některých rodin naopak +může chybět i některá ze standardních variant. + +Varianty v~některých rodinách se mírně liší od zde uvedených +názvů pro standardní varianty. Místo tučného písma může být +třeba přítomno jen polotučné a místo kurzívy třeba skloněné písmo. +Přepínače "\rm", "\bf", "\it" a "\bi" zůstávají pokud možno +zachovány, takže by nás nemělo vyvést z~rovnováhy, že v~některé rodině +třeba "\it" přepíná do skloněného písma a ne do kurzívy. + +Pokud chceme současně pracovat s~dalšími přepínači fontů jiné rodiny +(například "\tt" pro strojopis), je možné takové přepínače deklarovat pomocí +příkazu "\fontdef". + +Členění fontů do rodin je deklarováno v~souborech, které +mají v~plainu podobný význam, jako {\tt fd} (Font Definition) soubory +z~\LaTeX{}u. Doporučená přípona souboru je pro plain {\tt tex} a +pro \LaTeX{} {\tt sty}. Těmto souborům budeme říkat \uv{deklarační soubory}. +Podle názvu deklaračních souborů by mělo být uživateli zřejmé, které rodiny +jsou v~něm deklarovány. Příklady: + +\begtt +@PLAIN: @LATEX: +sjannon.tex, sjannon.sty ... souhrnná rodina Jannon ze Střešovic +a35.tex, a35.sty ... základní skupina 35 fontů od Adobe +\endtt + +Vidíme, že deklarační soubory (na rozdíl od {\tt fd} souborů z~\LaTeX{}u) +obsahují obvykle definice více souvisejících rodin. Mezi těmito +soubory uživatel vybírá ty, které bude potřebovat a uvede jejich jména +při zavedení makra OFS v~záhlaví svého dokumentu. +Aby měl uživatel zjednodušenou práci, zakládáme obvykle též souhrné +soubory, které obsahují "\input" nebo "\RequirePackage" na jednotlivé +deklarační soubory: + +\begtt +skatalog.tex, skatalog.sty ... všechny fonty ze Střešovic +allfonts.tex, allfonts.sty ... všechny fonty na TeXové instalaci +\endtt + + +\sec Uživatelské příkazy +%%%%%%%%%%%%%%%%%%%%%%%% + +\subsec Zavedení OFS +%%%%%%%%%%%%%%%%%%%% + +Pro příklad předpokládejme, že budeme chtít pracovat +s~fonty ze souhrnné rodiny Jannon a +DynaGrotesk. Protože se jedná o~rodiny ze Střešovické písmolijny od pana +Štorma, najdeme odpovídající deklarační soubory v~adresáři +"storm". Na Internetu je získáme společně s~makrem OFS +například na "www.cstug.cz/stormtype". +Souhrnné rodiny Jannon a Dyna\-Grotesk jsou deklarovány v~těchto souborech: +\PLAIN: "sjannon.tex", "sdynamo.tex"; +\LATEX: "sjannon.sty", "sdynamo.sty". +Písmeno "s" na začátku názvů znamená, +že fonty pocházejí ze Střešovické písmolijny. Jména těchto souborů bez +přípony je nutné uvést v~hranaté závorce při zavedení makra OFS takto: + +\begtt +@PLAIN: \input ofs [sjannon, sdynamo] % mezera před "[" je nutná! +@LATEX: \usepackage [sjannon, sdynamo] {ofs} +\endtt + +Dále můžeme pracovat s~rodinami, které jsou obsaženy v~souhrnných +rodinách Jannon a DynaGrotesk. +Napíšeme-li do dokumentu příkaz "\showfonts"\inl[showfonts], +zobrazí se na \hbox{terminál} (a~zapíše do logu) seznam názvů jednotlivých +rodin, které dále můžeme používat. Po zavedení "sjannon" a +"sdynamo", jak bylo uvedeno výše, zobrazí příkaz "\showfonts" tento seznam: + +\begtt +OFS (l.1): The list of known font families: +defaults: + [CMRoman/] \rm, \bf, \it, \bi, \sl + [CMSans/] \rm, \bf, \it, - + [CMTypewriter/] \rm, - , \it, - , \sl + [Times/] \rm, \bf, \it, \bi + [Helvetica/] \rm, \bf, \it, \bi, \nrm, \nbf, \nit, \nbi + [Courier/] \rm, \bf, \it, \bi +sjannon.tex: + [JannonAntikva/] \rm, \bf, \it, \bi, \mr, \mi + [JannonText/] \rm, \bf, \it, \bi, \mr, \mi + [JannonCaps/] \rm, \bf, \it, \bi +sdynamo.tex: + [DynaGroteskDXE/] \rm, \bf, \it, \bi + [DynaGroteskRXE/] \rm, \bf, \it, \bi + [DynaGroteskLXE/] \rm, \bf, \it, \bi + ... ... +\endtt + +Prvních 6 rodin (označené jako defaults) je definováno v~OFS. +Teprve další rodiny jsou deklarovány v~použitých souborech. + +Vedle názvů rodin jsou uvedeny přepínače variant, které pro danou +rodinu můžeme použít. První čtyři přepínače jsou pro standardní +varianty a pokud v~některé rodině taková varianta není přístupná, +je zde na místě odpovídajícího přepínače pomlčka. +Pátý a případně další přepínače se vztahují k~případným nadstandardním +variantám. Zde například rodina Helvetica má navíc přepínače +pro varianty \uv{Narrow} a rodiny Jannon mají přepínače pro +varianty \uv{Medium}. + +Napíšeme-li do dokumentu příkaz "\fontusage"\inl[fontusage], +zobrazí se na terminál a +do logu stručná informace o~použití příkazů z~balíku OFS. + +Kromě výše uvedeného způsobu zavedení: + +\begtt +@PLAIN: \input ofs [, , ...] +@LATEX: \usepackage [, , ...] {ofs} +\endtt +% +existuje ještě možnost přímo zavést požadované soubory. Pak není nutné +v~dokumentu explicitně zavádět soubor "ofs.tex" resp. "ofs.sty": + +\begtt +@PLAIN: \input \input ... +@LATEX: \usepackage {} \usepackage {} ... +\endtt +% +Příklad: + +\begtt +@PLAIN: \input sjannon \input sdynamo +@LATEX: \usepackage {sjannon} \usepackage {sdynamo} +\endtt +% +Nedoporučuje se (zvláště v~\LaTeX{}u) oba tyto způsoby zavedení +makra OFS míchat. + + +\subsec Příkaz {\tt\back setfonts} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +V~dalších příkladech předpokládáme,\inl[setfonts] +že jsme zavedli pouze potřebné +rodiny, například ze souborů {\tt sjannon} a {\tt sdynamo}. +Nyní třeba po použití příkazu + +\begtt +\setfonts [JannonText/12pt] +\endtt +% +lze přepínat do jednotlivých variant této rodiny JannonText ve +velikosti 12pt. Je možné použít přepínače +"\rm", "\bf", "\it", a "\bi" a speciálně pro tuto +rodinu ještě "\mr" a "\mi". + +Příkaz "\setfonts [/]" +přepíná do nové rodiny a ctí +naposledy zapnutou variantu. +Pokud před tímto příkazem +byla zapnutá třeba varianta BoldItalic, pak po tomto příkazu zůstává +zapnutá tato varianta i v~nové rodině. +Pokud v nové rodině naposledy zapnutá +varianta neexistuje, přepíná se do "\rm". Tato varianta musí být +deklarována v~každé rodině. + +Příkaz "\setfonts" vymezuje všechny změny pouze +lokálně. Po ukončení skupiny se sazba vrací k~rodině a variantě, která +byla aktuální při zahájení skupiny. + +Parametry příkazu "\setfonts" mohou být prázdné: +"\setfonts [/]" přepne do nové +rodiny a ctí naposledy nastavenou velikost a +"\setfonts [/]" nastaví novou velikost +a ponechá aktuálně vybranou rodinu. Po inicializaci OFS je (pro +případ použití prázdného parametru) defaultně nastavena rodina +"CMRoman" a velikost 10\,pt. Příkaz "\setfonts [/]" +je syntakticky korektní, ale neudělá kromě zápisu +do logu vůbec nic. + +Parametr , je-li uveden, musí přesně odpovídat jménu +rodiny podle seznamu známých rodin (viz nahoře příkaz "\showfonts"). +Je třeba dodržovat malá a velká písmena a celé jméno psát bez mezer. +Pokud se tento parametr neshoduje s~žádnou známou rodinou, vypíše \TeX{} +varování a připojí seznam všech známých rodin. Takže například +"\setfonts [?/]" lze použít se stejným efektem, +jako příkaz "\showfonts". + +\LATEX: může být nejen jméno podle seznamu známých rodin +(dlouhý název), ale je dovoleno použít i zkratku z~NFSS. Takže +například "\setfonts [Times/]" a "\setfonts [ptm/]" je v~\LaTeX{}u totéž. + +\OBA: +Parametr má tyto možnosti: + +\begitems +* <číslo> .... např. "12", "17.4", +* <číslo> .... např. "12pt", "17.4pt", "10dd", +* "at"<číslo> .... např. "at12pt", "at17.4pt", "at10dd", +* "scaled" .... např. "scaled1200", "scaled\magstep3", +* "mag" .... např. "mag1.2", "mag.7", "mag2.0". +\enditems + +První tři možnosti se významově shodují. Klíčové slovo "at" je +nepovinné a není-li uvedeno ani "at" ani jednotka, doplní se +automaticky "at<číslo>pt". Font se zavede přesně v~požadované +velikosti. Samozřejmě při globálním "\magnification" celého dokumentu +se jedná o~relativní a nikoli absolutní rozměry, pokud nepoužijeme +jednotku uvozenou slovem "true" (např. "17truept"). +Jestliže píšeme klíčové slovo "at", nesmíme vynechat jednotku. +Nesprávně: "at12", správně: "at12pt" nebo jenom "12". + +Čtvrtá možnost ("scaled") je shodná s~použitím slova "scaled" při zavádění +fontu pomocí primitivu "\font". Např. "scaled1200" je font, jehož základní +velikost je pronásobena koeficientem 1,2. Je-li základní velikost +fontu 10\,pt (což je obvyklé), pak je "scaled1200" shodné s~"at12pt". + +Poslední možnost ("mag") pronásobí aktuální velikost fontů daným +koeficientem. Na rozdíl od "scaled" se tedy vztahuje k~aktuální +velikosti a nikoli k~základní velikosti fontu. Je-li nejprve použito +třeba "\setfonts[/12]" a v~zápětí "\setfonts[/mag2.]", rodina fontů +bude nyní sázena ve velikosti 24\,pt. Příklad: + +\begtt +\def\small{\setfonts[/mag.7]} +Text {\small je menší \small a menší \small a ještě menší} a tady je +zase v normální velikosti. +\endtt + +Upozornění: Změna velikosti fontů pomocí "\setfonts" nijak nemění +vzdálenost účaří ("\baselineskip"). To si musí uživatel nastavit sám. + +Pomocí "\setfonts" můžeme nastavit nejen celou rodinu (to ovlivní +přepínače variant "\rm", "\bf", "\it", "\bi" a případně další), ale také +jen zvolenou variantu v~dané rodině. V~takovém případě +"\setfonts" nemění význam přepínačů variant ani aktuální +velikost ostatních fontů. Při specifikaci varianty je nutno +v~parametru "\setfonts" za název rodiny napsat znak mínus následovaný +zkratkou pro variantu. Příklady: + +\begtt +\setfonts [JannonText-it/12] ..... nastaví kurzívu dané rodiny ve + velikosti 12pt +\setfonts [JannonText-rm/] ....... nastaví základní řez dané rodiny + v aktuální velikosti. +\setfonts [CMTypeWriter-sl/] ..... nastaví základní variantu \sl + v aktuální velikosti. +\endtt + +I~při specifikaci varianty je možné v~parametru vynechat název rodiny, +pak se použije aktuální rodina. Například + +\begtt +\setfonts [JannonText/12] +\setfonts [-bf/17] ... varinata Bold JannonText, velikost 17pt. + Přepínače \rm, \bf, \it a \bi zůstanou + nezměněny, v tomto příkladě přepínají + JannonText ve velikosti 12pt. + Následné použití třeba \setfonts [Times/] + nastaví rodinu Times ve velikosti 12pt. +ALE: +\setfonts [/17]\bf ... Varinata Bold aktuální rodiny, velikost 17pt. + Přepínače \rm, \bf, \it a \bi nyní + přepínají ve velikosti 17pt. Aktuální + velikost fontů je nyní 17pt. +\endtt + +\LATEX: Co zde bylo řečeno o~ponechání významu přepínačů variant +při specifikování varianty v~\LaTeX{}u není pravda, +protože by to narušilo logiku NFSS. +V~\LaTeX{}u tedy je "\setfonts [-bf/17]" zcela shodné +s~příkazy "\setfonts [/17]\bf". + + +\subsec Příkazy {\tt\back fontdef} a {\tt\back addcmd} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Příkaz "\fontdef"\inl[fontdef] umožňuje deklarovat nové fontové přepínače. + +\begtt +\fontdef \ [/] +\endtt +% +Tato deklarace se zhruba shoduje s{} + +\begtt +\gdef \ {\setfonts [/]} +\endtt + +\PLAIN: Pokud je specifikována rodina včetně varianty a +parametr není prázdný ani není zadán pomocí klíčového slova +"mag", pak "\" není implementován jako makro obsahující +"\setfonts", ale jedná se o nativní přepínač fontu implementovaný +pomocí "\global\font\" (tzv.~fixed font). +Tak může uživatel deklarovat vlastní nativní přepínač +fontu bez znalosti názvu metriky. + +\LATEX: Deklarovaný přepínač je ve všech případech implementován jako +makro obsahující "\setfonts". Přístup k~nativním přepínačům je před +uživatelem v~NFSS skryt. + +\OBA: +Místo jména rodiny může být uveden vykřičník. +Pak se doplní jméno rodiny aktuální v~místě příkazu +"\fontdef". Na druhé straně, pokud je jméno rodiny prázdné, +pak se jméno rodiny doplní podle aktuální rodiny +v~místě použití deklarovaného přepínače. Analogická vlastnost platí +pro parametr . Příklady: + +\begtt +\setfonts [JannonAntikva/] +\fontdef \small [/7] % \small = \setfonts [/7pt] +\fontdef \sffam [DynaGroteskR/] % \sffam = \setfonts [DynagroteskR/] +\fontdef \velky [Times/17] % \velky = \setfonts [Times/17pt] +\fontdef \ttfam [Courier/] % \ttfam = \setfonts [Courier/] +\fontdef \mylogo [Times-rm/mag.8] % \mylogo = \setfonts [Times-rm/mag.8] + % velikost fontu bude vždy rovna + % 0.8 násobku aktuální velikosti. +\fontdef \timbf [Times-bf/12] % \timbf = fixed-font přepínač, jako: + % \global\font\timbf=ptmb8z at12pt +\fontdef \jansmall [!/7] % \jansmall=\setfonts[JannonAntikva/7] +\fontdef \janbi [!-bi/17] % \janbi = fixed-font přepínač, jako: + % \global\font\janbi=sjnbi8z at17pt +\fontdef \tt [Courier-rm/!] % \tt = fixed-font přepínač, jako + % \global\font\tt=pcrr8u at10pt +\endtt + +Příkaz "\fontdef" deklaruje přepínač globálně, ovšem tento přepínač je +sám o~sobě lokální. Jinými slovy "\global\fontdef\jmeno" je totéž jako +"\fontdef\jmeno", ale přepínač "\jmeno" nastaví font (nebo celou +rodinu) jen lokálně. + +Od verze OFS Oct.~2002 je podporován příkaz +"\addcmd"\inl[addcmd], který umožní společně s~příkazem "\fontdef" +soustředit problematiku fontů do jediného místa v souboru maker. +Příkaz má formát: + +\begtt +\addcmd \ {} +\endtt +% +a chová se, jako "\def\ { }". +Pomocí "\addcmd" tedy můžeme \uv{rozšířit} obsah makra "\" +o~další příkazy. Sekvence "\" musí být (před použitím +"\addcmd") definována jako makro bez parametrů nebo musí být +ve významu neexpandované kontrolní sekvence deklarované například +pomocí "\font", "\chardef" apod. Po použití "\addcmd" je sekvence +"\" definována vždy jako makro bez parametru. Opakované +použití "\addcmd" na stejný "\" je možné. + +Příklad použití: + +\begtt +\setfonts [JannonText/] +\fontdef \footnotefont [!/7] +\addcmd \footnotefont {\rm \baselineskip=9pt \relax} +\fontdef \sectionfont [!/12] +\addcmd \sectionfont {\bf \let\it=\bi} +\endtt + + +\subsec Test přítomnosti rodiny +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\PLAIN: Ve svých makrech můžeme testovat, zda je rodina fontů deklarovaná, +tj.~zda je načtena její deklarace z~deklaračního souboru. Použijeme +k~tomu konstrukci "\knownfam ? \iftrue", která expanduje +na "\iftrue", pokud je rodina deklarovaná a na "\iffalse", pokud +deklarovaná není. Parametr musíme uvést bez specifikace varianty. + +\OBA: Z důvodů zpětné kompatibility se starší verzí OFS~dělá stejnou práci jako +"\knownchar" makro "\ifknownfam []"\inl[ifknownfam]. +V~OFS pro plain se ale +od verze Feb.~2004 doporučuje používat "\knownfam", protože to udržuje +správně spárované primitivy "\if*", "\else", "\fi". La\TeX{}ový uživatel +si může "\knownfam" snadno definovat. + +\subsec \LATEX: Propojení OSF s~NFSS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Tato sekce je určena pouze pro \LaTeX{}isty. Příkaz\inl[OFSfamily] + +\begtt +\OFSfamily [] +\endtt +% +konvertuje dlouhý název rodiny podle katalogu na interní název rodiny +zanesený do NFSS. Například + +\begtt +\OFSfamily [JannonText] +\endtt +% +expanduje na "sjng". Makro pracuje jen na úrovni expandprocesoru, +proto nedostaneme při překlepu v~názvu rodiny chybové hlášení. +Při neexistující rodině makro expanduje na text "unknown". +Použijeme-li například "\OFSfamily" ve svých stylových souborech +a zpozorujeme, že se NFSS snaží substituovat rodinu "unknown", +můžeme si být jisti, že máme překlep v~názvu rodiny nebo nemáme +správně použité "\usepackage". + +Příklad použití: + +\begtt +\usepackage [sjannon, sdynamo] {ofs} +\edef\rmdefault {\OFSfamily [JannonAntikva]} +\edef\sfdefault {\OFSfamily [DynaGroteskR]} +\edef\ttdefault {\OFSfamily [Courirer]} +\endtt + +Význam maker "\rmdefault", "\sfdefault", "\ttdefault" je popsán +v~dokumentaci NFSS. + +Dále OFS definuje příkaz\inl[OFSfamilydefault] + +\begtt +\OFSfamilydefault [] +\endtt +% +který nastaví základní rodinu celého dokumentu. Tato rodina se v~příslušných +velikostech a variantách objeví nejen v~textu, ale i v~záhlaví +kapitol, sekcí a podobně (jsou-li makra v~použitém class souboru udělána +rozumně). Příkaz interně provede + +\begtt +\edef\familydefault {\OFSfamily []} +\endtt +% +s~tím, že navíc ošetří případ neexistující rodiny chybovým hlášením +s~výpisem všech aktuálně dostupných rodin. + + +\subsec Kódování fontů +%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: Přepínání mezi kódováním fontů probíhá zcela v~režii NFSS. OFS +v~této věci nepřidává nic nového. + +\PLAIN (až do konce sekce): +Implicitně se předpokládá kódování CSfontů. Pokud ale potřebujeme +použít fonty například v kódování T1, pak použijeme +"\def\fotenc{8t}"\inl[fotenc] +a OFS bude pracovat s~fonty v~tomto kódování. + +Můžeme dokonce uvnitř dokumentu přepínat: + +\begtt +\def\fotenc{8z} \setfonts[/] ... fonty v kódování CSfontů +\def\fotenc{8t} \setfonts[/] ... fonty v kódování podle Corku. +\endtt + +Kromě toho OFS obsahuje nástroje, aby makra závislá na kódování +fontů (například "\v", "\'", "\ae") expandovala správně +na znak ve zvoleném kódování. +Implicitně je v~OFS nastaveno "\loadingenc=0"\inl[loadingenc], +což znamená, že změnou kódování fontů ani příkazem "\setfonts" se +nemění makra typu "\v", "\ae". Tato makra si ponechají svůj +originální význam z~\hbox{plainu}. To uvítají ortodoxní plainisté, +kteří nemají rádi, když má použitý balíček zbytečně velkou inteligenci. + +Je-li ale na začátku dokumentu uvedeno "\loadingenc=1", například: + +\begtt +\input ofs [a35,sjannon] \loadingenc=1 +\endtt +% +pak při každém příkazu "\setfonts" si \TeX{} zkontroluje, zda má +načteny všechny potřebné soubory se jménem "ofs-.tex". +Tyto soubory obsahují předefinování maker závislých na nastaveném kódování fontů. +Pokud tyto soubory načteny nejsou, \TeX{} je během "\setfonts" +načte. Podrobněji viz sekce~\beglink{3.3}3.3\endlink{} až +\beglink{3.5}3.5\endlink. + +Balíček OFS obsahuje tři soubory s~deklaracemi maker závislými na +kódování: "ofs-8z.tex", "ofs-8t.tex" a "ofs-8c.tex". Při použití jiného kódování +fontů si můžete vytvořit další soubor analogického názvu. +Příkazy "\accentdef" a "\characterdef" používané v~těchto +souborech jsou podrobně vysvětleny v~\beglink{3.4}sekci~3.4\endlink. + + +\subsec Fonty v~matematice +%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: OFS pro \LaTeX{} vůbec neřeší otázku fontů pro matematiku. +Je potřeba využít nabídku možností NFSS. + +\PLAIN (až do konce sekce): +Příkaz "\setfonts" a přepínače deklarované pomocí "\fontdef" +přepínají jen písmo v~textovém režimu. +Pokud nepoužijeme příkaz "\setmath", zůstává vše, +co je ve vstupním souboru mezi dolary, vytištěno v~Computer +Modern ve velikostech 10\,pt/7\,pt/5\,pt (velikost: +základní/indexová/indexindexová). To nemusí být vždy žádoucí. + +Příkaz "\setmath" má tento tvar:\inl[setmath] + +\begtt +\setmath [//] +\endtt +% +V~parametrech příkazu dáváme najevo, v~jakých velikostech chceme matematické +fonty nastavit. Je možné použít libovolný zápis velikosti, jako +u~příkazu "\setfonts". Je-li použita možnost "mag<číslo>", je +velikost vypočítána jako <číslo> krát velikost aktuálního +textového fontu. Je-li parametr prázdný, doplní se takto: + +\begitems +* základní velikost --- "mag1.0" +* indexová velikost --- "mag0.7" +* indexindexová velikost --- "mag0.5" +\enditems + +Takže "\setmath [//]" udělá totéž jako +"\setmath [mag1./mag.7/mag.5]". OFS definuje makro +"\setsimplemath"\inl[setsimplemath] jako "\setmath [//]". + +Příkaz "\setmath" nastaví matematické fonty podle +aktuální situace. Jeho činnost závisí na obsahu maker +"\fomenc" a "\mathversion". + +Matematické kódování je určeno hodnotou makra +"\fomenc".\inl[fomenc] +Existují tyto možnosti: + +\begitems +* Implicitní hodnota je "\def\fomenc{PS}" (PostScript-Symbol). + Příkaz "\setmath" pak + převezme kurzívu aktuální rodiny a použije ji jako matematickou + kurzívu. Dále převezme základní variantu aktuální rodiny a použije ji + pro číslice a další symboly, které jsou psány i v~matematice jako + "\rm". Standardní přepínače variant "\rm", "\it", "\bf" a "\bi" + začnou přepínat do odpovídajících fontů i v~matematické sazbě. + % + Při "\def\fomenc{PS}" se navíc chybějící matematické znaky, + které obvykle nejsou přítomny v~PostScriptových fontech + (například písmena řecké abecedy), nahradí z~Post\-Script\-ového fontu + Symbol. Tento font se totiž ke většině + PostScriptovým písmům hodí daleko lépe než Computer Modern. Ostatní + znaky (například zvětšující závorky a velké operátory) zůstávájí + v~Computer Modern. + +* Je-li "\def\fomenc{CM}" (Computer Modern), pak "\setmath" ponechá + matematickým vzorečkům Computer Modern fonty, jen se případně + přizpůsobí požadované velikosti. + +* Po zavedení souboru "amsfn.tex" je možné použít "\def\fomenc{AMS}". + Matematika se pak chová stejně jako při "CM", ale navíc jsou k~dispozici + veškeré symboly z~AMS\TeX{}u. + +* Po zavedení souboru "txfn.tex" můžeme použít dvě nová kódování: + "\def\fomenc{TX}" nebo "\def\fomenc{PX}". + V obou případech se pro matematiku použijí + volně dostupné TXfonty, které vycházejí z řezů rodin Times a + Helvetica. Při hodnotě "TX" se v~matematice použijí výhradně + TXfonty, zatímco při hodnotě "PX" budou TXfonty kombinovány + s~kurzívou a základním řezem aktuální textové rodiny fontů (podobně + jako při kódování "PS"). OFS podporuje všechny kontrolní sekvence na + matematické symboly podle manuálu k TXfontům. Jsou zde vešekré + symboly z AMS\TeX{}u a mnoho dalších. Symbolů z TXfontů je několik stovek. + {\hbadness=1015\par} + +* Po zavedení souboru "mtfn.tex" je možné použít + "\def\fomenc{MT}". Matematika bude obsahovat kurzívu a základní řez + aktuální rodiny fontů kombinovanou se znaky~komerční verze + matematických fontů MathTimes. +\enditems + +Podobně jako v~NFSS jsou podporovány dvě verze vzorečků: normal a +bold. Požadovaná verze se nastavuje v~makru "\mathversion"\inl[mathversion] +pomocí "\def\mathversion{normal}" nebo "\def\mathversion{bold}". +Makro "\setmath" pak přizpůsobí zavedení matematických fontů požadované +verzi. Implicitně je nastaveno "\def\mathversion{normal}". +Nastavení "\mathversion" je potřeba provést před vyvoláním příkazu +"\setmath". Příklady: + +\begtt +\setmath [//] $vzoreček$ % vzoreček je ve verzi "normal" +$\def\mathversion{bold}\setmath[//] vzoreček$ % vzoreček ve verzi "bold" +\endtt + + +\sec Jak je to uděláno, aneb pohled do hloubky +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: Všechna makra, která jsou jen pomocná, jsou ve stylu "ofs.sty" +definována se jménem "\ofs@jménomakra", aby nedošlo ke zmatení s~jinými +styly. Makra, která se používají v~deklaračních souborech, mají název +"\OFSjménomakra". Dále styl definuje uživatelské příkazy "\setfonts", +"\fontdef", "\showfonts", "\fontusage", a předefinovává přepínače +"\rm", "\bf", "\it", "\bi". + +\PLAIN: Všechna makra definovaná v~"ofs.tex" jsou uvedena v~rejstříku na +konci tohoto dokumentu. Při návrhu názvů maker jsem nevyužil konvenci +se znakem "@", protože tento znak v~názvech maker osobně nenávidím. + + +\subsec Výpisy do logu +%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: Pro trasování makra NFSS se použije balíček "tracefnt". + +\PLAIN: Pokud někoho ruší při častém přepínání rodin fontů příkazem +"\setfonts" výpisy v~logu, může použít příkaz +"\nofontmessages"\inl[nofontmessages]. +Pokud naopak chceme tyto výpisy vidět i na terminálu, pišme +"\displayfontmessages"\inl[displayfontmessages]. Implicitně je zapnut výpis +pouze do logu příkazem "\logfontmessages"\inl[logfontmessages]. +Pokud chceme přesně vidět, které metriky fontů se zavádějí primitivním +příkazem "\font", použijeme "\detailfontmessages"\inl[detailfontmessages]. + +Varování o~nepřístupných znacích nebo kódováních se vždy vypisují na +terminál i do logu. Chceme-li je mít jen v~logu, můžeme napsat +"\let\displaymessage=\wlog"\inl[displaymessage], protože tato sekvence +je v~OFS používána na zobrazení zpráv na terminál. + + +\subsec Robustní a křehké příkazy +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: \LaTeX{}2e má zavedené postupy na definování robustních +příkazů. Význam těchto pojmů je vysvětlen v~dokumentaci k~\LaTeX{}u. +Příkaz "\setfonts" a přepínače deklarované pomocí "\fontdef" jsou +samozřejmě definovány jako robustní, takže se mohou vyskytovat +v~textech pro obsahy, rejsříky apod. bez toho, aby způsobily obtíže. + +\PLAIN (až do konce sekce): +Makro plainu problematiku křehkých příkazů neřeší +a uživatelé plainu, pokud narazí na tento problém, používají různá svá +vlastní řešení, která nejsou standardizována. Jedno takové řešení je i +v~OFS. + +Nejprve stručně naznačíme, v~čem spočívá problém s~křehkými příkazy. +Občas potřebujeme (pro generování obsahu, rejstříku apod.) poslat +nějaký text do pomocného souboru (primitivem "\write"), aby byl tento +soubor v~zápětí (při dalším zpracování \TeX{}em) znovu načten. +Problém je, že primitiv "\write" zapíše do souboru text po expanzi +maker, což nemusí vždy vyhovovat. Pokud je například fontový přepínač +implementován jako složité makro a je použit v~textu zpracovaném +primitivem "\write", v~souboru se objeví celé makro po expanzi. +Při opětovném načtení takového souboru dojde většinou k~havárii; +říkáme, že byl použit křehký (fragile) příkaz v~textu posílaném do +souboru a v~souboru se nám tento příkaz \uv{rozsypal}. + +Pokud se dostane (potenciálně) křehký příkaz z~maker OFS do souboru, +pak se při novém načtení takového souboru automaticky při havárii +zobrazí na terminálu a v~logu návod jak postupovat, aby se uživatel +tohoto problému zbavil. Text návodu po překladu do češtiny vypadá +takto: + +\begtt +CHYBA !! křehký příkaz v toc/ind/aux nebo podobném souboru. +Tento problém můžete řešit následujícími kroky: +1. Vymažte pomocný soubor s tímto křehkým příkazem. +2. Vložte následující kód do záhlaví svého dokumentu: + \let\orishipout=\shipout + \def\shipout#1#2{\setbox0=#1{#2}\bgroup + \let\expandaction=\noexpand \orishipout\box0 \egroup} +3. Znovu TeXujte svůj dokument nejméně dvakrát za sebou. +Další informace najdete v dokumentaci k OFS. +\endtt + +Vysvětlíme si, jak je to uděláno. Makro, které může v~parametru +primitivu "\write" působit potíže, je v~OFS definováno zhruba takto: + +\begtt +\def\makro {% + \ifx\expandaction\noexpand + \noexpand\makro + \else + \csname fragilecommand!\endcsname + + \fi +} +\endtt + +Pokud se nenastaví "\expandaction"\inl[expandaction] +na hodnotu "\noexpand", pak se +provede část kódu za "\else". Protože příkaz +"\csname fragilecommand!\endcsname"\inl[fragilecommand!] +není definován, realizuje se v~hlavním procesoru jako "\relax" +[TBN, strana 349]. Při expanzi primitivem "\write" se do souboru +zapíše "\fragilecommand!". Při dalším čtení soboru se spustí příkaz +"\fragilecommand"\inl[fragilecommand], +který vypíše na terminál již zmíněnou nápovědu. + +Jestliže uživatel použije kód z~nápovědy v~záhlaví svého dokumentu, +pak v~době činnosti primitivu "\shipout" (tj.~v~době, kdy expandují +argumenty primitivů "\write") je nastaveno "\let\expandaction=\noexpand". +V~makru "\makro" se provede první část před "\else", takže do souboru +se zapíše jen "\makro". To je přesně to, co potřebujeme. + +V~OFS není kód, který předefinovává "\shipout", přímo zahrnut. Místo +toho pouze doporučíme uživateli, aby to udělal sám. Uživatel plainu totiž +potřebuje mít věci pod vlastní kontrolou a neměl by asi důvěru k~makru, +které bez jeho vědomí předefinuje tak zásadní věc, jako je primitiv +"\shipout". Také je možné, že uživatel plainu použije na různé části +textu ve svých makrech "\edef" a potřebuje vědět, že je v~takovém +případě vhodné nejpve nastavit "\let\expandaction=\noexpand". + +Podobně jako zde v~ukázce definice příkazu "\makro" jsou +v~OFS definovány +příkazy "\setfonts" (\beglink{2.2}sekce~2.2\endlink), +"\setmath" (\beglink{2.7}sekce~2.7\endlink), +"\setextrafont", "\printcharacter", "\printaccent" +(\beglink{3.4}sekce~3.4\endlink), +"\accentabove", "\accentbelow" a "\ofshexbox" (\beglink{3.6}sekce~3.6\endlink). +Po použití kódu z~nápovědy se tato makra stávají \uv{robustními} +v~\LaTeX{}ovém smyslu tohoto slova. + + +\subsec Deklarační soubory +%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: Deklarační soubory v~\LaTeX{}u jsou běžné stylové soubory, +které shrnují několik rodin fontů ve smyslu NFSS. Tyto rodiny jsou +deklarovány běžným způsobem ve~"fd" souborech. V~deklaračních souborech +je možno použít následující příkazy: + +\begitems +* "\OFSprocessoptions"\inl[OFSprocessoptions] + --- má většinou hodnotu "\undefined". Pokud ale + je stylový soubor načítán ze souboru "ofs.sty" jako parametr, + má "\OFSprocessoptions" hodnotu "\relax". Test na tuto + sekvenci používáme v~záhlaví stylového souboru, abychom vynachali + \LaTeX{}ovské "\RequirePackage{ofs}", pokud to není potřeba (a + pouze by to zlobilo). +* "\OFSextraencoding {}"\inl[OFSextraencoding] + --- Toto makro si poznamená do paměti a + provede "\input {ini.def}". + Předpokládá se, že tam jsou odpovídající definice pro + , viz například soubor "se1ini.def", který obsahuje + deklarace pro rozšiřující kódování SE1 fontů ze Střešovické písmolijny. + Pokud už byl soubor "ini.def" načten, makro jej + nenačítá znovu. Pozor: je nutno psát + velkými písmeny, ačkoli v~názvu souboru musí být naopak tato písmena malá. +* "\OFSputfamlist {}"\inl[OFSputfamlist] + --- vloží do seznamu rodin, který + se vypisuje při "\showfonts" nebo při neznámé rodině. +* "\OFSdeclarefamily [] {}"\inl[OFSdeclarefamily] + --- poznamená si + do paměti, že je ve skutečnosti . + Tato paměť se využije například v~příkazu "\OFSfamily". + Navíc zanese do seznamu rodin vypisovaném při + "\showfonts". +* "\OFSnormalvariants"\inl[OFSnormalvariants] + --- do textu, který se vypisuje při "\showfonts" + nebo při neznámé rodině vloží, seznam standardních přepínačů, + tj.~"\rm,"~"\bf,"~"\it,"~"\bi". +\enditems + +\PLAIN (až do konce sekce): +Deklarační soubory mají příponu "tex" a předpokládá se o~nich, +že mají pojistku proti opakovanému načtení. Pokud není ještě načten +soubor "ofs.tex", je nutno jej před další činností načíst. Rovněž je +vhodné zde načíst soubor definic znaků podle použitých kódování +(viz~\beglink{3.4}sekce~3.4\endlink). + +V~deklaračním souboru je nutno vytvořit vazbu mezi názvy rodin a použitými +metrikami. K~tomu se používají následující příkazy: + +\begitems +* "\protectreading "\inl[protectreading] --- poznamená + si do paměti, že je přečten . Pokud je příkaz se stejným + parametrem čten podruhé, provede "\endinput", takže následující deklarace jsou + chráněny proti vícenásobnému čtení. +* "\ofsputfamlist {}"\inl[ofsputfamlist] + --- vloží do seznamu rodin, který + se vypisuje při "\showfonts" nebo při neznámé rodině. +* "\ofsdeclarefamily [] {}"\inl[ofsdeclarefamily] + --- deklarace nové + rodiny se jménem . Toto jméno se zanese do seznamu + známých rodin vypisovaných pomocí "\showfonts". Pokud se tato rodina + použije při "\setfonts", pak se provedou . Mezi se + použije právě jeden příkaz "\loadtextfam", který zavede fonty dané + rodiny do paměti \TeX{}u. +* "\loadtextfam"\inl[loadtextfam] + --- Zavede čtyři fonty s~danými metrikami. Tento příkaz vyžaduje + podrobnější vysvětlení, které je včetně parametrů příkazu uvedeno níže. +* "\newvariant<číslice> \ () ;;"\inl[newvariant] + \null\penalty0 --- Dekla\-ruje nový přepínač varianty. + Podrobnější vysvětlení je uvedeno níže. +* "\modifyenc :;"\inl[modifyenc] --- přidání + výjimek vzhledem k~základnímu kódování, viz~\beglink{3.5}sekce~3.5\endlink. +* "\fosize"\inl[fosize] + --- makro, které uchovává informaci o~aktuální velikosti + fontů v~naposledy vybrané rodině. Obsah "\fosize" může mít dvě + podoby: "at" nebo "scaled" podle toho, jaký tvar + parametru byl použit v~příkazu "\setfonts". +* "\fotenc"\inl[fotenc] + --- makro, které uchovává informaci o~aktuálním kódování. + Nejčastější možnosti jsou "\def\fotenc{8z}" (kódování podle CS-fontů) nebo + "\def\fotenc{8t}" (kódování podle Corku). Je-li při načtení souboru + "ofs.tex" makro "\fotenc" už známé, ponechá se beze změny, jinak se + definuje jako "8z". +* "\extranec"\inl[extraenc] + --- makro, které uchovává informaci o~rozšiřujícím kódování. + Tuto informaci tam kopíruje z~parametru makro "\laodatextfam". +* "\defaultextraenc"\inl[defaultextraenc] + --- makro, jehož předefinováním můžeme změnit rozšiřující kódování základních + rodin a rodin z~"a35.tex". Výchozí hodnota makra~"8c". +* "\setfontshook"\inl[setfontshook] + --- makro, které se spustí vždy při činnosti příkazu "\setfonts" + těsně před tím, než jsou vykonány z~"\ofsdeclarefamily". +* "\registertfm - "\inl[registertfm] + --- umožňuje pracovat při různých velikostech fontů s~různými + metrikami. Podrobnosti viz \beglink{3.8}sekce~3.8\endlink. +* "\registerenc : "\inl[registerenc] + --- umožňuje omezit použití rodiny fontů jen pro vymezená + kódování. Podrobnosti viz \beglink{3.9}sekce~3.9\endlink. +\enditems + +Příkaz "\loadtextfam" používaný v deklaračních +souborech mezi makra "\ofsdeclarefamily" má parametry: + +\begtt +\loadtextfam () ;% + () ;% + () ;% + () ;;% +\endtt +% +Procenta na koncích řádků v této ukázce označují, že za středníky nemá +být mezera. +Údaje "()" slouží jako komentáře o variantách zapisované do +logu a je možno je kompletně včetně závorek a vynechat (třeba jen +některé). Ve verzích OFS do Sep~2002 nebyl tento parametr vůbec +podporován. Při vynechání tohoto parametru se předpokládají +následující implicitní hodnoty: "rm: ()", "bf: (Bold)", +"it: (Italic)", "bi: (BoldItalic)". + +Údaje odpovídají názvům metrik, které se pro uvedené +varianty fontů makrem "\loadtextfam" zavedou. Makro zhruba provede toto: + +\begtt +\font\tenrm= \fosize +\font\tenbf= \fosize +\font\tenit= \fosize +\font\tenbi= \fosize +\endtt +% +Předpokládá se, že všechny jsou +v~deklaračním souboru napsány tak, že +obsahují makro "\fotenc". %\inl[fotenc] +Tím je zaručena změna názvu metriky při +přechodu na jiné kódování (tj. při předefinování makra "\fotenc"). + +Konečně údaj udává název extra kódování. Pokud je tento parametr +neprázdný, pak "\loadtextfam" provede na přechodnou dobu +"\def\fotenc{}" a znovu expanduje +parametry , , a . +Výsledky těchto expanzí si poznamená do paměti. Jedná se o~rozšiřující +metriky k~základním metrikám. Je-li parametr prázdný, +poznámka o rozšiřujících metrikách se nekoná. +Když pak nějaké makro pro přístup ke speciálnímu znaku tuto +metriku potřebuje, objeví se na terminálu varování, že aktuálně +zvolená metrika nemá rozšiřující variantu. + +Některé metriky v~příkazu "\loadtextfam" s výjimkou +mohou být vynechány. Je-li například prázdný parametr +, pak se zhruba provede +\begtt +\def\tenXX{\message{varování o neexistující variantě na terminálu}} +\endtt +% +takže při přechodu na takovou variantu se objeví na terminálu +a v~logu hlášení o~ne\-existující variantě a font se nezmění. + +Příkaz "\setfonts"\inl[setfonts] +nemění význam maker "\rm", "\bf", "\it" a "\bi", +ale mění význam přepínačů fontů "\tenrm", "\tenbf", "\tenit" a "\tenbi". +Dělá to navíc zprostředkovaně tím, že spustí deklarované pro +požadovanou rodinu v~"\ofsdeclarefamily" a mezi těmito +se vyskytuje příkaz "\loadtextfam". + +Makra "\rm", "\bf", "\it", resp. "\bi" používají fontové přepínače +"\tenrm", "\tenbf", "\tenit",\inll[tenrm \back tenbf \back tenit] +resp. "\tenbi". První tři jsou známy z~plainu +a čtvrtý\inl[tenbi] je zaveden nově. +Navíc makra "\rm", "\bf", "\it" a "\bi" ukládají +do kontrolní sekvence "\currentvariant"\inl[currentvariant] +informaci o~naposledy aktivované variantě. Tato informace má podobu +písmene ("M", "F", "T", resp. "I"), protože jedině konstrukce +"\let\currentvariant=" je odolná vůči expanzi. Šlo o~to, aby +makra přepínačů variant byla robustní i bez předefinování "\shipout". + +Všimneme si, že "\loadtextfam" nastavuje přepínače +"\tenrm", "\tenbf", "\tenit" a "\tenbi" +na fonty v~libovolné velikosti. Činí tak podle aktuální +hodnoty makra "\fosize", které mění makro "\setfonts" podle toho, jak +je zadán parametr . +Slovo {\clqq"ten"\crqq} v~názvech fontových přepínačů tedy +nemusí znamenat, že se jedná o~font ve velikosti 10\,pt. Považujme +tyto názvy za historické a z~hlediska OFS možná trochu +kuriózní. Není přitom nutné pro přepínače textových fontů vymýšlet +názvy nové. + +Někdo může namítnout, že opakované používání makra "\setfonts" vždy +znovu a znovu spouští čtveřici příkazů "\font", což může způsobit +větší nároky na paměť a čas. Není to pravda, protože \TeX{} si eviduje +interní tabulku už zavedených metrik a při opakovaném použití +primitivu "\font" na stejnou metriku se už neobtěžuje metriku vůbec +otevírat. Jen inicializuje příslušný fontový přepínač asi stejně rychle, +jako by se to provedlo pomocí "\let". + +Příkaz "\loadtextfam" ještě před zavedením fontů načte +při "\loadingenc>0"\inl[loadingenc] +soubor "ofs-\fotenc.tex". Při neprázdném parametru +navíc načte soubor "ofs-.tex". +Tyto soubory jsou čteny jen jednou a v době čtení jsou +ignorovány prázdné řádky, konce řádků. Čtení probíhá uvnitř +skupiny, kde jsou pro jistotu lokálně nastaveny +kategorie znaků podle plain\TeX{}u (a~"\catcode`@=11") +a je nastaveno "\globaldefs=1", tj.~všechna +předefinování ze souboru "ofs-.tex" se provedou globálně. +To nám nevadí, protože nově načtené kódovací soubory nejsou v~konfliktu +s~předchozími (viz vlastnosti příkazů "\characterdef" a "\accentdef" +v~\beglink{3.4}sekci~3.4\endlink). Načtení většího množství těchto +souborů než je v~dané chvíli potřeba, rovněž neohrozí funkcionalitu +maker závislých na kódování. Důvod globální definice je v~tom, že +není vhodné, aby při opakovaném "{...\setfonts...}" musel být +kódovací soubor načítán neustále znovu a znovu. + +Pokud uživateli vadí, že je předefinování maker globální +(chce například svůj článek zařadit do sborníku, kde by +předefinování mohlo vadit jiným článkům), pak ponechá "\loadingenc=0" a +musí načíst soubory s~deklaracemi maker manuálně pomocí +"\input" na začátku článku. V~takovém případě se provede +deklarace jen lokálně. + +V~parametru makra "\ofsdeclarefamily" se může deklarovat +nadstandardní varianta rodiny pomocí příkazu "\newvariant".\inl[newvariant] +Tento příkaz provede: + +\begtt +\font\ten= \fosize +\def \ {\let\currentvariant=<číslice> \ten} +\endtt +% +Dále příkaz "\newvariant" zanese do paměti informaci o~případné +rozšiřující metrice podle . + +Pokud OFS potřebuje dodržet při přechodu na novou rodinu naposledy +zvolenou nadstandardní variantu, činí tak podle hodnoty +"\currentvariant". Pokud tedy nová rodina má deklarovánu +nadstandardní variantu pod stejnnou <číslicí>, bude použita tato +varianta a OFS nebude přepínat do defaultní varianty "\rm". +Je proto vhodné deklarovat varianty různých rodin ale +\uv{stejného typu} pod stejnou <číslicí>. +Z principu věci vidíme, že v~OFS existuje omezení v~počtu +nadstandardních variant jedné rodiny na maximálně 10. +To by nemělo vadit, protože kdykoli můžeme rozdělit rozsáhlou +rodinu na více rodin (například Štormovy rodiny DynamoGrotesk). + +Makro "\setfonts" může měnit význam maker "\loadtextfam" a +"\newvariant". Udělá to právě tehdy, když je v parametru +specifikovaná varianta. V takovém případě stačí zavést jeden font a +není potřeba zavádět celou rodinu. Při specifikaci standardní varianty +"\newvariant" nebude dělat nic a "\loadtextfam" zavede jediný font. +Při specifikaci nadstandardní varianty "\loadtextfam" nebude dělat nic +a "\newvariant" zavede font jen tehdy, pokud se jedná o font +specifikované varianty. + +Na závěr této sekce si podrobněji vysvětlíme činnost +příkazu "\setfonts".\inl[setfonts] +Tento příkaz \uv{vypočítá} a definuje podle parametru hodnotu +makra "\fosize". Dále při neprázdném pamaretru a při +neuvedení varianty tento příkaz provede +"\def\currentfamily{}"\inl[currentfamily], +zatímco při prázdném parametru +hod\-notu z~"\currentfamily" pouze použije. +Je-li v~parametrech uvedena varianta +rodiny, pozmění "\setfonts" na přechodnou dobu makra "\loadtextfam" a +"\newvariant" tak, aby místo +celé rodiny fontů byl zaveden jen jeden font. Dále spustí +"\setfontshook" a pak z~odpovídajícího "\ofsdeclarefamily". +Potom vrátí hodnoty maker +"\loadtextfam" a "\newvariant" do původního stavu, pokud byly +tyto hodnoty měněny. Nakonec spustí makro +"\runmodifylist"\inl[runmodifylist], které nastaví za jistých okolností +výjimky ze zvoleného kódování (podrobněji viz~\beglink{3.5}sekci~3.5\endlink). +Konečně příkaz "\setfonts" spustí "\ignorespaces", aby případná +zapomenutá mezera za závorkou~\clqq"]"\crqq nebyla v~horizonálním módu +vytištěna. + + +\subsec Kódování fontů a deklarace znaků +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\PLAIN: Pro přepínání do rozšiřující metriky slouží makro +"\setextrafont"\inl[setextrafont]. +Toto makro se podívá, zda k~aktuálnímu fontu existuje v~paměti poznámka +o~rozšiřující metrice (viz příkaz "\loadtextfam" a "\newvariant" +\beglink{3.3}v~předchozí sekci\endlink). +Pokud taková poznámka existuje, příkaz "\setextrafont" provede zhruba toto: + +\begtt +\font\extrafont= \extrafont@inl[extrafont] +\endtt + +\LATEX: Pro přepínání do rozšiřujícího kódování, které je deklarováno +příkazem "\OFSextraencoding", slouží (stejně jako v plainu) +makro "\setextrafont". Toto makro se podívá, zda bylo +rozšiřující kódování deklarováno, a pokud ano, provede zhruba toto: + +\begtt +\fontencoding{}\selectfont +\endtt + +\OBA: Chceme-li vytisknout z~rozšiřující metriky (rozšiřujícího +kódování) nějaký znak s~kódem <číslo>, je možné použít +makro "\extchar <číslo>"\inl[extchar]. + +\PLAIN (až do konce sekce): +Pro definice maker závislých na aktuálním kódování +je možné v~OFS použít dva deklarační příkazy: +"\characterdef" a "\accentdef". První z~nich\inl[characterdef] +má tyto parametry: + +\begtt +\characterdef \ <číslo> +% příklad: +\characterdef \promile 8z 141 +% nebo +\characterdef \ {} +% příklad: +\characterdef \promile 8t {\%\char24 } +\characterdef \promile * {\vrule height1ex width1ex\relax} + % in another encodings +\endtt + +V~prvním případě se bude "\" při aktuálním kódování fontů +shodném s~ expandovat na token kategorie 12 s~kódem +rovným <číslu>. V~druhém případě "\" expanduje při +shodnosti na . Vše proběhne na úrovni +expand procesoru. Pokud použijeme oba výše zmíněné příklady +pro definici "\promile", pak platí: + +\begtt +\def\fotenc{8z} \promile % expanduje na znak s kódem 141 +\def\fotenc{8t} \promile % expanduje na příkazy \%\char24 +\endtt + +Mimoto je možné deklarovat přístup k~rozšířenému kódování, pokud je +toto kódování specifikováno jako parametr v~příkazu +"\loadtextfam". Příklad: + +\begtt +\characterdef \euro 8z 134 +\characterdef \euro 6s 37 + +\def\fotenc{8z} \euro % expanduje na znak s kódem 134 +\def\fotenc{8t} \euro % expanduje na: {\setextrafont znak s kódem 37} +\endtt + +V~tomto příkladě se při "\def\fotenc{8t}" může stát, že aktuální font +nemá poznámku o~rozšiřující metrice, nebo má poznámku o~rozšiřující +metrice jiné než "6s". Pak "\euro" vypíše varování na terminál +o~nedostupnosti znaku "\euro". + +Vysvětlíme nyní podrobněji, jak makra deklarovaná pomocí +"\characterdef" fungují. Příkaz "\characterdef" +definuje "\" +jako "\printcharacter{}"\inl[printcharacter], +takže například "\promile" expanduje nejprve na "\printcharacter{promile}". +a "\euro" na "\printcharacter{euro}". +Pokud se "\characterdef" použije opakovaně na stejnou "\", +pak se vždy znovu definuje stejně, takže nedochází ke ztrátě předchozí +informace. Kromě toho ale "\characterdef" definuje další makro +"\:-" tak, že toto makro expanduje na znak se +specifikovaným kódem nebo na . Další inteligence je schována +v~příkazu "\printcharacter". Ten ověří, zda je definováno makro +"\:-\fotenc". Pokud ano, expanduje na obsah tohoto makra. +Jinak ověří, zda existuje poznámka o~rozšiřující metrice vztažená +k~aktuálnímu fontu. Pokud ano, zjistí kódování této rozšiřující +metriky a podívá se, zda je definováno makro +"\:-". Pokud ano, expanduje na + +\begtt +{\setextrafont \:-} +\endtt +% +Pokud se stále nepodařilo realizovat požadovaný znak, +pokusí se vytisknout defaultní znak nezávislý na kódování +"\:-*". Pokud ani to není možné, +spustí se "\printcharacterwarn{}".\inl[printcharacterwarn] +Implicitní hodnota tohoto makra vypíše varování +o~nedostupném znaku na terminál a do logu a do výstupu +nevytiskne nic. + +Chceme-li se vyhnout výpisu varování, můžeme "\printcharacterwarn" +předefinovat, třeba takto: + +\begtt +\def\printcharacterwarn #1{?(#1)?} +\endtt + +Od verze OFS Mar. 2004 "\characterdef" odmítá předefinovat už +definované kontrolní sekvence. Definuje pouze sekvence, které mají +zatím význam "\undefined" nebo "\relax". V jiném případě (a pokud není +sekvence už pomocí "\characterdef" definována) vypíše +varování o ignorované definici do log souboru. Důvod tohoto opatření +je ten, že kódovací soubory deklarují obrovské množství nových +kontrolních sekvencí pomocí "\characterdef", a přitom programátor +maker nemusí všechny znát. Může se tedy stát, že použije pro své vlastní makro +stejné jméno. V takovém případě "\characterdef" respektuje makro +definované programátorem a příslušný znak ponechá nepřístupný. +Pokud potřebujeme pomocí "\characterdef" skutečně některé +kontrolní sekvence předefinovat (u~maker závislých na kódování z~plainu to je +nutné), pak musíme před použitím "\characterdef" napsat +"\let\=\relax". + +Ze~stejných důvodů bylo do OFS přidáno makro "\safelet"\inl[safelet], +které se chová jako "\let", ale odmítá předefinovat už definované +kontrolní sekvence. Místo toho pouze vypíše varování, definované +v~makru "\safeletwarn"\inl[safeletwarn]. + +Kromě deklarace znaků pomocí "\characterdef" je k~dispozici možnost +deklarace akcentových příkazů prostřednictvím +"\accentdef"\inl[accentdef], který má +tyto parametry: + +\begtt +\accentdef \ <číslo> +% Příklad: +\accentdef \v E 8z 204 % Ecaron +% nebo +\accentdef \ {} +% Příklad: +\accentdef \v * 8z {\accent20 } % default caron in 8z +\accentdef \v * * {\blackbox } % default caron +\endtt + +Pokud je aktuální kódování fontů totožné s~, pak "\" +následovaná znakem expanduje na token kategorie 12 s~kódem +<číslo>, respektive expanduje na . To vše se děje jen na +úrovni expand procesoru. Pokud je při deklaraci +pomocí "\accentdef" jako uvedena hvězdička, pak se deklarované + nebo kód <číslo> použije vždy, když znak následující +"\" není nikde prostřednictvím "\accentdef" +deklarován. Jedná se tedy o~defaultní realizaci akcentu, pokud ve +fontu neexistuje přímo akcentovaný znak. + +Kromě toho mají akcenty deklarované pomocí "\accentdef" stejnou +inteligenci týkající se možnosti využití rozšiřující metriky, jako +znaky deklarované v~"\characterdef". + +Vysvětlíme si nyní podrobněji, jak akcenty deklarované pomocí +"\accentdef" fungují. Příkaz "\accentdef" +definuje "\" jako makro s~jedním neseparovaným parametrem +"#1", které v~první řadě expanduje +na "\printaccent{}{#1}"\inl[printaccent], +takže například "\v E" expanduje na "\printaccent{v}{E}". Dále +"\accentdef" definuje makro "\::-" jako znak +s~daným kódem <číslo> nebo jako . Další práci udělá +příkaz "\printaccent". Tento příkaz zjistí, zda je definováno makro +"\::-\fotenc". Pokud ano, expanduje na toto makro. +Pokud ne, tak si ověří, zda je k~aktuálnímu fontu poznamenána +rozšiřující metrika a zjistí její kódování . Jestliže je +definováno makro "\::-", pak se expanduje na +"{\setextrafont \::-}". Pokud zatím vše +selhalo, zkusí "\printaccent" postupně zjistit, zda jsou definována +makra "\:*:-\fotenc" a "\:*:-". Pokud je +definováno první z~nich, expanduje a připojí na konec expanze . +Pokud je definováno jen druhé z~nich, expanduje na + +\begtt +{\setextrafont \:*:- } +\endtt +% +kde označuje přepínač do aktuálního fontu. Jestliže +dosud vše selhalo, pokusí se ještě o~realizaci akcentu nezávislého na +kódování, tj.~pokusí se tisknout "\::-*" nebo konečně +"\:*:-* ". Teprve když i toto selhalo, +spustí se "\printaccentwarn{}{}".\inl[printaccentwarn] +Implicitní hodnota tohoto makra vypíše se na terminál a do +logu varování o~nedostupnosti akcentovaného znaku a do výstupu +nevytiskne nic. + +Je třeba si uvědomit, že přechod ke znaku v~rozšiřující metrice uvnitř +slova znamená ztrátu vyrovnávacího kernu kolem tohoto znaku a +nemožnost použít na takové slovo vzory dělení slov. Proto doporučujeme +použít základní metriku kódovanou tak, aby přechod na rozšiřující +metriku byl jen výjimečný. Pro český a slovenský jazyk jsou v~tomto smyslu +vhodná kódování "8z" i "8t", protože obě zahrnují kompletní českou a +slovenskou abecedu. + +Chceme-li odstranit už deklarovaný znak\inl[characterdel] +(viz též tzv.~ v~následující sekci), můžeme použít příkazy +"\characterdel" a "\accentdel".\inl[accentdel] +Tyto příkazy mají stejné parametry +jako "\characterdef" resp. "\accentdef" a odstraní definici příkazu +"\:-" resp. "\::-". + +%Na závěr této sekce uvedeme příklad definice inteligentního +%"\Uppercase": +% +%\begtt +%\def\Uppercase #1{\bgroup +% \let\expandaction=\noexpand % \euro zůstane po expanzi bez změny +% % \u{g} taky zůstane beze změny +% \def\ss{SS}\def\l{\L}\def\o{\O}\def\ae{\AE}\def\oe{\OE}% +% \edef\tmp{#1}\expandafter +% \egroup \expandafter\uppercase\expandafter{\tmp}% +%} % \uppercase promění \u{g} na \u{G}. O to šlo. +%\endtt + + +\subsec \PLAIN: Soubory maker závislých na kódování a výjimky z~kódování +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Příkazy "\characterdef" a "\accentdef" popsané v~předchozí sekci +předefinovávají makra závislá na kódování ("\v", "\ae", atd.). V~této +sekci popíšeme koncepci, kam tato makra zapisovat, aby OFS při +"\loadingenc=1" udržovalo konzistentní definice těchto maker +v~závislosti na zvoleném kódování a na množině výjimek +použité rodiny fontů. + +Deklarace maker pomocí "\characterdef" a "\accentdef" +se zapisují do souborů s~názvem "ofs-.tex" (tzv.~{\it +kódovacích souborů\/}), +protože příkaz "\loadtextfam" (volaný z~makra "\setfonts") +tyto deklarace při nastaveném "\loadingenc=1"\inl[loadingenc] odtud čte. + +Každé kódování má svou základní sadu znaků a akcentovaných písmen. +Tato sada je v~kódovacím souboru zanesena pomocí příkazů +"\characterdef" a "\accentdef". Vzhledem k této základní sadě mohou +jednotlivé rodiny fontů obsahovat nějaké znaky navíc nebo naopak nějaké +znaky mohou chybět. Tyto výjimky se deklarují +pomocí příkazu "\modifydef"\inl[modifydef] takto: + +\begtt +\modifydef :; {} +\endtt +% +Přitom obsahují příkazy "\characterdef", "\accentdef", +"\characterdel" a "\accentdel". Příkazy "\*del" musejí obsahovat +v~argumentu hodnotu znaku podle základní sady daného kódování. +Pokud má být nějaký znak vzhledem k základní sadě předefinován, musejí +příkazy "\*del" a "\*def" k tomuto znaku následovat těsně za sebou. + +V parametru příkazu "\ofsdeclarefamily" můžeme pomocí \uv{odkazu na +} příkazem "\modifyenc"\inl[modifyenc] +vyznačit, že daná rodina obsahuje vzhledem k~základní sadě kódování +odpovídající . Příkaz má tvar: + +\begtt +\modifyenc :;% +\endtt +% +Takových příkazů může být pro každou rodinu fontů uvedeno více +(a samozřejmě tyto příkazy mohou obsahovat různá ). +Odkazuje-li tento příkaz na , které ještě +nebyly deklarovány, neprovede se nic. + +Příklad deklarace výjimek kódování "8z:csfonts" najdete v~souboru +"ofs-8z.tex" a odkazy na ně pak najdete u~rodin "CM*" +v~souboru "ofsdef.tex". + +Příkazy "\modifyenc" jsou spuštěny při každém "\setfonts". Ve +skutečnosti tyto příkazy pouze ukádají do tzv.~{\it seznamu odkazů} +(do makra "\newmodifylist"\inl[newmodifylist]) +své parametry. Při startu "\setfonts" se zakládá prázdný seznam odkazů. +"\modifyenc" ukládá do tohoto seznamu svůj parametr jen tehdy, pokud + je rovno "\fotenc" nebo "\extraenc". Vlastní práci +(nastavení výjimek) provede až příkaz "\runmodifylist", který je spuštěn +na konci "\setfonts" a jehož činnost si nyní podrobně popíšeme. + +Makro "\runmodifylist"\inl[runmodifylist] porovná seznam +odkazů na výjimky předchozí rodiny ("\modifylist"\inl[modifylist]) +se seznamem odkazů nově nastavené rodiny ("\newmodifylist"). Pokud jsou oba seznamy +stejné nebo "\modifylist" má význam "\relax", pak "\runmodifylist" +ukončí činnost. Jinak se pustí do nastavení výjimek. Nejprve prohodí významy +"\characterdef"$\leftrightarrow$"\characterdel" a +"\accentdef"$\leftrightarrow$"\accentdel" a spustí "\modifylist" +Jinými slovy vrátí stav maker vázaných na +kódování do výchozího stavu. Při této činnosti je ignorováno mazání +znaku, pokud těsně před tím byl znak deklarován (viz pravidlo +o~předefinování znaku na začátku této sekce). Pak příkaz "\runmodifylist" +vrátí "\characterdef" a "\accentdef" do původního stavu a spustí +"\newmodifylist". Veškerá předefinování, která se při této činnosti provádějí, +jsou jen lokální. Mechanismus dvou seznamů odkazů zaručuje, +že například při + +\begtt +\setfonts [Rodina1/] ... \setfonts [Rodina2/] ... +\endtt +% +budou správně nastaveny výjimky aktuálního kódování i pro +Rodinu2, ačkoli Rodina1 má jinou množinu výjimek než +Rodina2. + +Kontrolní sekvence "\modifylist" má po inicializaci OFS význam +prázdného makra. Programátor maker může použít +"\let\modifylist=\relax" a tím potlačí veškeré nastavování výjimek. + +Poznamenejme ještě, že deklarační příkazy "\modifydef" nejenže ukládají + do paměti, ale projdou také +jejich obsah a definují všechny zde deklarované sekvence jako odpovídající +"\printcharacter" resp. "\printaccent". Tím máme zaručeno, že každá +kontrolní sekvence ze všech výjimek je definována (nedojde ke zprávě +{\tt undefined control sequence}) a navíc OFS má +dokonalý přehled o tom, zda je v~aktuální rodině tato kontrolní +sekvence použitelná nebo nikoli. Tvůrce maker si pak může podle +potřeby předefinovat makra "\print*warn". + +Příkaz "\modifydef" prochází tak, že na přechodnou dobu +pozmění příkazy "\accentdef", "\accentdel", atd. a spustí. +Pokud nechceme, aby se makra ve spouštěla už v~době +činnosti "\modifydef", uvedeme před tato makra sekvenci +"\skipfirststep".\inl[skipfirststep] +Ta se chová jako "\relax", ale při spouštění + příkazem "\modifydef" způsobí, že vše za touto sekvencí až +do konce bude přeskočeno. + +Identifikátory ":lccodes" a ":ienc" jsou rezervovány +pro použití mimo OFS v~dalších makrech. OFS například vůbec neřeší nastavení +"\lccode", "\uccode" znaků podle použitého kódování. Makro, které +se o toto stará, může vhodně definovat příkazy "\lccodes"\inl[lccodes] +a "\lccodesloop" +a spustí "\csname :lccodes\endcsname". OFS uvedené příkazy +vůbec nedefinuje.\inl[lccodesloop] +Deklarace ":lccodes" jsou uvedeny +v~souborech "ofs-8t.tex" a "ofs-8z.tex" ačkoli nejsou v OFS využity, +protože to souvisí s~kódováním textových fontů. Příklad použití +":lccodes" je v makru "lang.tex" a makro "inec.tex" +používá ":ienc". V dokumentaci~k těmto makrům je +řečeno více. + +Deklarace nejčastěji používaných výjimek se zapisují přímo do +kódovacích souborů. Deklarace méně obvyklých výjimek (vztahujících se +jen na určité rodiny fontů) můžeme psát za "\endinput" deklaračních +souborů. Mezi makra "\ofsdeclarefamily" pak +použijeme příkaz\inl[modifyread] + +\begtt +\modifyread ;% +\endtt +% +Tento příkaz při kladném "\loadingenc" načte daný soubor +od výskytu sekvence "\modifytext"\inl[modifytext]. +Tuto sekvenci je vhodné umístit za "\endinput", aby "\modifyread" +přečetl tu část souboru, která zatím nebyla čtena. +Přiřazení je v době čtení globální a ignorují se konce +řádků a prázdné řádky. Opakovaně se soubor nenačítá. + +Díky tomuto příkazu můžeme soustředit deklarace rodin fontů a +deklarace výjimek z~kódování do společného souboru. Výjimky +\TeX{} přečte až v době, kdy to potřebuje. Šetří se tím paměť \TeX{}u. +Příklad použití je v~souboru "slido.tex". + +OFS nabízí také testovací +makro, zda kontrolní sekvence odpovídá znaku, který je ve fontu +přístupný či nikoli:\inl[knownchar] + +\begtt +\knownchar ? \iftrue znak je přístupný + \else znak je nepřístupný nebo nedefinovaný \fi +% příklad: +\def\tryeuro{\knownchar \euro? \iftrue \euro \else Euro\fi} +\endtt + + +\subsec Pomocná makra pro akcenty a znaky +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Pro pohodlné deklarování defaultních akcentů jsou v~OFS\inl[accentabove] +připravena dvě makra: "\accentabove" a "\accentbelow", +která se používají takto:\inl[accentbelow] + +\begtt +\accentabove {}{}{} +\accentbelow {}{}{} +\endtt + +Příkaz "\accentabove" resp. "\accentbelow" přisadí + nad resp. pod , přičemž mezi těmito +znaky bude . Oba znaky budou na společné vertikální +ose a při skloněném písmu na společné skloněné ose. Šířka výsledného +složeného znaku je odvozena od šířky základního znaku. Makra jsou +implementována jako "\vbox" resp. "\vtop" společně s~"\halign" a +s~výpočtem usazení na případně skloněné ose. + +Znaky pro akcent nahoře jsou ve fontech vesměs kresleny ve výšce +odpovídající základnímu znaku o~výšce 1\,ex. Proto usazení +takového akcentu vyžaduje kompenzaci: + +\begtt +\accentabove {}{-1ex}{} +\endtt + +V~tomto případě se akcent umístí naprosto stejně, jako při použití +primitivu "\accent". Na rozdíl od tohoto primitivu ale makra +"\accentabove" a "\accentbelow" umožnují vzájemné skládání, +čímž můžeme dosáhnout několikanásobného akcentu. Vyzkoušejte: + +\begtt +\it \accentabove {.}{.1ex}{\accentabove {,}{.1ex}{\v A}} +\endtt + +\PLAIN: +Bohužel, makra deklarovaná pomocí "\accentdef" nejsou uzpůsobena na +více než dvojí akcent. Navíc dvojí akcent je možný jen +v~tom případě, že se vnitřní akcent +se základním znakem realizuje jako jediný znak. Pokud potřebujeme +vícenásobný akcent, můžeme vždy použít přímo v~textu makro +"\accentabove" nebo "\accentbelow". + +\PLAIN: +Od verze OFS Feb. 2004 je k dispozici makro +"\ofshexbox"\inl[ofshexbox], které pracuje podobně jako +plainové "\mathhexbox", ale navíc dovede nastavit font podle +aktuální varianty. Nejprve pomocí příkazu +"\ofshexboxdef"\inl[ofshexboxdef] nastavíme \uv{rodinu} čtyř metrik: + +\begtt +\ofshexboxdef {}{}{}{} +\ofshexboxdef 2 {cmsy}{cmbsy10}{cmsy}{cmbsy10} % například takto +\endtt +% +Pak příkaz "\ofshexbox " vytiskne znak s~ +z jednoho ze čtyř deklarovaných fontů a v aktuální velikosti "\fosize" +Volba fontu závisí na aktuální variantě. Pokud je varianta jiná než +"\bf", "\it", "\bi", použije se . OFS implicitně deklaruje +jen = 2, protože plain používá jen "\mathhexbox2..". +Cílem tohoto makra bylo definovat pro CMfonty/CSfonty znaky +"\S", "\dag", "\ddag", "\P" způsobem, který je nezávislý na aktuálním +nastavení matematických fontů, ale je závislý na aktuální velikosti a +variantě. Viz soubor "ofs-8z.tex". + +Pomocí "\ofshexbox" můžeme snadno definovat například symbol +"\euro" pro všechna kódování fontů, ve kterých je tento +symbol nepřítupný: + +\begtt +\ofshexboxdef {TS1}{tcrm1000}{tcbx1000}{tcti1000}{tcbi1000} +\characterdef \euro * {\ofshexbox{TS1}BF} +\endtt + + +\subsec \PLAIN: Fonty v~matematice podruhé +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Nastal čas podrobněji vysvětlit činnost příkazu "\setmath"\inl[setmath]. +Ten převezme parametry a vypočítá z~nich +základní\inl[textfosize], +indexovou a index-indexovou velikost fontů. Výsledky uloží do maker +"\textfosize"\inl[scriptfosize], +"\scriptfosize" a "\scriptscriptfosize". V~nich jsou +údaje o~velikosti uloženy ve tvaru +"at" nebo "scaled<číslo>"\inl[scriptscriptfosize] +podobně jako v~makru "\fosize". Pak příkaz "\setmath" spustí makro +"\mathfonts"\inl[mathfonts]. +V~něm se předpokládá zavedení a nastavení +matematických fontů. +Pokud je "\setmath" spuštěno poprvé nebo pokud došlo ke změně +hodnoty "\fomenc", tak "\setmath" ještě spustí +makro "\mathchars"\inl[mathchars]. +Tam se obvykle nastavují kódy matematických znaků pomocí +"\mathcode", "\mathchardef" a příbuzných primitivů. +Makra "\mathfonts" a "\mathchars" mají sice v~OFS svou +implicitní hodnotu, ale zkušený uživatel je může podle své +potřeby měnit. + +Pro pohodlné zavádění a nastavování matematických fontů je připraveno +makro "\loadmathfam"\inl[loadmathfam], +které se používá v~definici makra "\mathfonts". +Makro "\loadmathfam" má tyto možnosti parametrů: + +\begtt +%% % font je deklarován: +\loadmathfam [/] % metrikou +\loadmathfam [-/] % variantou aktuální rodiny +\loadmathfam [/] % přepínačem textového fontu +\loadmathfam [X/] % rozšiřující metrikou přepínače +\endtt +% +Příklady: + +\begtt +\loadmathfam 0[tenrm/]% metrika podle přepínače \tenrm +\loadmathfam 5[-bi/]% metrika z akuální textové rodiny, varianta bi +\newmathfam \symbfam +\loadmathfam \symbfam [/psyr]% metrika psyr +\newmathfam \extitfam +\loadmathfam \extitfam [Xtenit/]% rozšiřující metrika k přepínači tenit +\endtt +% +V~příkladě jsou do rodiny 0 zavedeny fonty stejné, jako v~aktuálním +textovém fontu "\tenrm". V~rodině 5 jsou zavedeny fonty +jako při~"\setfonts [-bi/]". +Dále je deklarována nová rodina "\symbfam", +do které jsou zavedeny fonty z~metriky "psyr". + +Existuje nepatrný rozdíl např.~mezi použitím příkazu "\loadmathfam 5[tenbi/]" +a "\loadmathfam 5[-bi/]". V~prvním případě OFS zjistí metriku +k~přepínači "\tenbi" a tuto metriku použije ve všech velikostech +stejnou pouze modifikovanou klíčovým slovem "at". +Ve druhém případě se může pro různé velikosti použít různá metrika, +pokud je tato vlastnost pro danou variantu fontu +deklarována (viz~\beglink{3.8}sekce~3.8\endlink). + +Pro deklaraci nové +rodiny se v příkladu použila alternativa k~"\newfam" s~názvem +"\newmathfam"\inl[newmathfam], +protože makro "\newfam" z~plainu je definováno jako "\outer" +a nelze je tedy použít uvnitř definice. Navíc makro +"\newmathfam" pracuje lokálně a tudíž šetří více místa pro uživatelské +rodiny než plainovské "\newfam". +V~deklaracích základních matematických kódování se nové matematické +rodiny definují přímo pomocí "\chardef" a je tam pomocí příkazu +"\lastfam=<číslo>"\inl[lastfam] +nastavena maximální použitá hodonta. To zaručí, že uživatel může +později použít "\newmathfam" a začne alokovat další +rodiny s~čísly těsně většími než "\lastfam". + +Popíšeme nyní princip činnosti makra "\loadmathfam". Toto makro +zjistí metriku, která odpovídá zadanému parametru. +Pak provede třikrát primitiv "\font" zhruba takto: + +\begtt +\font \-Mt = \textfosize +\font \-Ms = \scriptfosize +\font \-Mss = \scriptscriptfosize +\textfont = \-Mt +\scriptfont = \-Ms +\scriptscriptfont = \-Mss +\endtt +% +Přitom je text parametru "\loadmathfam", který deklaruje +metriku (přepínač, varianta nebo metrika). + +Fonty matematické rodiny~3 jsou v~plain\TeX{}u obvykle zavedeny bez +zmenšování pro indexy a indexy indexů. Pokud požadujeme +při zavádění matematické rodiny +nezmenšovat fonty pro indexy, uvedeme těsně před "\loadmathfam" +prefix "\noindexsize"\inl[noindexsize]. +Makro "\loadmathfam" pak zavede font jen ve velikosti "\textfosize" +a použije ho i pro indexovou a indexindexovou velikost. +Příklad: + +\begtt +\noindexsize\loadmathfam 3[tenex/]% Standard extra symbols from CM +\endtt + +OFS definuje v~souboru "ofsdef.tex" pro zavádění matematických fontů +čtyři různá makra. Ta se použijí podle toho, zda je "\fomenc" +nastaveno na "CM" nebo "PS" a "\mathversion" na "normal" nebo "bold". +Dále OFS definuje dvě makra s~deklaracemi matematických kódů, +která se použijí podle aktuálně nastavené hodnoty "\fomenc". + +\begitems +* "\loadCMnormalmath"\inl[loadCMnormalmath] + --- zavede CM fonty ve verzi \uv{normal}. +* "\loadCMboldmath"\inl[loadCMboldmath] + --- zavede CM fonty ve verzi \uv{bold}. +* "\loadPSnormalmath"\inl[loadPSnormalmath] + --- zavede PostScriptové fonty ve verzi \uv{normal}. +* "\loadPSboldmath"\inl[loadPSboldmath] + --- zavede PostScriptové fonty ve verzi \uv{bold}. +* "\setCMmathchars"\inl[setCMmathchars] + --- ponechá matematické kódy z~plainu. +* "\setPSmathchars"\inl[setPSmathchars] + --- nastaví matematické kódy tak, aby se nahradily + některé znaky z~fontu Symbol. +\enditems + +Dále je v~OFS implicitně nastaveno: + +\begtt +\ifx \fomenc\undefined \def\fomenc{PS}\fi +\def\mathversion{normal} +\def\defaultmathfonts{\csname load\fomenc\mathversion math\endcsname}@inl[defaultmathfonts] +\def\defaultmathchars{\csname set\fomenc mathchars\endcsname}@inl[defaultmathchars] +\def\mathfonts{\defaultmathfonts} +\def\mathchars{\defaultmathchars} +\endtt + +Je možné přidávat k~implicitně nastaveným matematickým fontům +další matematické rodiny (v~terminologii NFSS matematické abecedy) +pozměněním maker "\mathfonts" a případně "\mathchars". +Níže je příklad přidání fraktury z~Eulerových fontů od AMS: + +\begtt +\input amsfn % tam je deklarována metrika eufm a eufb +\addcmd\mathfonts{\def\tmpa{bold}% + \ifx\mathversion\tmpa \def\tmpa{b}\else\def\tmpa{b}\fi + \newmathfam\frakfam \loadmathfam\frakfam [/euf\tmpa]} +\def\frak#1{{\fam\frakfam#1}} +\endtt + +Další příklady deklarací matematických rodin +jsou uvedeny v~souborech "amsfn.tex", +"txfn.tex" a "mtfn.tex". Soubory definují výchozí skupiny +matematických fontů pro kódování "AMS", "TX", "PX", "MT". +Na konci těchto souborů jsou komentáře včetně ukázek, jaké +doplňující rodiny fontů je možno pomocí "\addcmd" zavést. + +Protože chci umožnit načtení všech fontových deklarací OFS +v~ini\TeX{}u (viz projekt Ok\TeX{}), ale přitom šetřit pokud +možno pamětí \TeX{}u, rozhodl jsem se nenačítat rozsáhlé definice +obsahující deklarace kódování matematických fontů pomocí +"\mathchardef" atd. okamžitě, ale až v době, kdy to uživatel +v dokumentu skutečně potřebuje. +Proto jsem od verze OFS Apr. 2004 předefinoval například makro +"\setPSmathchars" takto: + +\begtt +\def\setPSmathchars{\mathencread ofs-ps;} +\endtt +% +Příkaz "\mathencread ;"\inl[mathencread] +načte kódovací příkazy ze souboru +. Např. v~souboru "ofs-ps.tex" jsou kódovací příkazy pro +kódování "PS", v~"ofs-ams.tex" jsou kódovací příkazy pro kódování +"AMS"~atd. + +V~souborech "ofs-ps.tex", "ofs-tx.tex" atd. +jsou kódovací příkazy \uv{baleny} do skupin a +definovány příkazem "\mathencdef"\inl[mathencdef]. Tento příkaz +pracuje implicitně jako \uv{definuj, spusť a zapomeň}. Tento model +šetří paměť, ale při častých změnách matematického kódování budou +kódovací soubory čteny opakovaně znovu. To většinou nevadí, protože +většinou bývá pro celý dokument nastaveno jediné matematické kódování. +Pokud ale tento model někomu nevyhovuje, může si jako cvičení zkusit +předefinovat "\mathencread" a "\mathencdef" tak, aby se soubory četly +jen jednou a při opakovaném spuštění "\mathchars" se kódovací příkazy +četly ze zapamatovaných maker. + +Příkaz "\mathencread ;" založí skupinu, ve které pro jistotu +nastaví kategorie všech znaků podle plain\TeX{}u +(s~výjimkou "\catcode`@=11") a přečte ".tex". +Při čtení je "\globaldefs=1" a ignorují se konce řádků a prázdné řádky. +Rovněž je ignorováno makro "\protectreading", takže soubor může být +čten opakovaně. Příkazy "\mathencdef" spustí a zapomenou +nadefinovaná makra až po uzavření skupiny, +takže tato makra spouští příkazy "\mathchardef" atd. už jen +s~lokálními přiřazeními. + +Vysvětlíme, jak je zajištěno obnovování výchozích hodnot +při přepínání mezi matematickými kódováními. +Příkaz "\setmath" spouští těsně před "\mathchars" makro +"\mathcharsback"\inl[mathcharsback], aby uvedl matematické kódování +do výchozího stavu podle plain\-\TeX{}u. +Toto makro má implicitně význam +"\relax", protože implicitně je matematické kódování +podle plain\TeX{}u nastaveno. +Mění-li ale příkaz "\setmathchars" hodnoty nastavené +v~plain\TeX{}u, měl by také definovat makro +"\mathcharsback", do kterého uloží postup, jak +vrátit nastavení do původního stavu. +V definici makra "\mathcharsback" můžeme mimo jiné použít +příkaz "\mathencread ofs-cm;", protože v~souboru "ofs-cm.tex" +jsou uloženy deklarace metamatického kódování podle plain\TeX{}u + +Pokud si budeme deklarovat vlastní matematická kódování (různá od +připravených "PS", "CM", "AMS" atd.), pak je potřeba myslet na +následující zásadu: ve všech verzích matematických fontů +(normal/bold/atd.) by měla být čísla matematických rodin alokována +stejně a ukončena stejným "\lastfam", protože makro "\mathchars" se po +přepnutí do jiné verze nespouští znovu. Zvláště nesmíme měnit +čísla těch rodin, na které se odvoláváme v~makru +"\setmathchars". + +Nyní popíšeme další makra ulehčující deklaraci matematického kódování. +Makro "\hex"\inl[hex] +konvertuje číslo na jednociferné hexadecimální +číslo. Využití tohoto makra najdeme v~souborech "ofs-ps.tex", +"ofs-tx.tex" a dalších. + +Pro definování sekvencí, které budou pracovat v textovém i +matematickém módu současně, slouží makro +"\safemathchardef"\inl[safemathchardef]. +Toto makro má stejný způsob použití, jako primitivní "\mathchardef": + +\begtt +\safemathchardef \ <číslo> +\endtt + +Pokud není "\" v~okamžiku použití "\safemathchardef" +definována, příkaz pracuje zcela stejně jako "\mathchardef". +Pokud ale je "\" už definována, uloží příkaz +"\safemathchardef" její význam do "\T", dále provede +"\mathchardef \M = <číslo>" a konečně "\" +předefinuje následujícím způsobem: + +\begtt +\def \ {\ifmmode \expandafter \M + \else \expandafter \T \fi} +\endtt +% +Od této chvíle "\" pracuje v textovém i matematickém módu. +Pro případ opakovaného použití "\safemathchardef" na stejnou +"\" makro kontroluje, zda už není definována "\M". +Pokud ano, pak "\safemathchardef" neprovede nic. + +Je potřeba, aby byly soubory s~příkazy "\characterdef" +načteny před prvním použitím "\setmath". Pak lze v~rámci +"\setmath" (přesněji v~makru "\mathchars") použít +"\safemathchardef" na předefinování některých sekvencí, +které byly dříve deklarovány pomocí "\characterdef". Tyto sekvence pak +budou pracovat v textovém i matematickém módu. + +Naprosto stejně, jako "\safemathchardef" pracuje příkaz +"\safemathaccentdef"\inl[safemathaccentdef]. +Pouze místo primitivu "\mathchardef" použije +makro "\mathaccentdef"\inl[mathaccentdef], +které přečte za "\" "<číslo>" separované mezerou +a provede: + +\begtt +\def \ {\mathaccent<číslo> } +\endtt + +Pokud nechceme deklarovat novou matematickou rodinu pro několik +málo znaků (počet matematických rodin je totiž v~\TeX{}u +omezen na 16), můžeme použít makro +"\pickmathfont"\inl[pickmathfont], které má tyto +parametry: + +\begtt +\pickmathfont {}{} +% příklad použití: +\mathbin {\pickmathfont {psybo}{\char"C4}} +\endtt +% +Makro "\pickmathfont" použije primitiv "\font" na specifikovanou + a v~tomto fontu zapíše , který v~matematickém seznamu +tvoří atom typu Ord. Důležité je, že je použit font v~odpovídající +velikosti (základní, indexová, indexindexová), takže to vypadá, jako +by byl použita nová matematická rodina fontů. Přitom to není pravda, +protože "\pickmathfont" je implementován pomocí primitivu "\mathchoice". +Použití příkazu "\pickmathfont" najdeme v~souboru "ofsdef.tex" +v~definici makra "\setPSmathchars". + + + +\subsec Registrování metrik pro různé velikosti +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: Registrování různých metrik pro různé velikosti se dělá +ve~"fd" souborech a je to dokonale vyřešeno v~NFSS. + +\PLAIN (až do konce sekce): +Existují speciální rodiny fontů (například Computer Modern), kde se +pro různé velikosti fontů používají různé metriky. I~tato vlastnost je +implementována v~OFS. Dosud jsme zatajili, že v~parametrech příkazů +"\loadtextfam", "\loadmathfam" a "\pickmathfont" je možné místo názvů +metrik uvést smyšlené , které je registrováno příkazem +"\registertfm"\inl[registertfm]. +V~takovém případě se skutečná metrika pro zavedení primitivem "\font" +vypočítá z~požadované velikosti fontu a z~údajů, které byly zadány +pomocí skupiny příkazů "\registertfm". Upřesníme nyní parametry +příkazu "\registertfm": + +\begtt +\registertfm - +\endtt + +Parametry a musejí obsahovat jednotku a vymezují uzavřený +interval, pro který platí: jestliže je požadovaná velikost fontu +ve tvaru "at" a současně leží +v~intervalu "-", pak se místo použije +" at". +Příkaz "\registertfm" je potřeba pro vymezení různých +intervalů použít opakovaně na stejné . +Ačkoli jsou intervaly "-" uzavřené, později +deklarovaný interval má přednost před dříve deklarovaným, takže nakonec +je kladná reálná osa rozdělena na polouzavřené intervaly. Příklad +použití je v~souboru "ofsdef.tex". + +Jsou-li oba parametry a prázdné, je příkazem "\registertfm" +deklarována metrika, která se použije při specifikaci velikosti pomocí +"scaled<číslo>" nebo v~případě, kdy neleží v~žádném +specifikovaném intervalu. Hvězdička místo parametru značí +\uv{nekonečnou velikost}. + +Příkaz "\registertfm - - " +vymaže z~paměti předchozí registrace pro dané a navíc vyznačí + jako nepřístupný font. OFS se pak chová stejně, jakoby odpovídající +varianta nebyla vůbec deklarována. Dává nám to +možnost vyznačit neexistující varianty deklarované rodiny +jen pro některá kódování (viz například "cmssbxti" +v~souboru "ofsdef.tex"). + +Parametry a se expandují v~okamžiku +činnosti příkazu "\registertfm". Není proto obvyklé v~nich používat +makro "\fotenc". Nicméně toto makro můžeme v~uvedených parametrech +použít, pokud zahrneme potřebnou skupinu příkazů "\registertfm" +do vlastního makra a toto makro spustíme opakovaně pro různé +hodnoty "\fotenc". + +Makro "\registerECfont"\inl[registerECfont] +je zkratkou za opakované použití příkazu +"\registertfm" na všechny velikosti EC fontů od "0500" +až po "3583". Stejně makro +"\registerECTTfont"\inl[registerECTTfont] +je zkratkou pro velikosti EC fontů od "0800" do "3583" používané pro +strojopis. Definice a použití těchto maker najdeme v souboru +"ofsdef.tex". Makra můžeme použít i na jiné fonty, které mají stejně +odstupňované velikosti jako EC fonty (např. LH fonty s~azbukou nebo +fonty odvozené z~CM-super). + + +\subsec Omezení použití rodiny fontů pro určitá kódování +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LATEX: Použití rodiny v~daném kódování je závislé na existenci +"fd" souboru, tj.~vše je v~režii NFSS. + +\PLAIN (až do konce sekce): +OFS od verze Feb.~2004 zavádí příkaz "\registerenc",\inl[registerenc] +kterým můžeme omezit použití deklarované rodiny fontů +jen pro vymezená kódování. +Pokud pak uživatel napíše "\setfonts" a vyžaduje rodinu +v~neregistrovaném kódování, OFS vypíše varování na obrazovku +a vůbec do požadované rodiny nepřepne. Tím se vyhne pokusu zavést +pravděpodobně neexistující metriky fontů. Příkaz "\registerenc" +má dva parametry: + +\begtt +\registerenc : +\registerenc Times: 8t % například +\registerenc Times: 8z % nyní má Times registrována dvě kódování +\endtt + +Pokud nemá rodina registrováno žádné kódování, pak OFS předpokládá, že +je použitelná v~jakémkoli kódování (například fonty značek). + +V~deklaračních souborech tedy můžeme pomocí "\registerenc" omezit +použití rodiny jen na vymezená kódování. Uživatel ale může +příkazem "\registerenc" přidat k~rodině další povolené kódování. Nebo +také může naznačit, že rodina má povoleno libovolné kódování +příkazem "\registerenc : * ". + +Abychom v~deklaračních souborech nemuseli opisovat , může +být tento parametr prázdný. V~takovém případě "\registerenc" použije +rodinu z~posledního příkazu "\ofsdeclarefamily". + +Ve svých makrech se můžete zeptat, zda je rodina pro aktuální hodnotu +"\fotenc" registrovaná:\inl[registeredfam] + +\vbox \bgroup +\begtt +\registeredfam ? \iftrue + Rodina má \fotenc registrováno nebo má povoleno jakékoli kódování + nebo vůbec není deklarována. +\else Rodina má registována kódování, ale \fotenc mezi nimi není. +\fi +\endtt \egroup + +Pokud spustíme "\setfonts[/]" pro nedeklarovanou rodinu +nebo pro rodinu s~nedovoleným kódováním, +pak OFS napíše varování na terminál a vrátí "\setfontsOK"\inl[setfontsOK] +jako "\undefined". Po úspěšném nastavení fontu má sekvence +"\setfontsOK" hodnotu "\relax". + + +\sec Licence +%%%%%%%%%%%% + +Balíček OFS může používat kdokoli bez licenčních poplatků. Kdokoli jej +rovněž může distribuovat, pokud nezmění obsah souboru "readme.ofs" +"ofs.tex", "ofsdef.tex", "ofs.sty", "ofs-8z.tex", +"ofs-8t.tex", "a35.tex", "a35.sty", "ofsdoc.tex", "ofsdoce-e.tex", +"ofsmtdef.tex" a +všechny tyto soubory budou v distribuci přítomny. +Právo na změnu těchto souborů a +tím změnu verzí zůstává výhradně autorovi. Pokud potřebujete změnit +obsah některého z~uvedených souborů, nazvěte jej jinak. Balíček je +poskytován s~přáním, aby byl užitečný, ale BEZ JAKÉKOLI ZÁRUKY. + +\bigskip +V~Praze dne 16. 8. 2001 \hfill autor: Petr Olšák + + +\sec Historie +%%%%%%%%%%%%% + +\noindent +16. 8. 2001 --- uvedena první verze + +\noindent +24. 10. 2002 --- provedeny drobné úpravy respekutjící změny +ve verzi OFS Oct.~2002. +V této verzi byl přidán příkaz "\addcmd" a byly +umožněny nepovinné parametry +"()" v příkazu "\loadtextfam". + +\noindent +10. 2. 2004 --- Všechny úpravy se týkají jen OFS pro plain: + +\def\bod{\hangindent=1.2em \hangafter=1 \noindent + } + +\bod Vylepšena manipulace s deklaracemi maker +závislých na kódování, deklarace výjimek a registrování kódování pro +zvolenou rodinu. +Viz~\beglink{3.5}sekce~3.5\endlink{} a \beglink{3.9}sekce~3.9\endlink. + +\bod Přidána možnost předefinování rodiny (např. dodatečným načtením +souboru deklaračního souboru, který modifikuje vlastnosti implicitních rodin). + +\bod Deklarace CMRoman, CMSans a CMTypewriter pro kódování 8t +použitím EC fontů. + +\bod Přidána podpora rozšiřujícího kódování 8c. + +\bod Upravena deklarace matematického kódování PS, aby "\int", +"\sum" a "\prod" pracovaly v~display módu s~většími znaky. + +\bod Definováno makro "\ofshexbox" a "\ofshexboxdef". + +\bod Nově zveřejněno interaktivní makro "ofstest.tex". + +\bod Zaveden adresář "examples/", kde průběžně budu dávat +příklady použití OFS. + +\noindent +12. 3. 2004 --- OFS pro plain: + +\bod Kódovací soubory jsou čteny přímo z "\loadtextfam". +Tím je umožněno dávat do kódovacích souborů mapování metrik příkazem +"\registerenc" (využiju pro LANG). + +\bod "\characterdef" respektuje definované makro a nepředefinuje jej. + +\bod Reimplementováno "\showfonts". Nyní šetří výrazně paměť i čas na +rozsáhlých seznamech fontů. Pozor: pokud jste měli makra využívající +interní makro "\listfamilies", pak toto přestane +fungovat. Např. nefunguje od této verze zastaralé "ofscatal.tex". +Místo něj je možno použít "ofstest.tex" + +\bod Modifikováno "ofstest.tex", aby pracovalo s novou implementací +seznamu rodin "\ofslistfamilies". + +\noindent +2. 4. 2004 --- přidáno "\plaincatcodes" před čtením souborů "ofs-.tex". + +\bod Zavedeno "\safelet" a "\protectreading". + +\bod Mezera za v "\accentdef" je nepovinná. + +\bod Přidána možnost "\loadmathfam [-/]" a rozšířena +a přepracována deklarace pro matematická kódování "CM", "PS", "AMS", +"TX", "PX", "MT". + + +\sec Rejstřík všech maker definovaných v~OFS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Rejstřík obsahuje odkazy pouze na místa v~textu, kde je k~makru +vysvětlující komentář. V~tom místě je též uveden pro snadnější orientaci +název makra v~levém okraji. V~rejstříku nejsou odkazy na +všechny zmínky o~makru v~textu. Rejstřík je správně vygenerován hned +po prvním průchodu zpracování tohoto dokumentu příkazem "csplain ofsdoc". + +Některá makra definovaná v~"ofs.tex" jsou interní nebo pomocná +a není o~nich zmínka v~textu. Pak odkaz na stranu záměrně chybí a je +připojena jen krátká poznámka o~takovém makru. Rovněž jsou připojeny +poznámky o~tom, zda je makro použito ve verzi pro +{\smallbf PLAIN} nebo {\smallbf LATEX}. + + +\bigskip +\immediate\closeout\indout +\input \jobname.ind + +\begingroup +\let\tt=\smalltt \let\it=\smallit \let\rm=\smallrm \rm +\baselineskip=10.3pt + +\def\inr #1 #2 #3;{\noindent{\tt + \expandafter \ifx \csname ind:#2\endcsname \relax + \back#1% + \else + \beglink{#2}\back#1\endlink + \fi}\quad + #3 \quad\pg[#2]\par} +\def\\#1 #2;{\inr #1 #1 #2;} +\def\pl{{\sevenrm (PLAIN)}} +\def\la{{\sevenrm (LATEX)}} +\def\oba{{\sevenrm (PLAIN+LATEX)}} + +\\accentabove \pl; +\par\nobreak +\\accentbelow \pl; +\\accentdef \pl; +\\accentdel \pl; +\\accentdefori \unskip, {\tt\back accentdelori} \pl~interní, + udržují původní význam maker; +\\accentnodef \pl~interní, {\tt\back def\back \#1% + \char`\{\back printaccent\char`\{\char`\}\char`\{\#1\char`\}\char`\}}; +\\addcmd \oba; +\inr bf rm \oba; +\inr bi rm \oba; +\\bifam \pl~interní, matematická rodina pro BoldItalic; +\\calculatemetricfile \pl~interní, definuje {\tt\back metricfile} + podle velikosti; +\\catcodesloop \pl~interní, nastaví kategorie znaků v cyklu podle daného čísla; +\\characterdef \pl; +\\characterdel \pl; +\\characterdefori \unskip, {\tt\back characterdelori} \pl~interní, + udržují původní význam maker; +\\characternodef \pl~interní, {\tt\back def\back % + \char`\{\back printcharacter\char`\{\char`\}\char`\}}; +\\currentfamily \pl; +\\currentfomenc \pl~interní, jméno naposledy použitého matemat. kódování; +\\currentvariant \pl; +\\declaredfamily \pl~interní, obsahuje jméno naposledy deklarované rodiny; +\\defaultextraenc \pl; +\\defaultmathchars \pl; +\\defaultmathfonts \pl; +\\defpttotmpa \pl~interní, udělá {\tt\back def\back tmpa\char`\{pt\char`\}}, + pokud chybí jednotka; +\\detailfontmessages \pl; +\\displayfontmessages \pl; +\\displaymessage \pl; +\\docharacterdef \pl~interní, pro potřeby makra {\tt\back characterdef}; +\\doextchar \pl~interní, pro potřeby makra {\tt\back extchar}; +\\dosafemathdef \pl~interní, pro potřeby maker {\tt\back safemath*def}; +\\donumbercharacterdef \pl~interní, pro potřeby makra {\tt\back characterdef}; +\\endOFSmacro \pl~interní, možnost čtení {\tt[, ...]} za + {\tt\back input ofs}; +\\expandaction \pl; +\\extchar \oba; +\\extraenc \pl; +\\extrafont \pl; +\\fontdef \oba; +\\fontloadmessage \pl~interní, výpis informace o~provedení {\tt\back font}; +\\fontmessage \pl~interní, střídá hodnoty nic, + {\tt\back wlog} a {\tt\back displaymessage}; +\\fontprefix \pl~interní, střídá hodnotu nic a {\tt\back global}; +\\fontusage \oba; +\\fosize \pl; +\\fomenc \pl; +\\fotenc \pl; +\\fragilecommand \pl; +\\fragilecommand! \pl; +\\hex \pl; +\\ifknownfam \oba; +\\isunitpresent \pl~interní, řeší případ absence jednotky; +\inr it rm \oba; +\\knownchar pl; +\\knownfam pl; +\\lastfam pl; +\\lccodes \unskip, {\tt\back lccodesloop} \pl; +\\loadCMboldmath \pl; +\\loadCMnormalmath \pl; +\\loadingenc \pl; +\\loadmathfam \pl; +\\loadPSboldmath \pl; +\\loadPSnormalmath \pl; +\\loadtextfam \pl; +\\logfontmessages \pl; +\\mathaccentdef \pl; +\\mathchars \pl; +\\mathcharsback \pl; +\\mathencdef \pl; +\\mathencread \pl; +\\mathfonts \pl; +\\mathversion \pl; +\\metricfile \pl~interní, jméno metriky při použití {\tt\back font}; +\\metrictmpa \pl~interní, expanduje na metriku fontu {\tt\back tmpa}; +\\modifydef \pl; +\\modifyenc \pl; +\\modifylist \pl; +\\modifyread \pl; +\\newfamily \pl~přechodné, zadané jméno rodiny; +\\newmathfam \pl; +\\newmodifylist \pl; +\\newvariant \pl; +\\nofontmessages \pl; +\\noindexsize \pl; +\\noPT \pl~interní, odstraní {\tt pt} z~{\tt\back the} [TBN, str.~80]; +\\ofsaddenctolist \pl~interní, přidá parametr do seznamu {\tt\back newmodifylist}; +\\OFSdeclarefamily \la; +\\ofsdeclarefamily \pl; +\\OFSextraencoding \la; +\\OFSfamily \la; +\\OFSfamilydefault \la; +\\ofshexbox \pl; +\\ofshexboxdef \pl; +\\ofsinput \pl~interní, čte soubor při {\tt\back globaldefs=1}, ignoruje konce řádků; +\\ofslistfamilies \pl~interní, seznam rodin pro {\tt\back showfonts}; +\\ofslistfamily \pl~interní, uvozuje rodinu v {\tt\back listfamilies}; +\\ofslistvariants \pl~interní, text pro výpis variant do logu; +\\ofslisttext \pl~interní, uvozuje text v {\tt\back listfamilies}; +\\ofsloadfont \pl~interní, zavede jeden font; +\\ofsloadfontori \pl~interní, zavede jeden font; +\\ofsmeaning \pl~interní, vykostí z~výstupu {\tt \back meaning} slovo + {\tt letter}/{\tt character}; +\\ofsmessageheader \pl~interní, hlavička hlášení do logu a na terminál; +\\OFSnormalvariants \la; +\\OFSprocessoptions \la; +\\OFSputfamlist \la; +\\ofsputfamlist \pl; +\\ofsremovefromlist \pl~interní, odstraní rodinu ze seznamu; +\\OFSversion \oba~interní, datum verze makra; +\\orifosize \pl~přechodné, podrží hodnotu {\tt\back fosize}; +\\origTeX \pl~interní, originální definice loga \TeX; +\\oriloadfam \pl~přechodné, podrží hodnotu {\tt loadtextfam}; +\\pickmathfont \pl; +\\plaincatcodes \pl~interní, nastaví kategorie znaků podle plain\TeX{}u; +\\printaccent \pl; +\\printaccentwarn \pl; +\\printcharacter \pl; +\\printcharacterwarn \pl; +\\processOFSoption \pl~interní, pro potřeby makra {\back endOFSmacro}; +\\protectreading \pl; +\\readfamvariant \pl~interní, testuje, zda je zadána varianta rodiny; +\\readfirsttoken \pl~interní, vrátí první token textu ukončeného {\tt:\back end}; +\\readfosize \pl~interní, vloží hodnotu {\tt\back fosize} + do {\tt\back dimen0}; +\\readmag \pl~interní, počítá {\tt\back fosize}, je-li dáno + {\tt mag}; +\\readOFSoptions \pl~interní, pro potřeby makra {\tt\back endOFSmacro}; +\\readothertokens \pl~interní, vrátí druhý a další tokeny až po {\tt:\back end}; +\\readsixdigits \pl~interní, využito pro zaokrouhlování; +\\registeredfam \pl; +\\registerECfont \pl; +\\registerECTTfont \pl; +\\registerenc \pl; +\\registertfm \pl; +\\restorefontid \pl~interní, obnovení jména fontu, viz {\tt\back savefontid}; +\\rm \oba; +\\runmodifylist \pl; +\\safelet \pl; +\\safeletwarn \pl; +\\safemathaccentdef \pl; +\\safemathchardef \pl; +\\savefontid \pl~interní, pro udržení jména fontu ve výpisech Overfull; +\\savetokenname \pl~interní, něco jako {\tt\back string} bez backslashe; +\\scriptfosize \pl; +\\scriptscriptfosize \pl; +\\separeofsvariant \pl~interní, separace nepovinného parametru + {\tt\back loadtextfam}; +\\setextrafont \oba; +\\setCMmathchars \pl; +\\setfonts \oba; +\\setfontshook \pl; +\\setfontsOK \pl; +\\setfontfamily \pl~interní, {\tt\back setfonts}, + pokud není dána varianta; +\\setfosize \pl~interní, vypočítá hodnotu {\tt\back fosize}; +\\setmath \pl; +\\setPSmathchars \pl; +\\setsimplemath \pl; +\\setsinglefont \pl~interní, {\tt\back setfonts}, + pokud je dána varianta; +\\setsinglefontname \pl~interní, vykostí z názvu metriky případné "at"; +\\sgfamily \pl~interní, pro uložení informace o~rodině; +\\sgvariant \pl~interní, pro uložení informace o~variantě; +\\showfonts \oba; +\\singlefont \pl; +\\singlefontname \pl~interní, odstraní {\tt at} z~názvu metriky; +\\skipfirststep \pl; +\\slantcorrection \pl~interní, pro potřeby + {\tt\back accentabove} a {\tt\back accentbelow}; +\\storeofsvariant \pl~interní, separace nepovinného parametru + u~{\tt\back loadtextfam}; +\\switchdeftodel \pl~interní, prohodí {\tt\back accent/characterdef} + s~{\tt\back *del}; +\\tenbi \pl; +\inr tenbf tenrm \pl; +\inr tenit tenrm \pl; +\\tenrm \pl; +\\testOFSoptions \pl~interní, pro potřeby makra {\tt\back endOFSmacro}; +\\testtfmsize \pl~interní, pro potřeby {\tt\back registertfm}; +\\testtfmsizeat \pl~interní, přechodná hodnota {\tt\back testtfmsize}; +\\testtfmsizescaled \pl~interní, přechodná hodnota {\tt\back testtfmsize}; +\\textfosize \pl; +\\tryloadenc \pl~interní, načte kódovací soubory; +\\tmpa \oba~přechodné; +\\tmpb \oba~přechodné; +\\tmpc \pl~přechodné; +\\warnmissingfont \pl~interní, výpis o~chybějící variantě; +\\warnM \unskip, {\tt\back warnF}, {\tt\back warnT}, {\tt\back warnI} +\pl~interní, výpis o~chybějící standardní variantě; +\\warnunregistered \pl~interní, výpis o~nedovoleném kódování zvolené rodiny; + +\endgroup + +\sec Reference + +\noindent \hangindent=2\parindent +[TBN] Petr Olšák {\it \TeX{}book naruby}, Konvoj +1.~vyd. 1997 (ISBN 80-7302-007-6), +2.~vyd. 2001 (ISBN 80-85615-64-9), Brno, 466 stran. +PDF verze knihy je volně k~dispozici na +{\tt http://math.feld.cvut.cz/olsak/tbn.html}. + + + +\end + + + diff --git a/macros/generic/ofs/doc/papers/eurotex2003-ofs.pdf b/macros/generic/ofs/doc/papers/eurotex2003-ofs.pdf new file mode 100644 index 0000000000..8b2c08b442 Binary files /dev/null and b/macros/generic/ofs/doc/papers/eurotex2003-ofs.pdf differ diff --git a/macros/generic/ofs/doc/papers/eurotex2003-ofs.tex b/macros/generic/ofs/doc/papers/eurotex2003-ofs.tex new file mode 100644 index 0000000000..1a6601da37 --- /dev/null +++ b/macros/generic/ofs/doc/papers/eurotex2003-ofs.tex @@ -0,0 +1,1089 @@ + +\chyph % use csplain + +\newcount\firstpage \firstpage=1 +\newcount\numpages \numpages=14 + +\def\addcmd #1#2{\expandafter\def\expandafter\tmpa\expandafter{#1}% + \def\tmpb{#1}% + \ifx\tmpa\tmpb % the #1 is not a macro + \expandafter\let\csname \string#1-original\endcsname =#1% + \expandafter\def\expandafter #1\expandafter{% + \csname\string#1-original\endcsname #2}% + \else % the #1 is a macro + \expandafter\def\expandafter #1\expandafter{#1#2}% + \fi} + + +\input ofs [ffonts] % Charter je ve skupině free fonts + +\setfonts [Charter/10pt] % výchozí rodina +\setmath[//] % inicializace matematiky +\fontdef\tt [CMTypewriter/mag1.1] % strojopis, korekce střední výšky +\fontdef\verbtt [CMTypewriter-rm/8] % strojopis pro display ukázky +\fontdef\small [!/9] % zmenšení pro abstrakt a záhlaví +\addcmd \small {\baselineskip11pt \rm \def\mathversion{normal}\setmath[//]} +\fontdef\fontsekce [!/12] % pro nadpisy sekcí +\addcmd \fontsekce {\bf \let\it=\bi \def\mathversion{bold}\setmath[//]} +\fontdef\fonttitul [!-bf/14.4] % titul + +\hsize=12,2cm +\vsize=19,3cm +\hoffset=63pt +\voffset=43pt +\parindent=14pt + +\lineskiplimit=-10pt +\raggedbottom + +\exhyphenpenalty=10000 +\widowpenalty=10000 +\clubpenalty=10000 + +\showboxdepth=10 \showboxbreadth=50 + +\def\starthead{\global\headline= + {\small \ifodd\pageno \hfil \thetitul \headspace \the\pageno + \else \the\pageno \headspace \theauthor \hfil \fi}} +\headline={\hfil\starthead} +\def\headspace{\hskip2.5em\relax} +\def\makeheadline{\vbox to0pt{\vskip-25pt + \line{\vbox to8.5pt{}\the\headline}\vss}\nointerlineskip} +\footline={\setfonts[/7]\setmath[//]\baselineskip=9pt + \vbox{\hbox{\copytext}\hbox{\copykonvoj}}\hfil + \global\footline={}} +\def\lastpage{\advance\firstpage by\numpages \advance\firstpage by-1 + \the\firstpage} + +\def\copytext{Euro\TeX{} 2003} +\def\copykonvoj{} + +\newcount\subnum + +\def\kap #1\par{\advance\subnum by1 + \removelastskip %\goodbreak + \vskip17pt plus2pt minus1pt\noindent{\fontsekce + \ifnum\subnum>1 \the\subnum\enspace\enspace\fi #1}% + \par\nobreak\vskip11pt plus2pt minus1pt + \everypar{\setbox0=\lastbox \everypar={}}} +\def\reference {\subnum=-1 \kap Reference\par \small} +\def\bib{\par\advance\subnum by1 \leftskip=\parindent + \noindent\llap{\the\subnum.\enspace}\ignorespaces} + +\let\orifootnote=\footnote +\newcount\footnotenum +\def\footnote#1{\global\advance\footnotenum by1 + \orifootnote{$\setmath[//]^\the\footnotenum$}{\small + \hangindent=\parindent #1\par}} +\def\footnoterule{\kern-3pt \hrule width 2cm \kern2.6pt } + +\def\titul #1 \par{\def\thetitul{#1}\pageno=\firstpage + \centerline{\fonttitul #1}\vskip20pt\relax} +\def\autor #1 \par{\def\theauthor{#1} + \centerline{#1}\vskip10pt\relax} +\def\institut #1 \par{\centerline{\small #1}} +\def\email #1 \par{\centerline{\small Email: \tt #1}\vskip20pt\relax} +\def\abstrakt {\bgroup \small + \leftskip=3em \rightskip=3em + \noindent{\bf Abstract:}\enspace} +\def\endabstrakt {\par\egroup\bigskip} +\def\url#1{{\tt#1}} + +\def\begitems{\medskip\bgroup\catcode`\*=13 \narrower} +\def\enditems{\par\egroup\medskip} +{\catcode`\*=13 \gdef*{\par\noindent\llap{$\bullet$\kern.6em }\ignorespaces} +\gdef\numerate{% \numerate napsat těsně za \begitems + \def*{\par\advance\itemnum by1\noindent + \llap{\bf\the\itemnum.\kern.6em }\ignorespaces}}} + + +\font\mflogo=logo10 % METAFONT logo +\font\boldsy=cmbsy10 at12pt % Tučné \CS, \AMS. +\font\bboldsy=cmbsy10 scaled\magstep2 % Tučné \CS v titulu + +\def\CS{$\cal C\kern-.1667em\lower.5ex\hbox{$\cal S$}\kern-.075em $} +\def\bCS{{\boldsy C\kern-.1667em\lower.5ex\hbox{S}\kern-.04em}} +\def\CSTeX{\CS\TeX} +\def\CSTUG{\CS TUG} +\def\CSfont{\CS\kern.1em font} +\def\csplain{\CS\kern.1em plain} \let\CSplain=\csplain +\def\mf{{\mflogo META}\-{\mflogo FONT}} +\def\mp{{\mflogo META}\-{\mflogo POST}} +\def\LaTeX{L\kern-.2em\raise.45ex\hbox{\setfonts[/mag.7] A}\kern-.05em\TeX} +\def\twoe{$2_{\textstyle\varepsilon}$} +\def\LaTeXe{\LaTeX\thinspace\twoe} +\def\cslatex{\CS\kern.05em\LaTeX} \let\CSLaTeX=\cslatex +\def\twoe{$2_{\textstyle\varepsilon}$} +\def\LaTeXe{\LaTeX\thinspace\twoe} +\def\AMS{$\cal A\kern-.166em\lower.5ex\hbox{$\cal M$}\kern-.075em S$} +\def\bAMS{{\boldsy A\kern-.166em\lower.5ex\hbox{M}\kern-.075em S}} +\def\ps{Post\-Script} +\def\SLT{S\kern-0.025em\lower.5ex\hbox{L}\kern-.2emT} +\def\DOS{\hbox{DOS}} + +%% Definice verbatim prostředí %% !verb. +\catcode`\"=13 +\def"{\hbox\bgroup\let"=\egroup\setverb\tt} +\def\setverb{\def\do##1{\catcode`##1=12}\dospecials\obeyspaces} +\def\begtt{\medskip\bgroup + \nobreak\setverb \parskip=0pt %\parindent=0pt + \catcode`\"=12\catcode`\~=13 \obeylines + \baselineskip=10pt + \let\tt=\verbtt \startverb} +{\catcode`\|=0 \catcode`\\=12 + |gdef|startverb#1\endtt{% + |tt#1|nobreak|egroup|penalty0|medskip|scannexttoken}} +{\obeyspaces\gdef {\ }} +\long\def\scannexttoken#1{\ifx#1\par\else\noindent#1\fi} + +\def\citeref #1 #2 {\expandafter\def\csname cit:#1\endcsname{#2}} +\citeref wwwstorm 1 +\citeref pismolijna 2 +\citeref stormtex 3 +\citeref slido 4 +\citeref ofsftp 5 +\citeref ofsdoc 6 +\citeref stormcl 7 +\citeref berry 8 +\def\cite#1{\expandafter\ifx \csname cit:#1\endcsname\relax + \message{Warning: cite{#1} is not defined}[??]% + \else [\csname cit:#1\endcsname]\fi} + +%------------------------------------------------------------------------- + +This version of the paper is only draft! It waits to Petr Sojka's corrections. +\bigskip + +\titul The font management with the OFS + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\autor Petr Ol\v s\'ak, Petr Sojka + +\institut Faculty of Electro Engineering CVUT, Prague, + Faculty of Informatics MU, Brno + +\email petr@olsak.net, sojka@fi.muni.cz + +\abstrakt + +The widely used New Font Selection System (NFSS) has its pros and cons. +To have uniform platform for large font set management and selection for +both plain and \LaTeX\ users, and to extend the possibilities +of the NFSS, an Ol\v{s}\'ak's Font System (OFS) has been designed +and implemented. + +The user interface of this macro is the same for plain and +\LaTeX, with two independent implementations. First implementation +is based on plain.tex macros only; the second one for \LaTeX\ users +is implemented as an additional layer over NFSS macros, and is +slightly less elaborate (support for math font families is missing). + +The main features of the system: + +\begitems +* The OFS defines declarative language to define the mapping from + the original full names of fonts to the tfm names (in plain) or + to NFSS short names of the font families (in \LaTeX). + The user do not need to remember the short names of tfm files + and/or the short names of NFSS font families. This allows for + user-defined logical font markup: one can use the real font + (foundry) names from font (catalog). +* The user of the OFS can use a font separated into two \TeX{} metrics + (basic and extended tfm). The font is from the user perspective seen + as one font only. The mapping works even for fonts with more than 256 + characters (if one does not want to kern between all characters). +* One can choose the \TeX{} internal encoding of fonts for your + language at the beginning of your document. This feature is commonly + used for Czech and Slovak languages: there are \TeX{} fonts which + encode the alphabets of these languages by Cork (T1 encoding) or by + ISO-8859-2 (IL2 encoding), or even others. +* There are at least four independent parameters of fonts + (family, size, encoding, variant). Possibility to switch one + font parameter independently on the others is important under + plain.tex where NFSS is not implemented. +* The OFS for plain includes the support of the math fonts manipulation + when the PostScript fonts and/or fonts at the different sizes are used. +* One can use the "\fontusage" command which lists the short usage + about OFS macros on the screen and to the log file. +* The "\showfonts" macro lists all available font families + on the screen and to the log file. +* One can print the short catalogue of the all installed fonts by + using "\input ofscatal.tex". +\enditems + +The macro is available at ftp://math.feld.cvut.cz/pub/olsak/ofs . +The declaration and support OFS files for all of the fonts offered +by the Storm Type Foundry (www.stormtype.com), and e.g. MathTimes +fonts have been created. The macro is in use by CSTUG users since 2001. +The English documentation (in addition to the current +Czech one) will be released in January 2003. + +The full paper will discuss in detail the features of OFS listed +above, will give examples of usage and pros and cons over current +macro packages for font switching and handling in \TeX{}. + +\endabstrakt + + +\kap Historical notes, plain\TeX{} and \LaTeX{} version of OFS + +In 2000, Petr Ol\v s\'ak got whole set of fonts from Storm Type Foundry +(made by Franti\v sek \v Storm) in order to make the \TeX{} support for +these fonts. The number of fonts was very large (many hundreds) and the +names used in Typo-catalog was a bit different from pfb file names and +they was {\it very} different from new tfm names used in \TeX{} support +because these names follow the Karl Berry's recommendation~\cite{berry}. + +There was a presumption that the user will want to choose individual +fonts and to make his/her own font collections for document +design. The simple solution like "\usepackage{times}" is not possible +because the user have to choose the sans serif variants, serif +variants etc. from a big offer by Storm Type Foundry. There are big +number of such combinations---we are not able to support a style file +for each such combination. Moreover, there are a great font collection +for titles and posters in \v Storm's package. The conclusion is: the user +needs to manage with individual fonts with the same names as in +Typo-catalog provided by Storm Type Foundry. The usage of tfm names or +short names for font families provided by NFSS are not acceptable at +user level. The support for managing of large sets of fonts +implemented at macro level is needed. This was an inspiration of OFS. + +The OFS was written by Petr Ol\v s\'ak primary for plain\TeX{} because he +is a plain\TeX{} user. He never used \LaTeX{} nor NFSS. Thus the +first version of OFS was usable only in plain\TeX{} environment +without NFSS. This version substitutes some features solved in NFSS +already: an independency of encoding/size/family/variant font +setting at user level, declaration of encoding-de\-pendent commands, +more comfortable declaration of math fonts (but plain\TeX{} approach of +math fonts declarations is kept because this is more understandable for +plain\TeX{} users than NFSS approach). + +The \LaTeX{} users asked the similar environment as OFS for +plain\TeX{} after OFS for plain was released. This was a reason why +Petr Ol\v s\'ak made the same user environment of OFS for \LaTeX{} (but +never used it:-). +This work was done by totally different macro code because the NFSS +features was used in this situation. The OFS for \LaTeX{} is only the +new macro level over NFSS. Roughly speaking, the OFS for +\LaTeX{} implements only the dictionary from long names of fonts used +in Font-catalog to the short family names used in NFSS and defines +the same ``user level environment'' as in OFS for plain\TeX{}. + +Because the OFS for plain\TeX{} is more powerful and includes more +interesting subjects in its implementation, we will describe only the +plain\TeX{} version of OFS in this paper. + +The OFS macro is released with \TeX{}-like license. It means, that the +names of the files and its content cannot be changed if this macro is +re-distributed. Only Petr Ol\v s\'ak can do changes. +There are no more restrictions for distributors and there are no +restrictions for users. + +The macro is released in~\cite{ftpofs} and the same version +is included in \TeX{} support of fonts from Storm Type +Foundry~\cite{stormtex}. The \TeX{} font metrics and fd files +are included in this support. The real fonts (implemented in pfb files) +are not free. If you take up your interest +in these fonts you have to buy them. See~\cite{wwwstorm} for more details. +One family called Lido is offered as free for non-commercial use +by Storm Type Foundry. There is the special \TeX{} support only for +this family~\cite{slido} including the OFS. + +The first release of OFS macro (September 2000) had only Czech +documentation. The English version of the documentation was released +in February 2003 with help of Mat\v ej Cepl. The concept of OFS was not +changed since its first release and Petr Ol\v s\'ak does not plan any changes +to the future. He is ready only to remove bugs, if any occur. + +The documentation can be found at the same place as the OFS macro. +It is a bit more technical than this paper. + + +\kap Basics of user environment +%------------------------------ + +The user environment is the same in both: OFS for plain\TeX{} and +\LaTeX{}. Of course, you have to include the OFS macro in plain\TeX{} +by little bit different way: + +\begtt +\input ofs [fonts, collections] +\endtt +% +than in \LaTeX{}: + +\begtt +\usepackage [fonts, collections] {ofs} +\endtt +% +All other user-level commands have the same syntax and meaning. + +You can use the command "\fontusage". This command prints to the +terminal and to the log file the basic usage of OFS: + +\begtt +$ tex ofs \\fontusage +This is TeX, Version 3.14159 (Web2C 7.3beta5) +(/usr/local/share/texmf/tex/csplain/ofs.tex +OFS (Olsak's Font System) based on plain initialized. +(/usr/local/share/texmf/tex/csplain/ofsdef.tex)) +\fontusage: ============== Olsak's Font System, usage: ================= +\input ofs [sjannon, sdynamo, a35] ... for example +\showfonts ... shows all loaded font families (by previous \input) +\setfonts [Family/] ... local switch to the new family, after this, the + \rm, \bf, \it, bi will switch to the variants. The current size is used. +\setfonts [/size] ... local switch to the new size of fonts, the family is + not changed. The "size" has the following possible formats: + at ... the same as \font\something=file at + ... the same as at + ... the same as atpt + scaled ... the same as \font\something=file scaled + mag fonts will be magnified by given coefficient + depend on current size of the fonts. +\setfonts [Family/size] ... switch to the new family at given size +\setfonts [Family-vr/] ... switch to the specified font, the current size + is used. The "vr" is acronym for variant (bf for example). +\setfonts [Family-vr/size] ... switch to the specified font. +\fontdef\name [Family/size] ... same as \gdef\name{\setfonts[Family/size]} + The "Family" or "size" parameter may be empty. +\fontdef\name [Family-vr/size] ... \name is fixed-font switch iff: + "size" is no empty and no mag. + Fixed-font switch "\name" is implemented as \global\font\name=file. +\setmath [size/size/size] ... set math it/rm as current it/rm + use PS Symbol +\nofontmessages, \logfontmessages, \displayfontmessages, \detailfontmessages + ... the levels of log. +* +\endtt + +The "\showfonts" prints the used font collections. You can include the +OFS macro without additional font collections in square brackets (it means +use only "\input ofs"). The basic font collection is initialised in +such situation: + +\begtt +*\showfonts +OFS (l.0): The list of known font families: +defaults: + [CMRoman/] \rm, \bf, \it, \bi, \sl + [CMSans/] \rm, \bf, \it, - + [CMTypewriter/] \rm, - , \it, - , \sl + [Times/] \rm, \bf, \it, \bi + [Helvetica/] \rm, \bf, \it, \bi, \nrm, \nbf, \nit, \nbi + [Courier/] \rm, \bf, \it, \bi +\endtt +% +The family names are printed in square brackets here and followed by varinat +switches usable for such font family. + +The basic fonts from Computer Moder family (by Donald Knuth) are +collected into three families here: "CMRoman", "CMSans" and +"CMTypewriter". This is sel explanatory. Note that the common +varinat "BoldItalic" ("\bi") is missing in "CMSans" and +"CMTypewriter". On the other hand the +``special'' variant "\sl" (slanted) is available in +"CMRoman" and "CMTypewriter" families. + +The declaration of another families are stored in ``declaration +files'' (the extension "tex" is used in OFS for plain\TeX{} and "sty" +in OFS for \LaTeX{}. It is recommended to manage the file +"allfonts.tex" in all \TeX{} distribution. This file includes the +"\input"s to the declaration files of all fonts installed in such +distribution. The "allfonts.tex" file may look like: + +\begtt +$ cat `kpsewhich allfonts.tex` +%%% All OFS families declared on this TeX +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Petr Olsak +\input a35 % PostScript 35 +\input ffonts % Another free fonts +\input btfonts % Bitstream fonts +\input skatalog % Stromtype foundry, 89 families +\endtt +% +When we write "$ tex allfonts \\showfonts \\end | less", we get the +listing of all font families available on \TeX{} distribution. This +listing includes cca three hundred font families on the computer of +one of the author of this article. He need not remember the tfm file +names of thousands of fonts. The part of the listing follows: + +\begtt +OFS (l.0): The list of known font families: +defaults: + [CMRoman/] \rm, \bf, \it, \bi, \sl + [CMSans/] \rm, \bf, \it, - + [CMTypewriter/] \rm, - , \it, - , \sl + [Times/] \rm, \bf, \it, \bi + [Helvetica/] \rm, \bf, \it, \bi, \nrm, \nbf, \nit, \nbi + [Courier/] \rm, \bf, \it, \bi +a35.tex: + [AvantGarde/] \rm, \bf, \it, \bi + [Bookman/] \rm, \bf, \it, \bi + [NewCentury/] \rm, \bf, \it, \bi + [Palatino/] \rm, \bf, \it, \bi + [ZapfChancery/] \rm, - , \it, - + [ZapfDingbats/] \rm, - , - , - + [Symbol/] \rm, - , \it, - +ffonts.tex: + [Charter/] \rm, \bf, \it, \bi +... +sjannon.tex: + [JannonAntikva/] \rm, \bf, \it, \bi, \mr, \mi + [JannonText/] \rm, \bf, \it, \bi, \mr, \mi + [JannonCaps/] \rm, \bf, \it, \bi +... +sdynamo.tex: +... + [DynaGroteskLE/] \rm, \bf, \it, \bi + [DynaGroteskD/] \rm, \bf, \it, \bi + [DynaGroteskR/] \rm, \bf, \it, \bi +... +stitul.tex: + [Alcoholica/] \rm, \bf, \it, - + [Monarchia/] \rm, \bf, - , - + [MonarchiaText/] \rm, \bf, - , - + [Clichee/] \rm, \bf, \it, \bi + [Regula/] \rm, - , \it, - + [Splendid/] \rm, \bf, \it, - , \script, \sans + [Cobra/] \rm, \bf, - , - + [ExcelScript/] \rm, - , - , - , \ext + [ExcelScriptText/] \rm, - , - , - , \ext + [Zeppelin/] \rm, \bf, - , - , \lr, \coll + [Negro/] \rm, - , - , - + [Farao/] \rm, \bf, - , - , \kr, \coll +... +slido.tex: + [Lido/] \rm, \bf, \it, \bi, \crm, \cbf +\endtt + +If you need recall what the special variant switches means +("\mr" and "\mi" in JannonText family, for instance), you can try +to switch to this family and look to the log file +(or to the terminal if "\displayfontmessages" is set): + +\begtt +*\displayfontmessages \setfonts [JannonText/] +OFS (l.0): Font family JannonText at10pt (enc=8z) activated: +OFS (l.0): \rm () \bf (Bold) \it (Italic) \bi (BoldItalic) +OFS (l.0): \mr (Medium) \mi (MediumItalic) +* +\endtt + +Aha, "\mr" means MediumItalic variant of JannonText family. +The "\it" means sometimes "Italic" variant and sometimes "Oblique" +variant. You can try: + +\begtt +*\setfonts[Helvetica/] +OFS (l.0): Font family Helvetica at10pt (enc=8z) activated: +OFS (l.0): \rm () \bf (Bold) \it (Oblique) \bi (BoldOblique) +OFS (l.0): \nrm (Narrow) \nbf (NarrowBold) \nit (NarrowItalic) + \nbi (NarrowBoldItalic) +* +\endtt + +The declaration file name is mentioned in the listing of all families +(see above). For example the file "a35.tex" declares the font families +from standard PostScript ``35 fonts collection'' from Adobe (no all +ten families are declared here because three families of them are +declared in basic OFS font collection). + +You can write "\input a35" instead of "\input ofs [a35]". The second +alternative is recommended if more font collections are used together, +for example: "\input ofs [a35, sdynamo, slido]". You can use + +\begtt +\input ofs [allfonts] +\endtt +% +(or simply "\input allfonts") in your document +if all font collections are needed or if you need not use the +names of individual font collections. + +OFS provides the printing of simple font catalog. For example, you can +write on your command line: + +\begtt +$ pdfcsplain ofscatal [sjannon, sdynamo, stitul] ; acroread ofscatal.pdf +\endtt + + +\kap The setfonts command + +You can select the font family and/or font size by "\setfonts" +command. Two parameters are separated by slash in square brackets. +The first parameter is the font family name and the second one is the +font size. If one of the parameters is missing then this aspect stay +unchanged. After the font family is selected, you can use the variant +switches. Most common switches are "\rm", "\bf", "\it", "\bi", but +another switches can be available for some font family. See the +listing produced by "\showfonts" for more detail. + +The "\setfonts" command keeps the variant from previous family +unchanged after setting of the new family if the current variant is +available in new font family. If not then the "\rm" variant is +initialized. All families have to support at least the "\rm" variant. + +Examples: + +\begtt +\setfonts [JannonText/10.5] % the normal font +\setfonts [/14]\bf % used for titles +\setfonts [/8]\rm % for footnotes +\setfonts [DynagroteskR/]\it % for citations +\setfonts [CMTypewriter/] % monospaced font + % if you use \setfonts [CMTypewriter/] when + % it is active then Typewriter italics is used. +\endtt + +The main advantage is that you can use the same names of font families +as in Typo-catalog and you need not remember the cryptical names of tfm +files or abbreviations of family names in NFSS. + +If the family name is not present in the internal OFS dictionary +(perhaps misspelling) then "\setfonts" command prints warning plus +all available families to log and to the terminal (the same as the +"\showfonts" command). + +The font size can be specified as decimal number without unit +(the unit "pt" is appended automatically) or you can type number with +arbitrary \TeX{} unit ("mm" for example). Moreover you can use the +keyword "scaled" before number with the same meaning as in "\font" +primitive. OFS introduces the new keyword "mag" followed by decimal +number (decimal point is required). This number denotes the fraction +for the current font size. For example: + +\begtt +\def\smaller{\setfonts [/mag0.8]} +This text is {\smaller typeset by small \smaller and more small +\smaller and more more small characters} and the normal size is used +here. +\endtt +% +yields to: + +\medskip +\def\smaller{\setfonts [/mag0.8]} +This text is {\smaller typeset by small \smaller and more small +\smaller and more more small characters} and the normal size is used +here. +\medskip + +We can use this feature in \LaTeX{} logo, for example: + +\begtt +\def\LaTeX{L\kern-.2em\raise.45ex\hbox{\setfonts[/mag.7] A}\kern-.05em\TeX} +\endtt + +This solution works in titles (the raised A is bod in this situation), +in normal text, footnotes, italics etc and in all font families. +This feature is not implemented in NFSS thus the \LaTeX{} logo has its +A implemented as superscript math font in \LaTeX{} kernel. I mean that +this is not a best idea. + +The another usage of mag keyword is to make a corrections of not +perfectly the same visual ex height of used font. This problem arises +if you combine the CMTypewriter family with some common PostScript +font families for instance. The CMTypewriter font seems to be smaller +if you use exactly the same design size. This is no problem: +you can define "\tt" as "\setfonts [CMTypewriter/mag1.1]" and the ex +height is balanced. This definition works in all sizes and font +variants. + +The NFSS keeps another aspect of fonts: the font weight. The main reason of +this feature is to boldify all text (in titles, for example) including +its italics part. I decided that this feature is not needed in OFS +because plain user can define titles in the following way: + +\begtt +\def\chapterfont {\setfonts[/14]\bf \let\it=\bi} +\endtt +% +Moreover you can simply define the macros which keeps more than five +aspects (NFSS keeps exactly five aspects). You can find the examples +in \TeX{} support of \v Storm's font where the big Dynagrotesk family implements +the special font selector which keeps the level of ``condensation of +the font'' in addition to the weight, variant (normal/italics), size +and encoding. + +You can declare you own font-switches in OFS by "\fontdef" command. +The code "\fontdef\fontswitch [Family/size]" declares the +"\fontswitch" similar as "\gdef\fontswitch{\setfonts[Family/size]}". +Example: + +\begtt +\input ofs [ffonts] % font Charter is in free fonts +\setfonts [Charter/10pt] % default family +\fontdef\tt [CMTypewriter/mag1.1] % monospaced font +\fontdef\verbtt [CMTypewriter/8] % monospaced font in verbatim +\fontdef\headfont [Charter/9] % the font+size for headers +\endtt + +It would be more convenient to write the word ``Charter'' only once +(this word seems to be redundant in declaration of "\headfont"). But the +macro code "\fontdef \headfont [/9]" cannot work everywhere because the +"\headfont" can be used for headers in output routine and this header have +to be in Charter every time, no in CMTypewriter, if CMTypewriter family +is the current when output routine is called out. + +You can solve this problem by using the ``"!"'' +character for the family parameter in "\fontdef". This character is +substituted by the current family in the time of "\fontdef" declaration: + +\begtt +\fontdef\headfont [!/9] \addcmd\small {\rm} % the font for headers +\endtt +% +Moreover the "\addcmd" is used here. This command adds the additional +code to the macro "\headfont" thus, the example above has the same effect +as: + +\begtt +\gdef\headfont {\setfonts[Charter/9]\rm} % the font for headers +\endtt +% +but the word Charter is not used here. Now, you can change the default +family only on one place and the new default family will be used in +headers too. + +The whole font declaration for your plain\TeX{} document can be +localized in one place in your macro code and it can be look +like the following code: + +\begtt +\input ofs [ffonts] % font Charter is in free fonts +\setfonts [Charter/10pt] % default family +\fontdef \tt [CMTypewriter/mag1.1] % monospaced font +\fontdef \verbtt [CMTypewriter-rm/8] % monospaced font in verbatim +\fontdef \headfont [!/9] \addcmd \headfont {\rm} +\fontdef \abstractfont [!/9] \addcmd \abstractfont {\baselineskip11pt\rm} +\fontdef \sectionfont [!/12] \addcmd \sectionfont {\bf \let\it=\bi} +\fontdef \titlefont [!-bf/14.4] % for the title of the document +\endtt + +If the ``"-vs"'' (where "\vs" is the variant switch) is used in +parameter of "\fontdef" or "\setfonts" then the whole family is not +initialized but only the single font is used as the current font. +The "\fontdef\name" is the equivalent of "\global\font\name" in such +situation. This convention is used in the example above for title font +because no variant switches is used in text of +title. + + +\kap Font encoding +%----------------- + +OFS for plain\TeX{}% + \footnote{OFS for \LaTeX{} does not solve font encoding, + use NFSS tools for font encoding manipulation} +initializes the CSfont encoding by default. +This does no matter for English users because CSfonts have absolutely +the same encoding(s) as Computer Modern in slots 0 to 127. +The users of T1 encoded fonts have to set the default font encoding by +the code: "\def\fotenc{8t}" before OFS is loaded. The macro "\fotenc" +includes a part of used metric file names. If this macro is not +defined then OFS define it as "8z"---it means CSfont encoding. + +If "\fotenc" has the value "8z" then the families "CMRoman", +"CMTypewriter" and "CMSans" will work with CSfonts and the font +metrics with "8z" encoding is used for another font families. If +"\fotenc" is set to "8t" then DC fonts are used in "CMRoman", +"CMTypewriter" and "CMSans" families. The EC fonts can be used instead +DC fonts, but you have to write the declaration file for OFS and for +EC fonts. This file does not exist now, sorry. + +Theoretically, you can switch between encoding inside the +document but this is not common used practice: + +\begtt +\input ofs +\setfonts [Times/] text 1 % used metric: ptmr8z, CSfont encoding +\def\fotenc{8t} +\setfonts [/] text 2 % used metric: ptmr8t, T1 encoding +\endtt +% +If you are using another font encoding with metric names "*8x" (for +example) then you can do "\def\fotenc{8x}". No problem. + +You can find the files "ofs-8z.tex" and "ofs-8t.tex" in OFS +package. The accents declaration and another encoding-dependent macros +are included here. By default, no of these files is read, it means +that the accent macros keep its original meaning from plain\TeX{}. +You can use "\input" of one of these files or "\input" both files +(there are no conflicts in these files). Assume that both files are +read. Then accent macros (such as "\v", "\'" etc.) followed by +a character expands to the new character code of CSfonts +(if "\fotenc" is "8z") or to the new code of T1 encoding +(if "\fotenc" is "8t"). Another encoding dependent macros (such as +"\promile") work in the chosen encoding by "\fotenc". + +We can look into the parts of "ofs-8z.tex" and "ofs-8t.tex" files: + +\begtt +%%% Default accents in CM +\accentdef \` * 8z {\accent 18 } % grave +\accentdef \' * 8z {\accent 19 } % acute +\accentdef \v * 8z {\accent 20 } % caron +\accentdef \u * 8z {\accent 21 } % breve +... +%%% Standard characters in plain (redefined here) +\def\aa{\r a} +\def\AA{\r A} +\characterdef \i 8z 16 +\characterdef \j 8z 17 +\characterdef \SS 8z {SS} +\characterdef \AE 8z 29 +... +%%% Extra characters from CS fonts +\characterdef \promile 8z 141 +\characterdef \varhyphen 8z 156 +\characterdef \flqq 8z 158 +\characterdef \frqq 8z 159 +\characterdef \clqq 8z 254 +\characterdef \crqq 8z 255 +... +%%% Accented letters from CS fonts +\accentdef \` A 8z 152 +\accentdef \' A 8z 193 +\accentdef \" A 8z 196 +\accentdef \` a 8z 184 +\accentdef \' a 8z 225 +... +%%% Default accents in Cork +\accentdef \` * 8t {\accent 0 } +\accentdef \' * 8t {\accent 1 } +\accentdef \^ * 8t {\accent 2 } +\accentdef \~ * 8t {\accent 3 } +\accentdef \" * 8t {\accent 4 } +... +%%% Standard characters in plain (redefined here) +\def\aa{\r a} +\def\AA{\r A} +\characterdef \i 8t 25 +\characterdef \j 8t 26 +\characterdef \SS 8t 223 +\characterdef \AE 8t 198 +... +\characterdef \promile 8t {\%\char 24 } +\characterdef \textpertenthousand 8t {\%\char 24\char 24 } +... +%%% Accented letters from T1 encoding +\accentdef \. i 8t `\i +\accentdef \u A 8t 128 +\accentdef \k A 8t 129 +\accentdef \' C 8t 130 +\accentdef \v C 8t 131 +... +\endtt + +This example is self explanatory and illustrates the language for +accents and encoding-dependent macro declarations. You can find more +information in documentation~\cite{ofsdoc}. + +The \LaTeX{} user can be familiar with the commands with similar +meaning: "\DeclareTextSymbol", "\DeclareTextComposite", etc. + +OFS calculates with the possibility of existence of a special metric +with extra characters (such us "\euro"). Each basic metric can be +connected with such ``extra metric'' to the couple. These couples are +used in \TeX{} support of Storm Type Foundry because these fonts have +more than 256 characters. There is prepared an extra metric "*6s" +for each basic metric "*8z" or "*8t" in \TeX{} support of \v Storm's +fonts. The "*6s"-encoding specific macros are declared in +"stormenc.tex" by "\accentdef" and "\characterdef" commands. If the +current metric has declared an extra metric and user calls the +macro declared by "\characterdef" or "\accentdef" and this macro is +not declared for current encoding but only for the encoding of the +extra metric then the extra metric is temporary used without any user +intervene. Example: + +\begtt +\characterdef \euro 6s 136 +Now the \euro{} works in all fonts with extra metric *6s +\endtt + + + +\kap Declaration files +%--------------------- + +Look into "a35.tex" now for an example of language of +the declaration files: + +\begtt +%%% Times, Helvetica, Courier is in OFS defaults + +\ofsdeclarefamily [AvantGarde] {% -------------------- AvantGarde + \loadtextfam (Book) pagk\fotenc;% \rm + (Demi) pagd\fotenc;% \bf + (BookOblique) pagko\fotenc;% \it + (DemiOblique) pagdo\fotenc;;% \bi + \def\TeX{T\kern-.08em\lower.3333ex\hbox{E}\kern-0.09emX}% +} +\ofsdeclarefamily [NewCentury] {% -------------------- NewCenturySchlbk + \loadtextfam (Roman) pncr\fotenc;% \rm + pncb\fotenc;% \bf + pncri\fotenc;% \it + pncbi\fotenc;;% \bi + \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX}% +} +... +\endtt +% +The mapping between font family names and metric files is defined +here.% +\footnote{OFS for \LaTeX{} uses other declaration files: + the mapping between family names and NFSS short names + are defined here. +} +Each family declares four metrics for four common variants "\rm", +"\bf", "\it" and "\bi". Empty parameter means that the variant +is missing. The metric names are saved by "\fotenc" macro in order +to possibility of changing the used encoding. The extra metric can be +written before the last semicolon (not used in this example). +The commands from parameter of the "\ofsdeclarefamily" are processed +when "\setfonts" is used. You can see the alternative definition of +\TeX{} logo for each family in "a35.tex" file on order to optimize the +visual aspect of this logo. + +The optional parameters of "\loadtextfam" macro is written in brackets +and these parameters declares mapping of short variant switches and +the full variant names printed to the log and terminal. For example, +BookOblique is a "\it" variant in AvantGarde font family. If the +common name is used (Bold/Italics/BoldItalics) then this parameter can +be missing (see NewCentury family, for instance). + +How the special variants are declared? Look into the file +"sjannon.tex", for example: + +\begtt +\ofsdeclarefamily [JannonAntikva] {% -------- Jannon Antikva + \loadtextfam sjnr\fotenc;% + sjnb\fotenc;% + sjnri\fotenc;% + sjnbi\fotenc;6s;% + \newvariant2 \mr (Medium) sjnm\fotenc;6s;% + \newvariant3 \mi (MediumItalic) sjnmi\fotenc;6s;% +} +\ofsdeclarefamily [JannonText] {% ------------ Jannon Text + \loadtextfam sjnrg\fotenc;% + sjnbg\fotenc;% + sjnrig\fotenc;% + sjnbig\fotenc;6s;% + \newvariant2 \mr (Medium) sjnmg\fotenc;6s;% + \newvariant3 \mi (MediumItalic) sjnmig\fotenc;6s;% +} +... +\endtt +% +Note that there is declared the extra metric with~"6s" encoding here. +See the documentation~\cite{ofsdoc} for more information. + +How the "CMRoman" etc. families are declared? These families have two +special subjects. First: the metrics file names do not include the "8z" or +"8t" acronym for encoding. Second: the different metrics are used +for different font sizes. Both problems are solved by the OFS command +"\registertfm" (see the "ofsdef.tex" file): + +\begtt +\registertfm cmr8z - csr10 % metric for all sizes +\registertfm cmr8z 0pt-6pt csr5 +\registertfm cmr8z 6pt-7pt csr6 +\registertfm cmr8z 7pt-8pt csr7 +\registertfm cmr8z 8pt-9pt csr8 +\registertfm cmr8z 9pt-10pt csr9 +\registertfm cmr8z 10pt-12pt csr10 +\registertfm cmr8z 12pt-17pt csr12 +\registertfm cmr8z 17pt-* csr17 +... +\registertfm cmr8t - dcr10 % metris for all sizes +... +\ofsdeclarefamily [CMRoman] {% ------------ Computer Modern Roman + \loadtextfam cmr\fotenc;% + cmbx\fotenc;% + cmti\fotenc;% + cmbxti\fotenc;;% + \newvariant8 \sl (Slanted) cmsl\fotenc;;% +} +\endtt + + +\kap Math fonts +%-------------- + +The math fonts are collected in math families (three fonts +per one family) +by "\textfont", "\scriptfont" and "\scriptscriptfont" primitives. The +math families with number 0, 1, 2, 3 have special meaning in math +typesetting. The declaration of new math family by \TeX{} primitives +is not too comfortable. Plain\TeX{} user can declare the new math +family by OFS macro "\loadmathfam". This command will be described +below. + +Plain\TeX{} user have to initialize the math fonts in OFS by +"\setmath" command. The math fonts are in the same state as declared +in plain\TeX{} macro until the "\setmath" command is used. It means +that the Computer Modern at 10/7/5 pt size are used. +The "\setmath" command have three parameters in square brackets +separated by slashes. These parameters means the +text/script/scriptscript size of the math fonts. The empty parameter +means that the mag1.0/mag.7/mag.5 (relatively to the current size of +textual font) is substituted: + +\begtt +\setmath [//] is the same as \setmath [mag1.0/mag.7/mag.5] +\endtt + +The "\setmath" command calculates the needed sizes from given +parameters and starts the "\mathfonts" macro followed by macro +"\mathchars". The plain\TeX{} user can define these macros in +his own opinion but OFS gives the reasonable default values of these +macros. These macros run the variant part of the code depend on the +values of the "\fomenc" and "\mathversion" macros. + +If "\def\fomenc{PS}" is used (it is default value in OFS) then "\setmath" +initializes math fonts by the following way: math italic is loaded +from text italics of the current text font family, family~0 is loaded +from "\rm" variant of the current family. The math symbols are loaded +(if it is possible) from common PostScript font Symbol. The rest +(what is not included in Symbol font) is realized from Computer Modern +fonts. The math encoding is redefined (by "\mathchardef" etc. primitives) +for many symbols in order we keep the accessibility of all math +characters declared in plain\TeX{}. For example the lower letter greek +characters are loaded from the slanted variant of PostScript Symbol font. + +If you use "\def\fomenc{CM}" then "\setmath" loads the math fonts from +Computer Modern family and does not change the math encoding. +In this case, the "\setmath[//]" command only sets the actual sizes of these fonts +depend on current text font size. + +If you buy the MathTimes family, you can "\input" the "ofsmtdef.tex" +file (this is a part of OFS package) and you can use "\def\fomenc{MT}". +Then the "\setmath" command loads the math italics from current "\it" +font and family~0 from current "\rm" font. Moreover, it loads the +MathTimes fonts for all math symbols. Unlike "\def\fotens{PS}" mode +there is no ``rest'': no symbols needs to be realized from Computer +Modern family. + +You can control the math families collection loaded by "\setmath" by +the value of "\mathversion" macro. OFS declares two +math families collections: "\def\mathversion{normal}" +and "bold". You can declare more collections if you need it. +The "bold" collection is the same as "normal", but bold variants of +italics, family~0 and math symbols (if accessible) are loaded. + +The example from "ofsdef.tex" file illustrates the language of +declarations of the math fonts: + +\begtt +\def\defaultmathfonts{\csname load\fomenc\mathversion math\endcsname} +\def\defaultmathchars{\csname set\fomenc mathchars\endcsname} +\def\mathfonts{\defaultmathfonts} +\def\mathchars{\defaultmathchars + \let\mathchars=\relax % to protect the twice math-setting +} +\def\loadPSnormalmath{% + \loadmathfam 0[tenrm/]% Actual Roman font + \loadmathfam 1[tenit/]% Actual Italic font + \loadmathfam 2[/cmsy]% Standard symbols from CM + \noindexsize\loadmathfam 3[tenex/]% Standard extra symbols from CM + \chardef\itfam=1 \chardef\bifam=5 + \loadmathfam \bffam [tenbf/]% Actual Bold font + \loadmathfam \bifam [tenbi/]% Actual Bold Italic + \newmathfam\symbfam + \loadmathfam \symbfam [/psyr]% PostScript Symbol + \newmathfam\symbofam + \loadmathfam \symbofam [/psyro]% PostScript Symbol Oblique +} +\def\loadPSboldmath{% + \loadmathfam 0[tenbf/]% Actual Bold font + \loadmathfam 1[tenbi/]% Actual Bold-Italic font +... +} +\def\loadCMnormalmath{% + \loadmathfam 0[/cmr8z]% Roman font + \loadmathfam 1[/cmmi]% Math Italic font + \loadmathfam 2[/cmsy]% Standard symbols from CM + \noindexsize\loadmathfam 3[/cmex10]% Standard extra symbols from CM +... +} +\def\loadCMboldmath{% + \loadmathfam 0[/cmbx8z]% Roman font + \loadmathfam 1[/cmmib10]% Math Italic font +... +} +\def\setPSmathchars{% + \fontmessage{\ofsmessageheader Math codes are set for PS encoding}% + \mathcode`\,="602C + \mathcode`\.="002E + \delcode`\<="\hex\symbfam E130A + \delcode`\>="\hex\symbfam F130B + \delcode`\|="\hex\symbfam 7C30C + \edef\langle{\delimiter"4\hex\symbfam E130A }% + \edef\rangle{\delimiter"5\hex\symbfam F130B }% + \mathchardef\alpha "0\hex\symbofam 61 + \mathchardef\beta "0\hex\symbofam 62 + \mathchardef\gamma "0\hex\symbofam 67 +... +} +\endtt + +If you need to add next math families (math alphabets in NFSS +terminology) then you can use the cod similar as the following: + +\begtt +\def\mathfonts{\defaultmathfonts + \newmathfam\bbfam + \loadmathfam \bbfam [/bbold12]% Dvojitá vertikální kresba + \def\bb{\fam\bbfam}% +} +\def\mathchars{\defaultmathchars + \mathchardef\balpha "0\hex\bbfam 0B + \mathchardef\bbeta "0\hex\bbfam 0C + ... +} +\endtt + +We re-write the example from section~3 in order to support the math +typesetting: + +\begtt +\input ofs [ffonts] % font Charter is in free fonts +\setfonts [Charter/10pt] % default family +\setmath[//] % math initialisation +\fontdef\tt [CMTypewriter/mag1.1] % monospaced font +\fontdef\verbtt [CMTypewriter-rm/8] % monospaced font in verbatim +\fontdef\headfont [!/9] % running heads +\addcmd \headfont {\baselineskip11pt\rm\def\mathversion{normal}\setmath[//]} +\fontdef\sectionfont [!/12] % section font +\addcmd \sectionfont {\bf \let\it=\bi \def\mathversion{bold}\setmath[//]} +\fontdef\titlefont [!-bf/14.4] % for the title of the document +\endtt + +The math fonts works in all sizes in our virtual example. The math +formulae are in bold variant and in right size in section headers. + +\reference + +\bib \url{www.stormtype.com} + +\bib \url{www.pismolijna.cz}, + +\bib \url{www.cstug.cz/stormtype}. + +\bib \url{www.cstug.cz/stormtype/slido.html}. + +\bib \url{ftp://math.feld.cvut.cz/pub/olsak/ofs}. + +\bib Petr Olšák. {\it OFS: Olšákův fontový systém}. 2001. + The English documentation is in files "ofsdoc-e.tex", "ofsdoc-e.pdf" + +\bib Petr Olšák. {\it Jak \TeX{} k~fontům ze Střešovic přišel}. Bulletin + of CSTUG, number 4/2001, pp~153--180. + +\bib Karl Berry. {\it Fontname}, March 1999. The documentation is included + in {\tt web2c} \TeX, file {\tt fontname.texi}, {\tt fontname.pdf} + + +\bye + diff --git a/macros/generic/ofs/doc/papers/ofs-slt.pdf b/macros/generic/ofs/doc/papers/ofs-slt.pdf new file mode 100644 index 0000000000..01cd04b831 Binary files /dev/null and b/macros/generic/ofs/doc/papers/ofs-slt.pdf differ diff --git a/macros/generic/ofs/doc/papers/ofs-slt.tex b/macros/generic/ofs/doc/papers/ofs-slt.tex new file mode 100644 index 0000000000..ffee32f695 --- /dev/null +++ b/macros/generic/ofs/doc/papers/ofs-slt.tex @@ -0,0 +1,1004 @@ +\chyph % použijte csplain + +% Přimlovám se k tomu nepřeznačkovávat článek do LaTeXu +% Na článku totiž demonstruji vlastnosti OFS a opírám se +% o OFS z plainu. Přechod na LaTeX se zachováním těchto vlastností +% by nebyl jednoduchý. Můžete rozbalit metriky +% a virtuální fonty k Charteru (přiložený charter8z.zip) do +% pracovního adresáře a zpracovat csplainem na instalaci TeXu, +% která obsahuje OFS. Před spuštěním dvips je pak potřeba doplnit +% do psfonts.map čtyři řádky uvedené v souboru mapfile. Můžete mě také +% informovat o tom, na kterých stránkách se dokument bude ve sborníku +% nacházet, já opravím údaj \firstpage, zplainuji to, zdvipsuji a +% pošlu obratem zpátky. + +\newcount\firstpage \firstpage=79 +\newcount\numpages \numpages=14 + +\def\addcmd #1#2{\expandafter\def\expandafter\tmpa\expandafter{#1}% + \def\tmpb{#1}% + \ifx\tmpa\tmpb % the #1 is not a macro + \expandafter\let\csname \string#1-original\endcsname =#1% + \expandafter\def\expandafter #1\expandafter{% + \csname\string#1-original\endcsname #2}% + \else % the #1 is a macro + \expandafter\def\expandafter #1\expandafter{#1#2}% + \fi} + +\input ofs [ffonts] % Charter je ve skupině free fonts +\setfonts [Charter/10pt] % výchozí rodina +\setmath[//] % inicializace matematiky +\fontdef\tt [CMTypewriter/mag1.1] % strojopis, korekce střední výšky +\fontdef\verbtt [CMTypewriter-rm/8] % strojopis pro display ukázky +\fontdef\small [!/9] % zmenšení pro abstrakt a záhlaví +\addcmd \small {\baselineskip11pt \rm \def\mathversion{normal}\setmath[//]} +\fontdef\fontsekce [!/12] % pro nadpisy sekcí +\addcmd \fontsekce {\bf \let\it=\bi \def\mathversion{bold}\setmath[//]} +\fontdef\fonttitul [!-bf/14.4] % titul + +\hsize=12,2cm +\vsize=19,3cm +\hoffset=63pt +\voffset=43pt +\parindent=14pt + +\lineskiplimit=-10pt +\raggedbottom + +\exhyphenpenalty=10000 +\widowpenalty=10000 +\clubpenalty=10000 + +\showboxdepth=10 \showboxbreadth=50 + +\def\starthead{\global\headline= + {\small \ifodd\pageno \hfil \thetitul \headspace \the\pageno + \else \the\pageno \headspace \theauthor \hfil \fi}} +\headline={\hfil\starthead} +\def\headspace{\hskip2.5em\relax} +\def\makeheadline{\vbox to0pt{\vskip-25pt + \line{\vbox to8.5pt{}\the\headline}\vss}\nointerlineskip} +\footline={\setfonts[/7]\setmath[//]\baselineskip=9pt + \vbox{\hbox{\copytext}\hbox{\copykonvoj}}\hfil + \global\footline={}} +\def\lastpage{\advance\firstpage by\numpages \advance\firstpage by-1 + \the\firstpage} + +\def\copytext{Jan Kasprzak, Petr Sojka (editoři): \SLT~2002 -- sborník + semináře o~Linuxu a \TeX{}u, str. \the\firstpage--\lastpage, 2002.} +\def\copykonvoj{\copyright~Konvoj, CSTUG, CZLUG 2002} + +\newcount\subnum + +\def\kap #1\par{\advance\subnum by1 + \removelastskip %\goodbreak + \vskip17pt plus2pt minus1pt\noindent{\fontsekce + \ifnum\subnum>1 \the\subnum\enspace\enspace\fi #1}% + \par\nobreak\vskip11pt plus2pt minus1pt + \everypar{\setbox0=\lastbox \everypar={}}} +\def\reference {\subnum=-1 \kap Reference\par \small} +\def\bib{\par\advance\subnum by1 \leftskip=\parindent + \noindent\llap{\the\subnum.\enspace}\ignorespaces} + +\let\orifootnote=\footnote +\newcount\footnotenum +\def\footnote#1{\global\advance\footnotenum by1 + \orifootnote{$\setmath[//]^\the\footnotenum$}{\small + \hangindent=\parindent #1\par}} +\def\footnoterule{\kern-3pt \hrule width 2cm \kern2.6pt } + +\def\titul #1 \par{\def\thetitul{#1}\pageno=\firstpage + \centerline{\fonttitul #1}\vskip20pt\relax} +\def\autor #1 \par{\def\theauthor{#1} + \centerline{#1}\vskip10pt\relax} +\def\institut #1 \par{\centerline{\small #1}} +\def\email #1 \par{\centerline{\small Email: \tt #1}\vskip20pt\relax} +\def\abstrakt #1\par{\bgroup \small + \leftskip=3em \rightskip=3em + \noindent{\bf Abstrakt:}\enspace #1\par \egroup\bigskip} +\def\url#1{{\tt#1}} + +\font\mflogo=logo10 % METAFONT logo +\font\boldsy=cmbsy10 at12pt % Tučné \CS, \AMS. +\font\bboldsy=cmbsy10 scaled\magstep2 % Tučné \CS v titulu + +\def\CS{$\cal C\kern-.1667em\lower.5ex\hbox{$\cal S$}\kern-.075em $} +\def\bCS{{\boldsy C\kern-.1667em\lower.5ex\hbox{S}\kern-.04em}} +\def\CSTeX{\CS\TeX} +\def\CSTUG{\CS TUG} +\def\CSfont{\CS\kern.1em font} +\def\csplain{\CS\kern.1em plain} \let\CSplain=\csplain +\def\mf{{\mflogo META}\-{\mflogo FONT}} +\def\mp{{\mflogo META}\-{\mflogo POST}} +\def\LaTeX{L\kern-.2em\raise.45ex\hbox{\setfonts[/mag.7] A}\kern-.05em\TeX} +\def\twoe{$2_{\textstyle\varepsilon}$} +\def\LaTeXe{\LaTeX\thinspace\twoe} +\def\cslatex{\CS\kern.05em\LaTeX} \let\CSLaTeX=\cslatex +\def\twoe{$2_{\textstyle\varepsilon}$} +\def\LaTeXe{\LaTeX\thinspace\twoe} +\def\AMS{$\cal A\kern-.166em\lower.5ex\hbox{$\cal M$}\kern-.075em S$} +\def\bAMS{{\boldsy A\kern-.166em\lower.5ex\hbox{M}\kern-.075em S}} +\def\ps{Post\-Script} +\def\SLT{S\kern-0.025em\lower.5ex\hbox{L}\kern-.2emT} +\def\DOS{\hbox{DOS}} + +%% Definice verbatim prostředí %% !verb. +\catcode`\"=13 +\def"{\hbox\bgroup\let"=\egroup\setverb\tt} +\def\setverb{\def\do##1{\catcode`##1=12}\dospecials\obeyspaces} +\def\begtt{\medskip\bgroup + \nobreak\setverb \parskip=0pt %\parindent=0pt + \catcode`\"=12\catcode`\~=13 \obeylines + \baselineskip=10pt + \let\tt=\verbtt \startverb} +{\catcode`\|=0 \catcode`\\=12 + |gdef|startverb#1\endtt{% + |tt#1|nobreak|egroup|penalty0|medskip|scannexttoken}} +{\obeyspaces\gdef {\ }} +\long\def\scannexttoken#1{\ifx#1\par\else\noindent#1\fi} + +\def\citeref #1 #2 {\expandafter\def\csname cit:#1\endcsname{#2}} +\citeref pismolijna 1 +\citeref ofsftp 2 +\citeref ofsdoc 3 +\citeref stormcl 4 +\def\cite#1{\expandafter\ifx \csname cit:#1\endcsname\relax + \message{Warning: cite{#1} is not defined}[??]% + \else [\csname cit:#1\endcsname]\fi} + +%------------------------------------------------------------------------- + +\titul Makro OFS + %%%%%%%%% + +\autor Petr Olšák + +\institut Elektrotechnická fakulta ČVUT, Praha + +\email olsak@math.feld.cvut.cz + +\abstrakt + OFS (Olšákův fontový systém) je balíček TeXových maker, který + umožní získat větší přehled nad rozsáhlými kolekcemi fontů a umožní + s~nimi poměrně snadnou manipulaci. Balík byl vyvinut pro získání + přehledu nad fonty z~Typokatalogu Střešovické písmolijny~\cite{pismolijna}. + Na základě poptávky \LaTeX{}ových uživatelů byl balík + napsán ještě jednou pro \LaTeX, kde využívá NFSS a pokouší se je + trošičku vylepšit. Základní uživatelské příkazy OFS jsou pak v~obou + prostředích (plain i \LaTeX) stejné. Na přednášce předvedu použití + OFS na uživatelské i konfigurační úrovni. + +\kap Úvodem +%---------- + +Makro OFS jsem si napsal hlavně proto, abych se vyznal ve stovkách +fontů, které pocházely ze Střešovické písmolijny a pro které jsem +před rokem udělal \TeX{}ovou podporu. Protože jsem plainista, šlo mi +hlavně o~to udělat makro co nejvíce srozumitelné uživateli plainu, +který potřebuje přesně vědět, co to makro dělá. Tento požadavek +například \LaTeX{}ové NFSS nesplňuje. + +Později se začali o~OFS zajímat též někteří uživatelé \LaTeX{}u. Tož +jsem se přemohl a pokusil OFS napsat ještě jednou, tentokrát pod +\LaTeX{}em s~využitím~NFSS. Cílem tohoto přepsání bylo hlavně to, aby +se uživatelské příkazy pro vyhledávání a přepínání rodin fontů +zcela shodovaly v~\LaTeX{}ové verzi s~verzí plainovou. \LaTeX{}ová +verze přesto umí podstatně méně věcí, než plainová, protože pokud by +měla umět vše, musel bych NFSS zcela odmítnout a fontový modul +\LaTeX{}u si napsat po svém. Tím bych ale popřel \LaTeX{} jako +takový, takže jsem zůstal u~respektování principů NFSS. Věci, které +se v~NFSS dají dělat velmi těžko, jsem raději nedělal. + +Z~těchto důvodů jsem se v~\LaTeX{}u nepouštěl ani do podpory +matematických fontů. Koncepce matematiky v~NFSS mi připadá jako +plainistovi poněkud nesrozumitelná. Navíc velké kolekce fontů, které byly +hlavní motivací OFS, jsou většinou textové. Pokud chce někdo +použít matematickou sadu fontů v~\LaTeX{}u, použije +"\usepackage{styl}" a ten styl je k~té matematické sadě většinou +dodáván. Nepovažoval jsem tedy řešení matematiky +v~\LaTeX{}u za prioritní. Na druhou stranu matematické rodiny v~plainu +se pomocí OFS doplňují a zavádějí ve všech velikostech velmi +elegantně. Věřím, že alespoň nějakému plainistovi (kromě mě) se toto +řešení bude hodit. + +Makro OFS jsem zveřejnil na \cite{ofsftp} pod \TeX-like licencí, +tj. je volně k~mání, ale změny pod stejným názvem nesmí dále šířit nikdo +jiný, než autor. Do \TeX{}ových distribucí jsem makro zatím +neprosadil, protože bohužel chybí anglická dokumentace. Domnívám se, +že kdyby anglická dokumentace byla, nebyl by se zařazením do \TeX{}ových +distribucí problém a makro by mohlo využít daleko více lidí. Bohužel, +nejsem v~angličtině natolik zdatný, abych tento problém rychle překonal. +Pro letošní letní prázdniny jsem sice plánoval, že se pokusím anglickou +dokumentaci napsat, jenže přišla voda\dots + +K~OFS existuje samozřejmě česká dokumentace~\cite{ofsdoc} podrobě +popisující chování makra. Navíc jsem se o~OFS zmínil už v~článku +o~\TeX{}ové podpoře Štormových fontů~\cite{stormcl}. Dovolil jsem si +zde přesto znovu k~tomuto tématu vrátit. Nechci být nyní +tak technicky exaktní, jako v~manuálu~\cite{ofsdoc}, ale zase mám zde +více místa k~rozepsání možností makra, než jsem měl ve +článku~\cite{stormcl}, který byl především o~Štormových fontech. + + +\kap Základy uživatelského rozhraní +%---------------------------------- + +Uživatelské rozhraní je shodné v~\LaTeX{}ové verzi OFS i +v~plainové s~výjimkou snad zavedení makra OFS, které v~plainu +provedeme jednoduše pomocí "\input ofs [kolekce, fontů]", zatímco +v~záhlaví \LaTeX{}ového dokumentu píšeme +"\usepackage [kolekce, fontů] {ofs}". + +Abych v~tomto textu nemusel každou chvíli větvit svůj výklad na situaci +vhodnou pro plain a pro \LaTeX{}, rozhodl jsem se zde předpokládat, že +pracujeme pouze s~plainem (například s~\csplain{}em). +\LaTeX{}ový uživatel si bude muset dohledat specifika verze OFS pro +svůj formát v~dokumentaci~\cite{ofsdoc}. + +\bigskip + +Příkazem "\fontusage" dostaneme na terminál a do logu základní +informace o~uživatelských příkazech: + +\begtt +$ tex ofs \\fontusage +This is TeX, Version 3.14159 (Web2C 7.3beta5) +(/usr/local/share/texmf/tex/csplain/ofs.tex +OFS (Olsak's Font System) based on plain initialized. +(/usr/local/share/texmf/tex/csplain/ofsdef.tex)) +\fontusage: ============== Olsak's Font System, usage: ================= +\input ofs [sjannon, sdynamo, a35] ... for example +\showfonts ... shows all loaded font families (by previous \input) +\setfonts [Family/] ... local switch to the new family, after this, the + \rm, \bf, \it, bi will switch to the variants. The current size is used. +\setfonts [/size] ... local switch to the new size of fonts, the family is + not changed. The "size" has the following possible formats: + at ... the same as \font\something=file at + ... the same as at + ... the same as atpt + scaled ... the same as \font\something=file scaled + mag fonts will be magnified by given coefficient + depend on current size of the fonts. +\setfonts [Family/size] ... switch to the new family at given size +\setfonts [Family-vr/] ... switch to the specified font, the current size + is used. The "vr" is acronym for variant (bf for example). +\setfonts [Family-vr/size] ... switch to the specified font. +\fontdef\name [Family/size] ... same as \gdef\name{\setfonts[Family/size]} + The "Family" or "size" parameter may be empty. +\fontdef\name [Family-vr/size] ... \name is fixed-font switch iff: + "size" is no empty and no mag. + Fixed-font switch "\name" is implemented as \global\font\name=file. +\setmath [size/size/size] ... set math it/rm as current it/rm + use PS Symbol +\nofontmessages, \logfontmessages, \displayfontmessages, \detailfontmessages + ... the levels of log. +* +\endtt + +Vidíme, že příkaz "\showfonts" nám ukáže kolekce fontů. Pokud jsme +nepoužili \uv{previous "\input"}, dopadne základní kolekce +(implementovaná přímo uvnitř OFS) takto: + +\begtt +*\showfonts +OFS (l.0): The list of known font families: +defaults: + [CMRoman/] \rm, \bf, \it, \bi, \sl + [CMSans/] \rm, \bf, \it, - + [CMTypewriter/] \rm, - , \it, - , \sl + [Times/] \rm, \bf, \it, \bi + [Helvetica/] \rm, \bf, \it, \bi, \nrm, \nbf, \nit, \nbi + [Courier/] \rm, \bf, \it, \bi +\endtt + +Názvy fontových rodin jsou zde uvedeny v~hranatých závorkách a vedle jsou +uvedeny přepínače variant, které pro danou rodinu je možné použít. + +Vidíme, že nejběžnější textové fonty Computer Modern jsou zaneseny +v~OFS do tří rodin "CMRoman", "CMSans" a "CMTypewriter". Myslím, že +netřeba dodávat, co to znamená. V~rodinách "CMSans" a "CMTypewriter" +není k~dispozici jinak obvyklá varianta "BoldItalic", pro kterou je +vyhrazen přepínač "\bi". V~rodině "CMTypewriter" nenajdeme ani +přepínač "\bf" pro tučnou variantu, ale zato můžeme použít +\uv{nadstandardní} variantu "\sl" (slanted), která je k~dispozici i +v~rodině "CMRoman". + +%OFS také přímo pracuje s~rodinami "Times", "Helvetica" a +%"Courier". +%Rodina "Helvetica" má kromě běžných variant ještě varianty +%zúžené, například "\nbf" znamená "NarrowBold". Pokud písmová rodina +%nemá skutečnou kurzívu, ale jen skloněnou variantu, je přesto tato +%varianta vymezena přepínačem "\it". +%Většina písmových rodin totiž +%dodržuje \uv{logiku čtyř variant}, pro které jsou v~OFS vyhrazeny +%právě přepínače "\rm", "\bf", "\it", "\bi". + +Deklarace dalších písmových rodin jsou zanášeny do deklaračních +souborů s~příponou "tex"% +\footnote{V \LaTeX{}ovém OFS se jedná o~příponu {\tt sty}.}. +V~každém distribuci \TeX{}u +doporučuji udržovat soubor volající všechny deklarační soubory +"allfonts.tex". Například na mém počítači vypadá tento soubor takto: + +\begtt +$ cat `kpsewhich allfonts.tex` +%%% All OFS families declared on this TeX +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Petr Olsak +\input a35 % PostScript 35 +\input ffonts % Another free fonts +\input btfonts % Bitstream fonts +\input skatalog % Stromtype foundry, 89 families +\endtt +% +Když tedy napíšu "$ tex allfonts \\showfonts \\end | less"~, dostanu +na svém počítači výpis zhruba tří set písmových rodin, každá obvykle +ve čtyřech variantách. Důležité je, že se v tom vyznám a nemusím +vzpomínat, jak se která metrika jmenuje. Následuje jen část výpisu. + +\begtt +OFS (l.0): The list of known font families: +defaults: + [CMRoman/] \rm, \bf, \it, \bi, \sl + [CMSans/] \rm, \bf, \it, - + [CMTypewriter/] \rm, - , \it, - , \sl + [Times/] \rm, \bf, \it, \bi + [Helvetica/] \rm, \bf, \it, \bi, \nrm, \nbf, \nit, \nbi + [Courier/] \rm, \bf, \it, \bi +a35.tex: + [AvantGarde/] \rm, \bf, \it, \bi + [Bookman/] \rm, \bf, \it, \bi + [NewCentury/] \rm, \bf, \it, \bi + [Palatino/] \rm, \bf, \it, \bi + [ZapfChancery/] \rm, - , \it, - + [ZapfDingbats/] \rm, - , - , - + [Symbol/] \rm, - , \it, - +ffonts.tex: + [Charter/] \rm, \bf, \it, \bi +... +sjannon.tex: + [JannonAntikva/] \rm, \bf, \it, \bi, \mr, \mi + [JannonText/] \rm, \bf, \it, \bi, \mr, \mi + [JannonCaps/] \rm, \bf, \it, \bi +... +sdynamo.tex: +... + [DynaGroteskLE/] \rm, \bf, \it, \bi + [DynaGroteskD/] \rm, \bf, \it, \bi + [DynaGroteskR/] \rm, \bf, \it, \bi +... +stitul.tex: + [Alcoholica/] \rm, \bf, \it, - + [Monarchia/] \rm, \bf, - , - + [MonarchiaText/] \rm, \bf, - , - + [Clichee/] \rm, \bf, \it, \bi + [Regula/] \rm, - , \it, - + [Splendid/] \rm, \bf, \it, - , \script, \sans + [Cobra/] \rm, \bf, - , - + [ExcelScript/] \rm, - , - , - , \ext + [ExcelScriptText/] \rm, - , - , - , \ext + [Zeppelin/] \rm, \bf, - , - , \lr, \coll + [Negro/] \rm, - , - , - + [Farao/] \rm, \bf, - , - , \kr, \coll +... +slido.tex: + [Lido/] \rm, \bf, \it, \bi, \crm, \cbf +\endtt + +Ve výpisu je uveden i \TeX{}ový soubor, kde se deklarace odpovídajících +rodin skutečně nachází. Vidíme tedy, že "a35.tex" už obsahuje +deklarace rodin, ale například soubor "skatalog.tex" zřejmě obsahuje jen další +"\input sjannon", "\input sdynamo", "\input stitul" atd. +Když si pro svůj dokument vyberu třeba rodiny "JannonText", +"DynaGroteskR" a "Farao", pak místo toho, abych psal + +\begtt +\input ofs [allfonts] +\endtt +% +si vystačím~s +\begtt +\input ofs [sjannon, sdynamo, stitul] +\endtt +% +což způsobí načítání podstatně méně souborů s~deklaracemi fontových rodin. + +Pokud potřebuji vědět, jak ty fonty vypadají, napíšu například: + +\begtt +$ pdfcsplain ofscatal [sjannon, sdynamo, stitul] ; acroread ofscatal.pdf +\endtt +% +Soubor "ofscatal.tex", který vytvoří katalog, byl zařazen do balíku +OFS od verze~"Oct 2002". + +\kap Přepínač rodin a velikostí + +Hlavním příkazem OFS na uživatelské úrovni je "\setfonts". Jedná se +především o~přepínač rodin, viz výpis "\fontusage" v~předchozí sekci. +Přepínač má dva parametry v~hranaté závorce oddělené lomítkem. Prvním +parametrem je název rodiny a druhým požadovaná velikost fontů. Pokud +některý parametr chybí, přepínač nebude jeho nastavení měnit. Přepínač +samozřejmě funguje lokálně ve skupinách, jako bývá u~fontových +přepínačů obvyklé. Po přepnutí rodiny pracují přepínače variant +(obvykle "\rm", "\bf", "\it", "\bi") pro novou rodinu. Varianta se po +přepnutí rodiny inicializuje stejná, jako byla před přepnutím, +tj. jsme-li zrovna v~kurzívě rodiny Times a přepneme do Helveticy, +zůstáváme ve variantě "\it" rodiny Helvetica, tj. skloněné +písmo. Pokud ale při přepnutí rodiny aktuální varianta v~nové rodině +neexistuje, inicializuje se varianta "\rm", kterou musí obsahovat +každá rodina. + +Příklady + +\begtt +\setfonts [JannonText/10.5] % nastavím na začátku dokumentu +\setfonts [/14]\bf % například pro nadpisy +\setfonts [/8]\rm % pro poznámky pod čarou +\setfonts [DynagroteskR/]\it % třeba pro citáty +\setfonts [CMTypewriter/] % pro strojopis. + % tento přepínač např. v kurzívě nastaví automaticky + % variantu kurzíva-strojopis. +\endtt + +Výhodou tedy je, že si nemusím pamatovat názvy matrik (v~\LaTeX{}u pak +nesrozumitelné zkratky rodin používané v~NFSS), ale píšu název rodiny +do dokumentu stejným způsobem, jak jej vidím v~písmovém katalogu. +Pokud udělám v~názvu rodiny překlep (třeba nedodržím velká a malá +písmena), příkaz "\setfonts" spustí "\showfonts", tj. na obrazovce +a v~logu vidím seznam všech rodin, které mohu použít. + +Velikost fontů mohu nastavit přímo udáním v~jednotce "pt", nebo +připsáním jiné jednotky (např. "mm"), nebo jako u~primitivu "\font" +pomocí slova "scaled" (koeficient zvětšení se váže k~základní +velikosti fontu) a konečně i pomocí zcela nového prefixu "mag", který +udává zvětšení vzhledem ke zrovna použité velikosti fontů, například: + +\begtt +\def\maly{\setfonts [/mag0.8]} +stanu se {\maly menším a {\maly menším a {\maly ještě menším}}} +a už jsem se z toho dostal. +\endtt +% +dopadne takto: + +\medskip +\def\maly{\setfonts[/mag0.8]} +stanu se {\maly menším a {\maly menším a {\maly ještě menším}}} a +už jsem se z~toho dostal. +\medskip + +Prefix "mag" pro velikost využijeme například v~logu \LaTeX{}, které +jsem si v~plainu definoval jako + +\begtt +\def\LaTeX{L\kern-.2em\raise.45ex\hbox{\setfonts[/mag.7] A}\kern-.05em\TeX} +\endtt +% +a funguje to v~nadpisech (je tam tučné vyvýšené A~odpovídající +velikosti) i v~poznámkách pod čarou. V~\LaTeX{}u samotném mají toto +logo definováno tak, že se pro vyvýšené A~použije font v~indexové +velikosti. No jo, zde jim to náhodou prochází, ale co kdyby se +(například v~jiném v~logu) hodilo pro některé písmeno použít +velikost "mag.8", která není jako indexová velikost použita? +Bez OFS bychom to pak dělali dost obtížně, protože NFSS nám řešení +nenabízí. + +Dalším využitím prefixu "mag" je možnost korigovat nestejné střední +výšky písma. Například v~tomto sborníku je pro strojopis použit +"CMTypewriter". Pokud si všimnete v~jiných příspěvcích, než tento, +vidíte, že uvnitř odstavců ten strojopis s~fontem Charter moc nesedí, protože +strojopis má menší střední výšku písma. Stačí ale pro přepínač "\tt" +použít "\setfonts [CMTypewriter/mag1.1]", a střední výška je +v~lati. To vidíme například v~tomto příspěvku. +A~funguje to včetně zmenšených variant, které jsou +v~příspěvcích pro \SLT{} použity v~abstaktu, poznámce pod čarou, +nebo třeba v~údaji \uv{Email}, uvedeném v~záhlaví příspěvku. + +Příkaz "\setfonts" může obsahovat i specifikaci varianty (viz výpis +příkazu "\fontusage"). Pak se už nejedná o~přepínač rodiny, ale fontu +samotného. V~takovém případě přepínač "\setfonts" neovlivní přepínače +variant "\rm", "\bf" a dalších, ale nastaví jen požadovaný jediný +font. Například pro nadpisy by šlo psát "\setfonts[-bf/14]" místo +"\setfonts[/14]\bf", ale museli bychom mít jistotu, že v~nadpisu +nepoužijeme přepínač varianty, protože ten by vrátil font do velikosti +aktuální rodiny. Tou velikostí je třeba 10pt. + +Abychom v~nadpisu mohli použít přepínač "\it", a přitom se dostali do +varianty "\bi" (což je žádoucí), je potřeba přepínač fontu v~makru +pro nadpis naprogramovat zhruba takto: + +\begtt +\def\nadpis #1{{\setfonts[/14]\bf \let\it=\bi #1}} +\endtt +% +Kvůli tomuto jednoduchému obratu, který zvládne snad každý plainista, +jsem se rozhodl nekomplikovat jádro OFS podobným způsobem jako NFSS a +nezavádět tedy další \uv{nezávislou souřadnici} popisující duktus fontu. +Pro speciální rodiny fontů (jako je třeba rodina +"DynaGrotesk") jsem ale snadno pomocí doplňujících maker vytvořil +přepínač, který respektuje ještě o~jednu \uv{nezávislou souřadnici} +více, než zvládá NFSS. V~tomto případě to nebyl jen duktus, ale +i stupeň zúžení písma. Navíc tento přepínač dokáže \uv{poskakovat} po +jednotkách vpřed a vzad podél zvolené souřadnice. To také NFSS +nezvládá. + +Často se hodí vytvářet zkratky pro přepínače rodin. K~tomu slouží +makro "\fontdef\přepínač[Rodina/velikost]", které funguje podobně, +jako použití konstrukce "\gdef\přepínač{\setfonts[Rodina/velikost]}". +V~záhlaví tohoto dokumentu mám například uvedeno: + +\begtt +\input ofs [ffonts] % Charter je ve skupině free fonts +\setfonts [Charter/10pt] % výchozí rodina +\fontdef\tt [CMTypewriter/mag1.1] % strojopis, korekce střední výšky +\fontdef\verbtt [CMTypewriter/8] % strojopis pro display ukázky +\fontdef\small [Charter/9] % zmenšení pro abstrakt a záhlaví +\endtt + +Možná čtenáře napadne, že jsem nemusel psát podruhé slovo "Charter" +v~deklaraci přepínače "\small". Při kompletní změně základní rodiny +dokumentu na jinou bych pak mohl změnit slovo "Charter" jen na +jediném místě (u~příkazu "\setfonts") a byl bych hotov. +Bohužel, vynechání rodiny v~příkazu "\small" vede +k~problémům, protože tento příkaz je použit v~záhlaví dokumentu, +tj. ~v~"\output" rutině. Pokud zde neuvedeme explicitně rodinu, dědí se +rodina aktuálně použitá, která ovšem může být jakákoli, protože +"\output" rutina je vyvolávaná z~různých míst při zpracování +dokumentu. Mít záhlaví jednou strojopisem a podruhé Charterem podle +toho, odkud byla "\output" rutina zavolána, je samozřejmě nežádoucí. + +Tento problém se dá řešit \uv{vykřičníkovou} konvencí, kterou umí +zpracovat příkaz "\fontdef": + +\begtt +\fontdef\small [!/9] \addcmd\small {\rm} % pro abstrakt a záhlaví +\endtt +% +Vykřičník je nahrazen aktuální rodinou už v~době činnosti příkazu +"\fontdef", nikoli tedy až v~době provádění přepínače. V~"\output" +rutině se musíme ještě postarat o~potlačení dědičnosti aktuální +varianty. Proto jsem použil ještě příkaz "\addcmd" (zaveden nově od +verze OFS "Oct 2002"), který k~existujícímu makru přidá další příkazy +na jeho konec. Celá deklarace fontů v~tomto dokumentu tedy vypadá +zhruba takto: + +\begtt +\input ofs [ffonts] % Charter je ve skupině free fonts +\setfonts [Charter/10pt] % výchozí rodina +\fontdef\tt [CMTypewriter/mag1.1] % strojopis, korekce střední výšky +\fontdef\verbtt [CMTypewriter-rm/8] % strojopis pro display ukázky +\fontdef\small [!/9] +\addcmd \small {\baselineskip11pt\rm} % zmenšení pro abstrakt a záhlaví +\fontdef\fontsekce [!/12] +\addcmd \fontsekce {\bf \let\it=\bi} % pro nadpisy sekcí +\fontdef\fonttitul [!-bf/14.4] % v titulu nebudeme přepínat varianty +\endtt + +Povedlo se tedy veškeré aktivity související s~výběrem fontů +soustředit na jedno místo dokumentu bez nutnosti používat názvy +metrik. + + +\kap Kódování fontů +%------------------ + +OFS pro plain implicitně pracuje v~kódování \CSfont{}ů, ale můžete +jej přepnout do jiného kódování. +\footnote{OFS pro \LaTeX{} přenechává starost o~kódování zcela na~NFSS.} + +Základem informace o~kódování v~OFS pro plain je makro "\fotenc", +které má implicitně hodnotu "8z". To znamená, že rodiny "CMRoman", +"CMTypewriter" a "CMSans" budou pracovat s~\CSfont{}y. +Kdyby uživatel nastavil "\def\fotenc{8t}", začalo by OFS pracovat +v~případě těchto rodin s~DC nebo EC fonty. Jaké je technické pozadí +vysvětlíme v~následující sekci. + +Většina metrik \ps{}ových fontů má varianty "*8t" (pro +kódování podle Corku) a "*8z" (pro kódování podle \CSfont{}ů). +Makro "\fotenc" tedy musí obsahovat koncovku metrik, které chceme +použít. Tím volíme kódování. Příklad: + +\begtt +\input ofs +\setfonts [Times/] text 1 % metrika: ptmr8z, tj. kódování CSfontů +\def\fotenc{8t} +\setfonts [/] text 2 % metrika: ptmr8t tj. kódování podle Corku +\endtt +% +Máte-li své fonty v~nějakém dalším kódování a koncovky metrik máte +s~názvy třeba "*8x", pak není problém napsat "\def\fotenc{8x}" +a můžete začít používat své vlastní metriky. + +Pokud používáte kódování podle Corku, doporučuji definovat makro +"\fotenc" jako "8t" před zavedením makra OFS. Při použití složitěji +deklarovaných rodin se to hodí. + +V~balíku OFS jsou soubory "ofs-8z.tex" a "ofs-8t.tex", ve kterých je +deklarace akcentů a některých na kódování závislých maker, jako +například "\promile". Implicitně není načten ani jeden z~těchto +souborů, tj.~jsou respektována makra pro akcenty z~originálního +plainu, která expandují na "\accent" podle kódování CMfontů. + +Pokud je toto chování nevyhovující, můžete načíst pomocí "\input" +jeden nebo oba dva výše zmíněné soubory (v~libovolném pořadí -- jejich +definice se nehádají). Pokud načtete oba soubory, pak makra pro +akcenty expandují na znaky podle kódování, které je aktuálně nastaveno +v~makru "\fotenc" ("8z" nebo "8t"). + +Podívejme se do souborů "ofs-8z.tex" a "ofs-8t.tex" (výrazně kráceno): + +\begtt +%%% Default accents in CM +\accentdef \` * 8z {\accent 18 } % grave +\accentdef \' * 8z {\accent 19 } % acute +\accentdef \v * 8z {\accent 20 } % caron +\accentdef \u * 8z {\accent 21 } % breve +... +%%% Standard characters in plain (redefined here) +\def\aa{\r a} +\def\AA{\r A} +\characterdef \i 8z 16 +\characterdef \j 8z 17 +\characterdef \SS 8z {SS} +\characterdef \AE 8z 29 +... +%%% Extra characters from CS-fonts +\characterdef \promile 8z 141 +\characterdef \varhyphen 8z 156 +\characterdef \flqq 8z 158 +\characterdef \frqq 8z 159 +\characterdef \clqq 8z 254 +\characterdef \crqq 8z 255 +... +%%% Accented letters from CS fonts +\accentdef \` A 8z 152 +\accentdef \' A 8z 193 +\accentdef \" A 8z 196 +\accentdef \` a 8z 184 +\accentdef \' a 8z 225 +... +%%% Default accents in Cork +\accentdef \` * 8t {\accent 0 } +\accentdef \' * 8t {\accent 1 } +\accentdef \^ * 8t {\accent 2 } +\accentdef \~ * 8t {\accent 3 } +\accentdef \" * 8t {\accent 4 } +... +%%% Standard characters in plain (redefined here) +\def\aa{\r a} +\def\AA{\r A} +\characterdef \i 8t 25 +\characterdef \j 8t 26 +\characterdef \SS 8t 223 +\characterdef \AE 8t 198 +... +\characterdef \promile 8t {\%\char 24 } +\characterdef \textpertenthousand 8t {\%\char 24\char 24 } +... +%%% Accented letters from Cork encoding +\accentdef \. i 8t `\i +\accentdef \u A 8t 128 +\accentdef \k A 8t 129 +\accentdef \' C 8t 130 +\accentdef \v C 8t 131 +... +\endtt + +Myslím, že syntaxe a význam příkazů "\characterdef" a "\accentdef" je +v~této ukázce samovysvětlující. Pokud ne, odkazuji čtenáře do +dokumentace~\cite{ofsdoc}, která do posledního detailu (včetně popisu +jednotlivých fází expanze) vysvětluje činnost těchto příkazů. + +\LaTeX{}ovému uživateli to může připomínat příkazy +"\DeclareTextSymbol" a "\DeclareTextComposite" a jim podobné, které +dělají zhruba totéž (jen poněkud komplikovaněji, nepřehledněji a +těžkopádněji). + +OFS také počítá s~možností, že některé znaky jsou přidány do extra +fontu, který s~původním fontem vytváří uspořádanou dvojici. Takové +dvojice metrik jsou použity například pro fonty Štormovy písmolijny, +protože obsahují více než 256 znaků. Přitom by bylo škoda některé +znaky nevyužít. Ke každé metrice těchto fontů ("*8z" i "*8t") je +přiřazena extra metrika "*6s", obsahující zbylé znaky. +Pomocí "\characterdef" a "\accentdef" můžeme deklarovat přítomnost +těchto znaků v~kódování "6s" (viz soubor "stormenc.tex"). Pokud +aktuální metrika má k~sobě extra font v~kódování "6s" a je požadován +znak z~tohoto fontu, OFS jej automaticky \uv{vyloví} pomocí +přechodného přepnutí na extra metriku. + + +\kap Deklarace rodin +%------------------- + +Podívejme se nyní do souboru "a35.tex", který deklaruje rodiny pro +základních 35 \ps{}ových fontů (kráceno): + +\begtt +%%% Times, Helvetica, Courier is in OFS defaults + +\ofsdeclarefamily [AvantGarde] {% -------------------- AvantGarde + \loadtextfam (Book) pagk\fotenc;% + (Demi) pagd\fotenc;% + (BookOblique) pagko\fotenc;% + (DemiOblique) pagdo\fotenc;;% + \def\TeX{T\kern-.08em\lower.3333ex\hbox{E}\kern-0.09emX}% +} +\ofsdeclarefamily [NewCentury] {% -------------------- NewCenturySchlbk + \loadtextfam (Roman) pncr\fotenc;% + pncb\fotenc;% + pncri\fotenc;% + pncbi\fotenc;;% + \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX}% +} +... +\endtt + +Zde je tedy deklarováno zobrazení mezi názvy rodin a metrikami.% +\footnote{ + V~OFS pro \LaTeX{} takové soubory neexistují; tam se pouze + deklaruje zobrazení mezi (dlouhými) názvy rodin v~OFS a zkratkami + rodin v~NFSS. +} +Každá rodina má čtyři povinné metriky (pro běžné čtyři +varianty). Metriky jsou zapsány pomocí "\fotenc", aby fungovalo +přepínání kódování. Mezi předposledním a posledním středníkem může být +uvedeno extra kódování, pokud je font rozložen do dvou metrik (v~tomto +příkladě není). Příkazy uvedené v~parametru "\ofsdeclarefamily" se +provedou při každém přepnutí rodiny příkazem "\setfonts". +V~ukázce tam máme alternativní definice loga "\TeX", aby toto logo pěkně +vypadalo v~každém fontu. + +Od verze OFS "Oct 2002" je přidána možnost použít nepovinné parametry +v~argumentech příkazu "\loadtextfam". Tyto parametry píšeme do kulaté +závorky a značí název varianty, pokud je odlišný od běžného názvu. +Tato informace se použije v logu a při tisku katalogu. + +Podívejme se ještě do souboru "sjannon.tex" z~podpory Štormových fontů +(výpis je zde neúplný): + +\begtt +\ofsdeclarefamily [JannonAntikva] {% -------- Jannon Antikva + \loadtextfam sjnr\fotenc;% + sjnb\fotenc;% + sjnri\fotenc;% + sjnbi\fotenc;6s;% + \newvariant2 \mr (Medium) sjnm\fotenc;6s;% + \newvariant3 \mi (MediumItalic) sjnmi\fotenc;6s;% +} +\ofsdeclarefamily [JannonText] {% ------------ Jannon Text + \loadtextfam sjnrg\fotenc;% + sjnbg\fotenc;% + sjnrig\fotenc;% + sjnbig\fotenc;6s;% + \newvariant2 \mr (Medium) sjnmg\fotenc;6s;% + \newvariant3 \mi (MediumItalic) sjnmig\fotenc;6s;% +} +... +\endtt +% +Vidíme, že navíc je zde deklarována extra metrika v~kódování~"6s" a že +se zde deklarují doplňující přepínače variant "\mr" a "\mi" mimo +základní čtyři varianty. Podrobnější vysvětlení použitých příkazů +čtenář opět najde v~dokumentaci~\cite{ofsdoc}. + +Jak jsou pomocí expanze "\fotenc" mapovány metriky \CSfont{}ů +resp. DC~fontů, které v~názvech koncovku "8z" ani "8t" nemají? +To souvisí rovněž s~tím, že tyto fonty mají pro různé velikosti různé +metriky. V~deklaračních souborech je pak tento problém vyřešen +způsobem \uv{dvě mouchy jednou ranou} (viz soubor "ofsdef.tex"): + +\begtt +\registertfm cmr8z - csr10 % metrika pro všechny velikosti +\registertfm cmr8z 0pt-6pt csr5 +\registertfm cmr8z 6pt-7pt csr6 +\registertfm cmr8z 7pt-8pt csr7 +\registertfm cmr8z 8pt-9pt csr8 +\registertfm cmr8z 9pt-10pt csr9 +\registertfm cmr8z 10pt-12pt csr10 +\registertfm cmr8z 12pt-17pt csr12 +\registertfm cmr8z 17pt-* csr17 +... +\registertfm cmr8t - dcr10 % metrika pro všechny velikosti +... +\ofsdeclarefamily [CMRoman] {% ------------ Computer Modern Roman + \loadtextfam cmr\fotenc;% + cmbx\fotenc;% + cmti\fotenc;% + cmbxti\fotenc;;% + \newvariant8 \sl (Slanted) cmsl\fotenc;;% +} +\endtt +% +Centrálním příkazem je zde makro "\registertfm", které mapuje +neexistující metriky formálně vytvořené pomocí expanze "\fotenc" do +skutečných metrik. Toto makro také umí registrovat různé metriky +pro různé velikosti. Pokud tedy budeme chtít font daný pomocí +"\setfonts[CMRoman-rm/12.5]", vyvolá se při "\fotenc" +s~hodnotou "8z" metrika "csr12 at12.5pt". \uv{Metrika pro všechny +velikosti} se použije v~případě, že je velikost fontu deklarovaná +s~\hbox{prefixem} "scaled", takže "\setfonts[CMRoman-rm/scaled1250]" vyvolá +metriku "csr10 scaled1250". Ztrácíte-li přehled o~tom, jaká metrika se +ve skutečnosti použila, můžete zapnout logovací přepínač +"\detailfontmessages". + +Podíváte-li se do souboru "ofsdef.tex" podrobněji, můžete si všimnout, že +jsem metriky rodiny "CMRoman" a dalších "CM"~rodin pro kódování~"8t" poněkud +odbyl. Registroval jsem je jako metriky DC fontů bez střídání metrik pro +různé velikosti. Nechtělo se mi to totiž vypisovat a nevěděl jsem, zda +uživatel tohoto kódování raději nepoužije EC fonty místo DC fontů. +Ve zmíněném souboru jsou příklady, jak by se ta deklarace měla +provést. Pokud ji někdo dopíše (například pro DC i EC fonty do zvláštních +souborů), rád ji do balíku OFS zařadím. Osobně ale fonty kódované +v~"8t" nepoužívám, takže mě zatím nic nemotivuje to udělat. + + +\kap Matematické fonty +%--------------------- + +Každý plainista ví, že fonty pro matematiku se sdružují do matematických +rodin obsahující font pro základní, indexovou a index-indexovou +velikost. Rovněž ví, že první čtyři matematické rodiny (s~číslem 0 až~3) +jsou s~\TeX{}em jistým způsobem pevně významově svázány a další rodiny +se dají deklarovat. + +Aby plainista při deklarování matematických rodin nemusel psát třikrát +za sebou "\font" a potom ještě +"\textfont\rodina=...", "\scriptfont...", atd, je v~OFS k~tomu +vytvořena zkratka "\loadmathfam", jak ukážu za chvíli. + +Inicializaci matematických fontů v~OFS pro plain provedeme pomocí +příkazu "\setmath". Dokud tento příkaz nepoužijeme, jsou matematické +fonty ve stavu, jak je inicializoval plain. Ve třech parametrech +příkazu "\setmath" (oddělených lomítky) dáváme najevo, jakou chceme +základní velikost, jakou pro indexy a jakou pro indexy +indexů. Jsou-li tyto parametry prázdné, je použito relativní zmenšení +podle aktuální velikosti textového fontu pomocí prefixu "mag" takto: + +\begtt +\setmath [//] je totéž jako \setmath [mag1.0/mag.7/mag.5] +\endtt + +Příkaz "\setmath" vypočítá požadované velikosti a startuje makro pro +zavedení fontů "\mathfonts". Dále tento příkaz startuje makro pro +inicializaci matematického kódování "\mathchars". Tato makra si může +plainista definovat jak chce, nicméně většinou využije již +připravených maker "\defaultmathfonts" a "\defaultmathchars", která +jsou udělána tak, že spouštějí různé varianty kódu podle hodnoty maker +"\fomenc" a "\mathversion". + +Při "\def\fomenc{PS}" (imlicitní hodnota: PostScriptové fonty) se zavedou +fonty tak, že matematická kurzíva se ztotožní s~aktuální textovou +kurzívou a podobně rodina~0 pro číslice a textové symboly zůstává +nastavena podle aktuální textové rodiny varianty "\rm". +Matematické symboly se berou +(pokud to je možné) z~běžně dostupného \ps{}ového fontu +"Symbol". Zbytek (např. natahovací závorky) pak zůstává v~Computer +Modern. Matematické kódování je pro tuto situaci výrazně +pozměněno obvyklými primitivy "\mathchardef" a podobnými, aby byly +dosažitelné všechny znaky plainu. Například pro řecká písmena musela být +zavedena nová rodina se skloněným fontem "Symbol" a příkazy typu "\alpha" jsou +překódovány z~původní matematické rodiny~1 na tuto novou rodinu. + +Nastavíte-li "\def\fomenc{CM}", pak příkaz "\setmath" zavede +stejné matematické fonty z~rodiny Computer Modern, jako +v~plainu. Příkaz "\setmath[//]" pak pouze aktualizuje velikosti těchto fontů +podle velikosti aktuálního textového fontu. + +Nakoupíte-li fonty MathTimes, dále načtete soubor "ofsmtdef.tex" (součástí +OFS od verze "Jun. 2002") a definujete "\def\fomenc{MT}", pak příkaz +"\setmath" zavede kurzívu a rodinu~0 stejně jako při +"\def\fomenc{PS}", ale navíc použije pro {\it všechny\/} symboly včetně +natahovacích závorek fonty MathTimes. + +Kromě hodnoty "\fomenc" se příkaz "\setmath" větví i vzhledem +k~hodnotě makra "\mathversion". Implicitně OFS počítá se dvěma +hodnotami tohoto mak\-ra: "\def\mathversion{normal}" nebo "bold". +Při verzi "bold" jsou načteny do matematických rodin tučné alternativy +fontů, pokud to jde. Vše názorně vysvětlí pohled do souboru +"ofsdef.tex": + +\begtt +\def\defaultmathfonts{\csname load\fomenc\mathversion math\endcsname} +\def\defaultmathchars{\csname set\fomenc mathchars\endcsname} +\def\mathfonts{\defaultmathfonts} +\def\mathchars{\defaultmathchars + \let\mathchars=\relax % to protect the twice math-setting +} +\def\loadPSnormalmath{% + \loadmathfam 0[tenrm/]% Actual Roman font + \loadmathfam 1[tenit/]% Actual Italic font + \loadmathfam 2[/cmsy]% Standard symbols from CM + \noindexsize\loadmathfam 3[tenex/]% Standard extra symbols from CM + \chardef\itfam=1 \chardef\bifam=5 + \loadmathfam \bffam [tenbf/]% Actual Bold font + \loadmathfam \bifam [tenbi/]% Actual Bold Italic + \newmathfam\symbfam + \loadmathfam \symbfam [/psyr]% PostScript Symbol + \newmathfam\symbofam + \loadmathfam \symbofam [/psyro]% PostScript Symbol Oblique +} +\def\loadPSboldmath{% + \loadmathfam 0[tenbf/]% Actual Bold font + \loadmathfam 1[tenbi/]% Actual Bold-Italic font +... +} +\def\loadCMnormalmath{% + \loadmathfam 0[/cmr8z]% Roman font + \loadmathfam 1[/cmmi]% Math Italic font + \loadmathfam 2[/cmsy]% Standard symbols from CM + \noindexsize\loadmathfam 3[/cmex10]% Standard extra symbols from CM +... +} +\def\loadCMboldmath{% + \loadmathfam 0[/cmbx8z]% Roman font + \loadmathfam 1[/cmmib10]% Math Italic font +... +} +\def\setPSmathchars{% + \fontmessage{\ofsmessageheader Math codes are set for PS encoding}% + \mathcode`\,="602C + \mathcode`\.="002E + \delcode`\<="\hex\symbfam E130A + \delcode`\>="\hex\symbfam F130B + \delcode`\|="\hex\symbfam 7C30C + \edef\langle{\delimiter"4\hex\symbfam E130A }% + \edef\rangle{\delimiter"5\hex\symbfam F130B }% + \mathchardef\alpha "0\hex\symbofam 61 + \mathchardef\beta "0\hex\symbofam 62 + \mathchardef\gamma "0\hex\symbofam 67 +... +} +\endtt + +Chceme-li přidat nějaké další matematické rodiny (v~terminologii NFSS +matematické abecedy), pak můžeme postupovat třeba takto: + +\begtt +\def\mathfonts{\defaultmathfonts + \newmathfam\bbfam + \loadmathfam \bbfam [/bbold12]% Dvojitá vertikální kresba + \def\bb{\fam\bbfam}% +} +\def\mathchars{\defaultmathchars + \mathchardef\balpha "0\hex\bbfam 0B + \mathchardef\bbeta "0\hex\bbfam 0C + ... +} +\endtt + +Příklad z~konce sekce~3 nyní obohatíme o~možnost práce +s~matematikou v~libovolných velikostech: + +\begtt +\input ofs [ffonts] % Charter je ve skupině free fonts +\setfonts [Charter/10pt] % výchozí rodina +\setmath[//] % inicializace matematiky +\fontdef\tt [CMTypewriter/mag1.1] % strojopis, korekce střední výšky +\fontdef\verbtt [CMTypewriter-rm/8] % strojopis pro display ukázky +\fontdef\small [!/9] % zmenšení pro abstrakt a záhlaví +\addcmd \small {\baselineskip11pt \rm \def\mathversion{normal}\setmath[//]} +\fontdef\fontsekce [!/12] % pro nadpisy sekcí +\addcmd \fontsekce {\bf \let\it=\bi \def\mathversion{bold}\setmath[//]} +\fontdef\fonttitul [!-bf/14.4] % titul +\endtt + +Nyní i v~abstraktech, poznámkách pod čarou a záhlavích je matematika +ve všech velikostech všech možných indexů zmenšená odpovídajícím +způsobem. Pokud by se matematika měla použít v~názvu sekce, pak bude +také tučná a správně veliká. + + +\reference + +\bib \url{www.pismolijna.cz}, \url{www.cstug.cz/stormtype}. + +\bib \url{ftp://math.feld.cvut.cz/pub/olsak/ofs}. + +\bib Petr Olšák. {\it OFS: Olšákův fontový systém}. 2001. + Dokumentace k~balíku je v~souborech "ofsdoc.tex", "ofsdoc.pdf". + +\bib Petr Olšák. {\it Jak \TeX{} k~fontům ze Střešovic přišel}. Zpravodaj + Československého sdružení uživatelů \TeX{}u, 4/2001, pp~153--180. + +\bye + -- cgit v1.2.3