summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-06-05 23:22:51 +0000
committerKarl Berry <karl@freefriends.org>2017-06-05 23:22:51 +0000
commit54b6d43a181a1c487ee932cb9eb9d70344ab4b47 (patch)
tree7e78caac6c47f48e32e7cdd288ee13851cbd4b34 /Master/texmf-dist/doc
parent10b9b1b60f417e53a4230a14cbafe7b614bc1ce8 (diff)
combofont (28may17)
git-svn-id: svn://tug.org/texlive/trunk@44491 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r--Master/texmf-dist/doc/lualatex/combofont/README.md22
-rw-r--r--Master/texmf-dist/doc/lualatex/combofont/combofont.pdfbin0 -> 86024 bytes
-rw-r--r--Master/texmf-dist/doc/lualatex/combofont/combofont.tex187
3 files changed, 209 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/lualatex/combofont/README.md b/Master/texmf-dist/doc/lualatex/combofont/README.md
new file mode 100644
index 00000000000..6c7cc78f50e
--- /dev/null
+++ b/Master/texmf-dist/doc/lualatex/combofont/README.md
@@ -0,0 +1,22 @@
+# The combofont package
+
+An EXPERIMENTAL package to add nfss-declaration of combo fonts to a luaLaTeX document
+
+Version 0.1 Ulrike Fischer 2017-
+
+
+## License
+
+LATEX Project Public License 1.3c.
+
+## Contents
+
+- Readme.md (this file)
+- combofont.sty (the sty)
+- combofont.tex, combofont.pdf (the docu and example)
+
+
+## Installation
+
+Put the sty where it can be found.
+
diff --git a/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf b/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf
new file mode 100644
index 00000000000..cc161245f36
--- /dev/null
+++ b/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/lualatex/combofont/combofont.tex b/Master/texmf-dist/doc/lualatex/combofont/combofont.tex
new file mode 100644
index 00000000000..5cb4dece757
--- /dev/null
+++ b/Master/texmf-dist/doc/lualatex/combofont/combofont.tex
@@ -0,0 +1,187 @@
+% !Mode:: "TeX:DE:UTF-8:Main"
+\RequirePackage{luatex85}
+\documentclass[parskip=half-,egregdoesnotlikesansseriftitles]{scrartcl}
+\usepackage{combofont}
+\usepackage{ydoc-code,ydoc-desc}
+\usepackage{fontspec}
+
+\usepackage{xcolor}
+
+
+\setupcombofont{combotest-regular}
+ {
+ {file:lmroman10-regular.otf:\combodefaultfeat} at #1pt,
+ {file:lmsans10-regular.otf} at \fpeval{#1/10*15}pt,
+ {file:cmunrm.otf} at #1pt
+ }
+ {
+ {} ,
+ 0x41-0x5A*0x21*0x3F,
+ fallback
+ }
+
+\setupcombofont{combotest-bold}
+ {
+ {file:lmroman10-bold.otf:\combodefaultfeat} at #1pt,
+ {file:lmsans10-bold.otf} at \fpeval{#1/10*15}pt,
+ {file:cmunbbx.otf} at #1pt
+ }
+ {
+ {} ,
+ 0x41-0x5A*0x21*0x3F,
+ fallback
+ }
+
+
+
+\DeclareFontFamily{TU}{combotest}{}
+\DeclareFontShape{TU} {combotest}{m}{n}{<->combo*combotest-regular}{}
+\DeclareFontShape{TU} {combotest}{bx}{n}{<->combo*combotest-bold}{}
+
+\title{The \texttt{combofont} package}
+\author{Ulrike Fischer\thanks{fischer@troubleshooting-tex.de}}
+\newcommand\package[1]{\texttt{#1}}
+\begin{document}
+\maketitle
+
+\section{Status: EXPERIMENTAL}
+
+This is a EXPERIMENTAL package.
+
+It can disappear without notice e.\,g. if the \package{luaotfload} changes so that it no longer work, or if luatex changes, or if \package{fontspec} includes the code.
+
+It is also possible that syntax and commands change in a incompatible way. So if you use it in a production environment: \textbf{You have been warned}.
+
+\section{Introduction}
+In version 2.7. \package{luaotfload} supports combining characters from multiple fonts into a single virtualized one.
+
+That means that one can build a font that takes e.g. the capital letters from a sans serif font and the lowercase letters from a serif font. Or a font that pulls in missing greek or cyrillic glyphs from another font.
+
+The methods pulls in \emph{only} glyphs. It is not suitable for every imaginable font combination -- some drawbacks are described below -- and one should use it with care. Nevertheless it is a quite neat extension of the tools to manipulate fonts.
+
+The main problem with the examples in the \package{luaotfload} manual is that it creates fonts of a fix size. This means that they don't respond to command like \verb+\large+ or \verb+\footnotesize+.
+
+After trying around a bit and then asking a question (https://tex.stackexchange.com/questions/371647/call-a-luatex-combo-font-through-nfss) I got from David Carlisle the idea to use a \texttt{size}-Funktion which one define with \verb+\DeclareSizeFunction+ to inject the needed code to size the combo-font in a nfss-\verb+\DeclareFontShape+-command.
+
+\package{combofont.sty} is the result.
+
+It is not meant as a production package but as package that helps to exploit the use of combo fonts.
+
+\section{Requirements}
+You need at least an up-to-date TeXLive 2016. TeXLive 2017 with luatex 1.0.4. or a current miktex is better.
+
+
+\section{Using combo fonts}
+
+To be able to use a combo font with standard \LaTeX\ font commands you have to do two things (the source code of this documentation is a complete example):
+
+\begin{enumerate}
+\item Setup and describe the building of the combo font with \verb+\setupcombofont+
+
+\item Write \texttt{nfss}-declarations
+\end{enumerate}
+
+\subsection{Setup the combo font}
+
+\DescribeMacro\setupcombofont{<name>}{<comma list of basefonts>}{<comma list of ranges and code-points>}
+
+\begin{description}
+ \item[\marg{name}] is the name of the font. It should be some unique ascii-string without spaces. If you intent to define lots of fonts it would be a good idea to think about a sensible naming sheme. In the example here I simply used \texttt{combotest-regular} and \texttt{combotest-bold}.
+
+ \item[\marg{comma list of basefonts}] This should be a list of font declarations you want to use to build your combo font. The syntax used is described in the \package{luaotfload} manual. Example:
+
+\begin{verbatim}
+{
+ {file:lmroman10-regular.otf:\combodefaultfeat} at #1pt,
+ {file:lmsans10-regular.otf} at \fpeval{#1/10*15}pt,
+ {file:cmunrm.otf} at #1pt
+}
+\end{verbatim}
+
+\minisec{Important points are:}
+\begin{description}
+\item[Order of the fonts] The first font is the main font which will receive the glyphs. So think carefully which font is should be and setup its font features correctly. \package{combofont} defines as a helper command \verb+\combodefaultfeat+ which sets \texttt{mode=node;script=latn;language=DFLT;+tlig;}.
+
+\item[Size declaration] The font description should end with a size declaration line \verb+at #1pt+. When processing the font \verb+#1+ will be replaced by the current font size. As you can see in the second font you can do calculations.
+\end{description}
+
+\item[\marg{comma list of ranges and code-points}] This is a comma list of settings which describe which glyphs are taken from the respective font. Example:
+
+\begin{verbatim}
+{
+ {} ,
+ 0x41-0x5A*0x21*0x3F,
+ fallback
+}
+\end{verbatim}
+
+\minisec{Important points:}
+\begin{enumerate}
+\item There should be as many settings as there are fonts.
+\item Empty entries should be marked with a pair of braces (normally the first entry is empty).
+\item You can add ranges of code points and single code points. Blocks are separated by an asterix \verb+*+. The example set the uppercase letters and the exclamation and the question mark.
+\item The keyword \texttt{fallback} means that this font is used for „missing glyphs“ (in the example for the cyrillic glyphs).
+\end{enumerate}
+\end{description}
+
+\subsection{Write \texttt{nfss}-declarations}
+
+After all the fonts you need have been setup, you can write suitable \texttt{nfss}-declaration which make it possible to call the font by family and other font commands. Example:
+
+\begin{verbatim}
+\DeclareFontFamily{TU}{combotest}{}
+\DeclareFontShape {TU}{combotest}{m}{n} {<->combo*combotest-regular}{}
+\DeclareFontShape {TU}{combotest}{bx}{n}{<->combo*combotest-bold}{}
+\end{verbatim}
+
+The important point is the size-function \verb+combo*+ which does all the work.
+
+
+\section{Demonstration}
+
+
+\verb+\fontfamily{combotest}\selectfont+:
+\fontfamily{combotest}\selectfont
+Some Text with Capital Words!
+Eh bien, mon prince. Gênes et Lueques ne sont plus que des
+apanages, des поместья, de la famille Buonaparte?
+%
+
+\verb+\large+\large:
+Some Text with Capital Words!
+Eh bien, mon prince. Gênes et Lueques ne sont plus que des
+apanages, des поместья, de la famille Buonaparte?
+
+\verb+\tiny+\tiny:
+Some Text with Capital Words!
+Eh bien, mon prince. Gênes et Lueques ne sont plus que des
+apanages, des поместья, de la famille Buonaparte?
+
+\verb+\bfseries\normalsize+\bfseries
+\normalsize:
+Some Text with Capital Words!
+Eh bien, mon prince. Gênes et Lueques ne sont plus que des
+apanages, des поместья, de la famille Buonaparte?
+
+
+\verb+\tiny+\tiny:
+Some Text with Capital Words!
+Eh bien, mon prince. Gênes et Lueques ne sont plus que des
+apanages, des поместья, de la famille Buonaparte?
+%
+
+\normalfont\normalsize
+\section{Remarks and open questions}
+
+As mentioned in the introduction a combo font only pulls in glyphs. This has a lot of (not all yet understood or seen) side effects. Here a few things that should be considered when building a combo font:
+
+\begin{description}
+ \item[Kerning] Obviously some kerning works (see e.g. the large W before the o in the demonstration). But it is quite unclear which values are used, how bad it can get and if one can correct it.
+ \item[Font features] Only font features of the first font are taken into account. E.g. adding a color setting has an effect only if applied to the first font and then colors all glyphs. \verb!+smcp! (the open type small caps feature) only has an effect if the first font knows it. Mixing scripts and languages is probably not possible (but I didn't try yet).
+ \item[Speed] I didn't try to optimize the loading of the fonts.
+ \item[Pulling glyphs in other positions] One interesting question would if it is possible to switch glyph positions before or after the pull. E.g. if one could move the chars a-z from a sans serif text font to the math sans serif positions.
+ \item[Side effects] I naturally directly found a side-effect of such a combo font declaration: https://github.com/lualatex/luaotfload/issues/414. So the question is if there are more.
+\end{description}
+\end{document}
+
+