From 7a10f8644fac291290ed3faddd3bbc9d1b206bd6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 8 Jun 2019 21:43:09 +0000 Subject: combofont (8jun19) git-svn-id: svn://tug.org/texlive/trunk@51348 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/lualatex/combofont/README.md | 3 +- .../combofont/combofont-test-fira-math.pdf | Bin 14675 -> 15301 bytes .../combofont/combofont-test-fira-math.tex | 35 ++++------ .../doc/lualatex/combofont/combofont.pdf | Bin 78359 -> 78828 bytes .../doc/lualatex/combofont/combofont.tex | 41 +++++------ .../tex/lualatex/combofont/combofont.sty | 76 ++++++++++++--------- 6 files changed, 80 insertions(+), 75 deletions(-) diff --git a/Master/texmf-dist/doc/lualatex/combofont/README.md b/Master/texmf-dist/doc/lualatex/combofont/README.md index 725d81a1525..10a189f3da5 100644 --- a/Master/texmf-dist/doc/lualatex/combofont/README.md +++ b/Master/texmf-dist/doc/lualatex/combofont/README.md @@ -2,7 +2,8 @@ An EXPERIMENTAL package to add nfss-declaration of combo fonts to a luaLaTeX document -Version 0.2 copyright Ulrike Fischer 2017- +Version 0.3 2019/06/08 +copyright Ulrike Fischer ## License diff --git a/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.pdf b/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.pdf index 3e54fe2ea11..c5a83a5c1fd 100644 Binary files a/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.pdf and b/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.tex b/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.tex index 0cc437d5ae4..75d2f39c162 100644 --- a/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.tex +++ b/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.tex @@ -1,5 +1,5 @@ % !Mode:: "TeX:DE:UTF-8:Main" - +%% Date 2017/07/03 Version 0.2 combofont example \documentclass[parskip=full]{scrartcl} \usepackage{luacode} @@ -26,7 +26,7 @@ luatexbase.add_to_callback ) \end{luacode} -\usepackage{unicode-math} +\usepackage[math-style=upright]{unicode-math} \usepackage{combofont} \setmainfont{Fira Sans} @@ -41,19 +41,19 @@ luatexbase.add_to_callback {% {}, 0x30-0x39, - 0x61-0x7A + 0x61-0x7A*0x03B1-0x03C9 } \setupcombofont{FiraMathScript} {% file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT;+ssty=0 at #1pt, file:firasans-regular.otf at #1pt, - file:firasans-regularitalic.otf at #1pt + file:firasans-italic.otf at #1pt } {% {}, 0x30-0x39, - 0x61-0x7A + 0x61-0x7A*0x03B1-0x03C9 } \setupcombofont{FiraMathScriptScript} @@ -65,20 +65,20 @@ luatexbase.add_to_callback {% {}, 0x30-0x39, - 0x61-0x7A + 0x61-0x7A*0x03B1-0x03C9 } - -% Mathversion bold need Script and ScriptScript declarations too! + +% Mathversion bold need Script and ScriptScript declarations too! \setupcombofont{FiraMathBold} {% file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT; at #1pt, file:firasans-regular.otf at #1pt, - file:firasans-regularitalic.otf at #1pt + file:firasans-italic.otf at #1pt } {% {}, 0x30-0x39, - 0x61-0x7A + 0x61-0x7A*0x03B1-0x03C9 } @@ -101,17 +101,10 @@ luatexbase.add_to_callback \SetSymbolFont{operators}{bold}{TU}{FiraMath}{bx}{n} -% Map a etc to the ascii range. Original values can be found with -% [\Umathcharclass `\a] [\Umathcharfam `\a] [\Umathcharslot `\a] - -\Umathcode `\a = "7 "0 "61 -\Umathcode `\b = "7 "0 "62 -\Umathcode `\c = "7 "0 "63 -\Umathcode `\d = "7 "0 "64 -\Umathcode `\e = "7 "0 "65 -\Umathcode `\f = "7 "0 "66 -\Umathcode `\g = "7 "0 "67 -\Umathcode `\h = "7 "0 "68 +% Map "a" etc to the ascii range. Original values can be found with +%[\Umathcharclass `\a] [\Umathcharfam `\a] [\Umathcharslot `\a] +% not needed because of math-style=upright +%\Umathcode `\a = "7 "0 "61 \begin{document} diff --git a/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf b/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf index 0a1d94e01e9..54b9763a34c 100644 Binary files a/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf and b/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/combofont/combofont.tex b/Master/texmf-dist/doc/lualatex/combofont/combofont.tex index 6c098b87e10..88ceecdf78b 100644 --- a/Master/texmf-dist/doc/lualatex/combofont/combofont.tex +++ b/Master/texmf-dist/doc/lualatex/combofont/combofont.tex @@ -1,8 +1,9 @@ % !Mode:: "TeX:DE:UTF-8:Main" -\RequirePackage{luatex85} \documentclass[parskip=half-,egregdoesnotlikesansseriftitles]{scrartcl} \usepackage{combofont} \usepackage{ydoc-code,ydoc-desc} +\usepackage[english]{babel} +\usepackage[autostyle]{csquotes} \usepackage{fontspec} \usepackage{xcolor} @@ -38,7 +39,9 @@ \DeclareFontShape{TU} {combotest}{m}{n}{<->combo*combotest-regular}{} \DeclareFontShape{TU} {combotest}{bx}{n}{<->combo*combotest-bold}{} -\title{The \texttt{combofont} package} +\title{The \texttt{combofont} package \\ +{\normalsize Version \csname UlrikeFischer@package@ufcombofont@version\endcsname\ +from \csname UlrikeFischer@package@ufcombofont@date\endcsname}} \author{Ulrike Fischer\thanks{fischer@troubleshooting-tex.de}} \newcommand\package[1]{\texttt{#1}} \begin{document} @@ -46,29 +49,29 @@ \section{Status: EXPERIMENTAL} -This is a EXPERIMENTAL package. +This is an 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 can disappear without notice e.\,g. if the \package{luaotfload} changes so that it no longer works, 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}. +It is also possible that syntax and commands change in an 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. +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 method 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+. +The main problem with the examples in the \package{luaotfload} manual is that they create 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. +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 defines 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. +You need at least an up-to-date TeXLive 2016. TeXLive 2017 with luatex 1.0.4 or a current miktex is better. \textbf{Change Version 0.2, 3.7.2017}: The style no longer loads the now obsolete \texttt{l3regex}, it assumes that it is loaded by \texttt{expl3}. In older \TeX-systems you will have to load the package. @@ -88,7 +91,7 @@ To be able to use a combo font with standard \LaTeX\ font commands you have to d \DescribeMacro\setupcombofont{}{}{} \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{name}] is the name of the font. It should be some unique ascii-string without spaces. If you intend 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: @@ -105,8 +108,8 @@ To be able to use a combo font with standard \LaTeX\ font commands you have to d \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. \emph{Don't forget the size declaration!} - -\item Be careful with the commas: there shouldn't be one after the last font. + +\item Be careful with the commas: there shouldn't be one after the last font. \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: @@ -124,13 +127,13 @@ To be able to use a combo font with standard \LaTeX\ font commands you have to d \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). +\item The keyword \texttt{fallback} means that this font is used for \enquote{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: +After all the fonts you need have been setup, you can write suitable \texttt{nfss}-declarations which make it possible to call the font by family and other font commands. Example: \begin{verbatim} \DeclareFontFamily{TU}{combotest}{} @@ -183,17 +186,17 @@ Combofonts can also be used in math. There is a test file called \texttt{combofo \minisec{Important points:} \begin{enumerate} \item This a first try to get something working in math. It is in no way finished or complete, I'm rather certain that something will be missing or even faulty. -\item Start with a real math font with a math constants table. -\item Don't expect to get a perfect sans serif math font this way without work. It can take quite some time to adjust everything. Also a text font is not really meant to be used as math font. +\item Start with a real math font with a math constants table. +\item Don't expect to get a perfect sans serif math font this way without work. It can take quite some time to adjust everything. Also a text font is not really meant to be used as math font. \item The lua-code for the font patch compares \texttt{fontdata.psname} with the string \\\texttt{TeXGyrePagellaMath-Regular} to restrict the patch to the specific font. The font name database of luaotfload-names.lua contains for \textsf{TeX Gyre Pagella Math} these entries: - + \begin{verbatim} ["plainname"]="TeXGyrePagellaMath-Regular", ["psname"]="texgyrepagellamathregular", \end{verbatim} - + As you can see the correct string for the comparision with \texttt{fontdata.psname} is in \verb+["plainname"]+ and not in \verb+["psname"]+. Don't ask me why. \texttt{luaotfload} seems to copy the infos around quite a lot. So when adapting the code to other fonts, test with various font names if it seems not to work. \end{enumerate} diff --git a/Master/texmf-dist/tex/lualatex/combofont/combofont.sty b/Master/texmf-dist/tex/lualatex/combofont/combofont.sty index abeb91097f4..24572b1f779 100644 --- a/Master/texmf-dist/tex/lualatex/combofont/combofont.sty +++ b/Master/texmf-dist/tex/lualatex/combofont/combofont.sty @@ -1,21 +1,29 @@ +% !Mode:: "TeX:DE:UTF-8:Main" +%28.05.2018 +\def\UlrikeFischer@package@ufcombofont@date{2019/06/08}\def\UlrikeFischer@package@ufcombofont@version{0.3} + \RequirePackage{xparse} -\ProvidesExplPackage {combofont} {2017/07/03} {0.2} +\ProvidesExplPackage {combofont} {\UlrikeFischer@package@ufcombofont@date}{\UlrikeFischer@package@ufcombofont@version} {An EXPERIMENTAL package to add nfss-declaration of combo fonts to a luaLaTeX document} % highly experimental! Comments to Ulrike Fischer. fischer@troubleshooting-tex.de +\prop_if_exist:NT \g_msg_module_name_prop + { + \prop_gput:Nnn \g_msg_module_name_prop { ufcombo }{ combofont } + } -\msg_new:nnn {combo} {need-luatex} +\msg_new:nnn {ufcombo} {need-luatex} { The~ combofont~package~requires~LuaLaTeX.~Quitting. } -\msg_new:nnn {combo} {combofont-already-exists} +\msg_new:nnn {ufcombo} {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} + \msg_fatal:nn {ufcombo} {need-luatex} \endinput } @@ -28,29 +36,29 @@ \tl_set:Nn\l_tmpa_tl { #2 } \regex_replace_all:nnN {\#1} {\c{f@size}} \l_tmpa_tl % \tl_show:N\l_tmpa_tl - \seq_if_exist:cTF { l__combo_#1_basefonts_seq } + \seq_if_exist:cTF { l__ufcombo_#1_basefonts_seq } { - \msg_warning:nnn { combo} {combofont-already-exists} { #1 } + \msg_warning:nnn { ufcombo} {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 } + \seq_new:c { l__ufcombo_#1_basefonts_seq } + \seq_set_split:cnV { l__ufcombo_#1_basefonts_seq } { , }\l_tmpa_tl + %%\seq_show:c {l__ufcombo_#1_basefonts_seq } + \seq_new:c { l__ufcombo_#1_combodesc_seq } + \seq_set_from_clist:cn { l__ufcombo_#1_combodesc_seq } { #3 } + %%\seq_show:c { l__ufcombo_#1_combodesc_seq } + \__ufcombo_build_combodesc:n { #1 } } } -\cs_new:Nn \__combo_call_basefonts:n +\cs_new:Nn \__ufcombo_call_basefonts:n { \int_zero:N \l_tmpa_int - \seq_map_inline:cn {l__combo_#1_basefonts_seq} + \seq_map_inline:cn {l__ufcombo_#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 + \exp_args:Nc \font { l__ufcombo_tmpfont_\int_to_roman:n{\l_tmpa_int}_tl } = ##1 } } @@ -59,38 +67,38 @@ -\cs_new:Nn \__combo_build_combodesc:n +\cs_new:Nn \__ufcombo_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_new:c { l__ufcombo_#1_combodesc_tl } + \tl_set:cx { l__ufcombo_#1_combodesc_tl } { \tl_to_str:n { " } combo \tl_to_str:n { : }~ } + \int_step_inline:nnnn { 1 } { 1 } { \seq_count:c { l__ufcombo_#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 } + \tl_put_right:cn { l__ufcombo_#1_combodesc_tl } { ##1~->~\fontid } + \exp_args:Nnc \tl_put_right:cn { l__ufcombo_#1_combodesc_tl } { - l_combo_tmpfont_\int_to_roman:n{##1}_tl + l__ufcombo_tmpfont_\int_to_roman:n{##1}_tl } - \tl_set:Nx\l_tmpa_tl { \seq_item:cn {l__combo_#1_combodesc_seq } {##1} } + \tl_set:Nx\l_tmpa_tl { \seq_item:cn {l__ufcombo_#1_combodesc_seq } {##1} } \tl_if_empty:NF \l_tmpa_tl { - \tl_put_right:cx { l__combo_#1_combodesc_tl} + \tl_put_right:cx { l__ufcombo_#1_combodesc_tl} { - ,~ \seq_item:cn {l__combo_#1_combodesc_seq } {##1} + ,~ \seq_item:cn {l__ufcombo_#1_combodesc_seq } {##1} } } - \tl_put_right:cx { l__combo_#1_combodesc_tl} {\tl_to_str:n{;}} + \tl_put_right:cx { l__ufcombo_#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 } + \tl_put_right:cx { l__ufcombo_#1_combodesc_tl } { \tl_to_str:n { " } } + %% \tl_show:c { l__ufcombo_#1_combodesc_tl } } -\DeclareSizeFunction{combo}{\__combo_sfcnt:} +\DeclareSizeFunction{combo}{\__ufcombo_sfcnt:} -\cs_new:Nn\__combo_sfcnt: +\cs_new:Nn\__ufcombo_sfcnt: { - % \tl_show:c {l__combo_\use:c{mandatory@arg}_combodesc_tl} - \__combo_call_basefonts:n { \mandatory@arg } - \tl_set_eq:Nc \external@font { l__combo_\use:c{mandatory@arg}_combodesc_tl} + % \tl_show:c {l__ufcombo_\use:c{mandatory@arg}_combodesc_tl} + \__ufcombo_call_basefonts:n { \mandatory@arg } + \tl_set_eq:Nc \external@font { l__ufcombo_\use:c{mandatory@arg}_combodesc_tl} }% \tl_new:N\combodefaultfeat -- cgit v1.2.3