texlive[44491] Master: combofont (28may17)

commits+karl at tug.org commits+karl at tug.org
Tue Jun 6 01:22:51 CEST 2017


Revision: 44491
          http://tug.org/svn/texlive?view=revision&revision=44491
Author:   karl
Date:     2017-06-06 01:22:51 +0200 (Tue, 06 Jun 2017)
Log Message:
-----------
combofont (28may17)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/lualatex/combofont/
    trunk/Master/texmf-dist/doc/lualatex/combofont/README.md
    trunk/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf
    trunk/Master/texmf-dist/doc/lualatex/combofont/combofont.tex
    trunk/Master/texmf-dist/tex/lualatex/combofont/
    trunk/Master/texmf-dist/tex/lualatex/combofont/combofont.sty
    trunk/Master/tlpkg/tlpsrc/combofont.tlpsrc

Added: trunk/Master/texmf-dist/doc/lualatex/combofont/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/combofont/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/combofont/README.md	2017-06-05 23:22:51 UTC (rev 44491)
@@ -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.
+


Property changes on: trunk/Master/texmf-dist/doc/lualatex/combofont/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf	2017-06-05 23:21:13 UTC (rev 44490)
+++ trunk/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf	2017-06-05 23:22:51 UTC (rev 44491)

Property changes on: trunk/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/lualatex/combofont/combofont.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/combofont/combofont.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/combofont/combofont.tex	2017-06-05 23:22:51 UTC (rev 44491)
@@ -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 at 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}
+
+


Property changes on: trunk/Master/texmf-dist/doc/lualatex/combofont/combofont.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/lualatex/combofont/combofont.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/combofont/combofont.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/lualatex/combofont/combofont.sty	2017-06-05 23:22:51 UTC (rev 44491)
@@ -0,0 +1,98 @@
+\RequirePackage{xparse}
+\ProvidesExplPackage {combofont} {2017/05/26} {0.1}
+  {An EXPERIMENTAL package to add nfss-declaration of combo fonts to a luaLaTeX document}
+% highly experimental! Comments to Ulrike Fischer. fischer at troubleshooting-tex.de
+
+\msg_new:nnn {combo} {need-luatex}
+ {
+  The~ combofont~package~requires~LuaLaTeX.~Quitting.
+ }
+
+\msg_new:nnn {combo} {combofont-already-exists}
+ {
+  The~combofont~#1~has~already~been~set~up.~I~won't~overwrite~it
+ }
+
+\sys_if_engine_luatex:F
+ {
+   \msg_fatal:nn {combo} {need-luatex}
+   \endinput
+ }
+
+\RequirePackage{xfp,l3regex}
+
+\cs_generate_variant:Nn \seq_set_split:Nnn {cnV}
+
+\NewDocumentCommand\setupcombofont { m m m } %name, basefonts, combofont declaration
+ {
+   \tl_set:Nn\l_tmpa_tl { #2 }
+   \regex_replace_all:nnN {\#1} {\c{f at size}} \l_tmpa_tl
+   % \tl_show:N\l_tmpa_tl
+   \seq_if_exist:cTF { l__combo_#1_basefonts_seq }
+   {
+    \msg_warning:nnn { combo} {combofont-already-exists} { #1 }
+   }
+   {
+    \seq_new:c               { l__combo_#1_basefonts_seq }
+    \seq_set_split:cnV       { l__combo_#1_basefonts_seq }  { , }\l_tmpa_tl
+    %%\seq_show:c {l__combo_#1_basefonts_seq }
+    \seq_new:c               { l__combo_#1_combodesc_seq }
+    \seq_set_from_clist:cn   { l__combo_#1_combodesc_seq } { #3 }
+    %%\seq_show:c              { l__combo_#1_combodesc_seq }
+    \__combo_build_combodesc:n { #1 }
+   }
+ }
+
+
+\cs_new:Nn \__combo_call_basefonts:n
+ {
+  \int_zero:N \l_tmpa_int
+  \seq_map_inline:cn {l__combo_#1_basefonts_seq}
+   {
+    \int_incr:N \l_tmpa_int
+    \exp_args:Nc \font { l_combo_tmpfont_\int_to_roman:n{\l_tmpa_int}_tl } = ##1
+   }
+ }
+
+
+
+
+
+
+\cs_new:Nn \__combo_build_combodesc:n
+ {
+   \tl_new:c { l__combo_#1_combodesc_tl }
+   \tl_set:cx { l__combo_#1_combodesc_tl } { \tl_to_str:n { " } combo \tl_to_str:n { : }~ }
+   \int_step_inline:nnnn { 1 } { 1 } { \seq_count:c { l__combo_#1_basefonts_seq } }
+   {
+    \tl_put_right:cn { l__combo_#1_combodesc_tl } { ##1~->~\fontid }
+    \exp_args:Nnc \tl_put_right:cn { l__combo_#1_combodesc_tl }
+     {
+      l_combo_tmpfont_\int_to_roman:n{##1}_tl
+     }
+    \tl_set:Nx\l_tmpa_tl { \seq_item:cn {l__combo_#1_combodesc_seq } {##1} }
+    \tl_if_empty:NF \l_tmpa_tl
+    {
+     \tl_put_right:cx { l__combo_#1_combodesc_tl}
+      {
+       ,~ \seq_item:cn {l__combo_#1_combodesc_seq } {##1}
+      }
+    }
+    \tl_put_right:cx { l__combo_#1_combodesc_tl} {\tl_to_str:n{;}}
+   }
+   \tl_put_right:cx { l__combo_#1_combodesc_tl } { \tl_to_str:n { " } }
+   %% \tl_show:c { l__combo_#1_combodesc_tl }
+ }
+
+\DeclareSizeFunction{combo}{\__combo_sfcnt:}
+
+\cs_new:Nn\__combo_sfcnt:
+ {
+  % \tl_show:c {l__combo_\use:c{mandatory at arg}_combodesc_tl}
+   \__combo_call_basefonts:n { \mandatory at arg }
+   \tl_set_eq:Nc \external at font { l__combo_\use:c{mandatory at arg}_combodesc_tl}
+ }%
+
+\tl_new:N\combodefaultfeat
+\tl_set:Nn\combodefaultfeat{mode=node;script=latn;language=DFLT;+tlig;}
+\endinput


Property changes on: trunk/Master/texmf-dist/tex/lualatex/combofont/combofont.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2017-06-05 23:21:13 UTC (rev 44490)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2017-06-05 23:22:51 UTC (rev 44491)
@@ -157,7 +157,7 @@
     collcell collectbox collref
     colordoc colorinfo coloring colorsep colorspace colortab
     colortbl colorwav colorweb colourchange
-    combelow combine combinedgraphics comfortaa comicneue
+    combelow combine combinedgraphics combofont comfortaa comicneue
     comma commado commath comment
     compactbib
     complexity components-of-TeX comprehensive computational-complexity

Modified: trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc	2017-06-05 23:21:13 UTC (rev 44490)
+++ trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc	2017-06-05 23:22:51 UTC (rev 44491)
@@ -8,6 +8,7 @@
 depend checkcites
 depend chickenize
 depend cloze
+depend combofont
 depend cstypo
 depend ctablestack
 depend enigma

Added: trunk/Master/tlpkg/tlpsrc/combofont.tlpsrc
===================================================================


More information about the tex-live-commits mailing list