From 48ac5b79a7d11122a657760afec88c96e0e76d27 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 12 May 2016 21:32:17 +0000 Subject: csplain (12may16) git-svn-id: svn://tug.org/texlive/trunk@41068 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/csplain/base/csplain.ini | 2 + Master/texmf-dist/tex/csplain/fonts/cs-all.tex | 7 +- Master/texmf-dist/tex/csplain/fonts/luafonts.tex | 9 +- Master/texmf-dist/tex/csplain/fonts/uni-math.tex | 312 +++++++++++++++++++++ .../tex/csplain/opmac/fontfam-catalog.tex | 21 +- 5 files changed, 343 insertions(+), 8 deletions(-) create mode 100644 Master/texmf-dist/tex/csplain/fonts/uni-math.tex (limited to 'Master/texmf-dist/tex/csplain') diff --git a/Master/texmf-dist/tex/csplain/base/csplain.ini b/Master/texmf-dist/tex/csplain/base/csplain.ini index 0c35d243218..a3683fd75f2 100644 --- a/Master/texmf-dist/tex/csplain/base/csplain.ini +++ b/Master/texmf-dist/tex/csplain/base/csplain.ini @@ -255,6 +255,8 @@ file extcode.tex renamed to il2code.tex (suggested by Jan Kasprzak) * ctimes.tex etc. font-files rewritten based on ff-mac.tex * lmfonts.tex rewritten based on ff-mac.tex * exchars.tex: \tgexchars introduced, \edef used in \setexfont +* uni-math.tex introduced +* luafonts.tex: corrected \let\luafonts=\relax COPYRIGHT ========= diff --git a/Master/texmf-dist/tex/csplain/fonts/cs-all.tex b/Master/texmf-dist/tex/csplain/fonts/cs-all.tex index b30ade6c19c..d549f652078 100644 --- a/Master/texmf-dist/tex/csplain/fonts/cs-all.tex +++ b/Master/texmf-dist/tex/csplain/fonts/cs-all.tex @@ -29,7 +29,10 @@ \w{cs-schola}{TeX Gyre Schola}{\rm, \it, \bf, \bi, \caps\rm, ...} \w{cs-cursor}{TeX Gyre Cursor}{\rm, \it, \bf, \bi, \caps\rm, ...} \w{lmfonts}{Latin Modern}{\rm, \it, \bf, \bi + math} +\w{kp-fonts}{KP-fonts}{\rm, \it, \bf, \bi + many font modifiers + math} +\w{cs-libertine}{Linux Libertine}{\rm, \it, \bf, \bi + mono, Unicode only} \w{tx-math}{TX math fonts}{14 families, \mathchardef's prepared. Loaded automatically.} +\w{ntx-math}{NTX math fonts}{14 families, \mathchardef's prepared. Another TX.} \w{ams-math}{AMS math fonts}{12 families, \mathchardef's prepared. You can load it.} - -\endinput \ No newline at end of file +\w{uni-math}{Unocode Math font}{given by \unimathfont macro} +\endinput diff --git a/Master/texmf-dist/tex/csplain/fonts/luafonts.tex b/Master/texmf-dist/tex/csplain/fonts/luafonts.tex index 88795e9a553..65d841ef940 100644 --- a/Master/texmf-dist/tex/csplain/fonts/luafonts.tex +++ b/Master/texmf-dist/tex/csplain/fonts/luafonts.tex @@ -1,10 +1,11 @@ -% I don't understand this. This is a result of my reverse engeneering of the -% luaotfload.sty package. +% This is a result of my reverse engeneering of the luaotfload.sty package. % LuaTeX needs these \directlua in order to \font primitive works like in XeTeX. % Petr Olsak Nov. 2012, Nov. 2013 -\openin15=ltluatex.tex +\ifx\luafonts\undefined \else \message{...skipping}\endinput\fi +\global\let\luafonts=\relax +\openin15=ltluatex.tex \ifeof15 \else \closein15 %%%%%%%%%%%%% ltluatex exists \expandafter\ifx\csname e@alloc@attribute@count\endcsname \relax @@ -38,8 +39,6 @@ luatexbase.require_module('\luaotfloadfile') texio.write_nl = oriwrite % return to original meaning } -\global\let\luafonts=\relax - \endinput \fi \ifnum\luatexversion<76 %%%%%%%%%%%%% LuaTeXvesion < 76: diff --git a/Master/texmf-dist/tex/csplain/fonts/uni-math.tex b/Master/texmf-dist/tex/csplain/fonts/uni-math.tex new file mode 100644 index 00000000000..1528c3abb4b --- /dev/null +++ b/Master/texmf-dist/tex/csplain/fonts/uni-math.tex @@ -0,0 +1,312 @@ +% uni-math.tex +%%%%%%%%%%%%%%%%%% +% Petr Olsak 2016 + +\def\unimathversion{May 2016} % Warning: this is at beta testing state + +% Macros for loading Unicode math fonts in XeTeX or LuaTeX + +% usage: \def\unimathfont{Font Name} \input uni-math +% \setmathsizes[text/script/scriptscript]\normalmath +% Example: \setmathsizes[12/8.4/6]\normalmath ... loads fonts at given sizes + +% Full example: +% \let\loadmathfonts=\relax % don't load 8bit math fonts +% \input cs-pagella % load Pagella Text fonts +% \def\unimathfont{[texgyrepagella-math]} % declare Pagella Math font +% \input uni-math % load Pagella Math font +% If you are using OPmac then you can set sizes of math+text fonts as usual: +% \typosize[12/14.4] ... + +\ifx\Umathcode\undefined + \message{uni-math: Unicoded engine not detected. Macro-file ignored...} + \endinput\fi + +\ifx\unimathfont\undefined + \message{uni-math: You must define \noexpand\unimathfont first.} + \bgroup + \toks0={Examples: \def\unimathfont{[xits-math]} ... XITS MATH^^J + \def\unimathfont{[latinmodern-math]} ... Latin Modern Math^^J + \def\unimathfont{[texgyretermes-math]} ... TeXGyre Termes Math^^J + \def\unimathfont{[texgyrebonum-math]} ... TeXGyre Bonum Math^^J + \def\unimathfont{[texgyrepagella-math]} ... TeXGyre Pagella Math^^J + \def\unimathfont{[texgyreschola-math]} ... TeXGyre Schola Math^^J + Note brackets if file name is used. Don't use quotes "...". + }\newlinechar=`^^J \message{\the\toks0}\message{Macrofile ignored...} + \egroup + \endinput\fi + +\message{FONT: \unimathfont\space - Unicode Math (v. \unimathversion) prepared.} +\let\mathpreloaded=U + +\ifx\directlua\undefined \else \ifx\luafonts\undefined \input luafonts +\fi\fi + +\def\normalmath{% + \loadumathfamily 1 {\unimathfont} % Base font + \loadmathfamily 4 rsfs % script +} +\def\boldmath{\ifmmode \fakeboldmath \else + \everymath=\expandafter{\the\everymath \fakeboldmath}% + \everydisplay=\expandafter{\the\everydisplay \fakeboldmath}% + \fi % unfortunatelly, we have no real bold version of whole math symbols +} +\def\fakeboldmath{\dimen0=0.02em \def\tmp##1.##2##3;{##1.##2}% + \putfakebold{2 Tr \expandafter\tmp\the\dimen0; w}% + \aftergroup\nofakeboldmath + \let\fakeboldmath=\relax +} +\def\nofakeboldmath{\putfakebold{0 Tr}} + +\ifx\pdfliteral\undefined \ifx \pdfextension\undefined + \def\putfakebold#1{\special{pdf:literal #1}} +\else \def\putfakebold{\pdfextension literal}\fi +\else \let\putfakebold=\pdfliteral \fi + +\def\regtfm #1 0 #2 *{\expandafter % copied from ams-math + \def\csname#1:reg\endcsname{#2 16380 \relax}% + \def\tmpa{#1}\reversetfm #2 * % +} +\def\reversetfm #1 #2 {% we need this data for \setmathfamily + \expandafter\let\csname#1:reg\expandafter\endcsname + \csname\tmpa:reg\endcsname + \if*#2\else \expandafter\reversetfm \fi +} +\regtfm rsfs 0 rsfs5 6 rsfs7 8.5 rsfs10 * + +\count18=4 % Note: if you want to combine more Math fonts at another math family slots, + % don't use family 2 and 3. They are reserved for \fontdimens. + +\def\umathname#1#2{"#1:\mfontfeatures;#2"} +\def\mfontfeatures{mode=base;script=math;} + +\def\loadumathfamily #1 #2 { + \let\dgsize=\sizemtext \font\mF=\umathname{#2}{} at\dgsize \textfont#1=\mF + \ifnum#1=1 \textfont2=\mF \textfont3=\mF \fi + \let\dgsize=\sizemscript \font\mF=\umathname{#2}{+ssty=0;} at\dgsize + \scriptfont#1=\mF + \ifnum#1=1 \scriptfont2=\mF \scriptfont3=\mF \fi + \let\dgsize=\sizemsscript \font\mF=\umathname{#2}{+ssty=1;} at\dgsize + \scriptscriptfont#1=\mF + \ifnum#1=1 \scriptscriptfont2=\mF \scriptscriptfont3=\mF \fi + \let\dgsize=\undefined +} +\def\loadmathfamily #1 #2 {\chardef\tmp#1\corrmsizes + \let\dgsize=\sizemtext \font\mF=\whichtfm{#2} at\dgsize \textfont#1=\mF + \let\dgsize=\sizemscript \font\mF=\whichtfm{#2} at\dgsize \scriptfont#1=\mF + \let\dgsize=\sizemsscript \font\mF=\whichtfm{#2} at\dgsize \scriptscriptfont#1=\mF + \let\dgsize=\undefined +} +\def\corrmsizes{\ptmunit=1\ptunit\relax} +\def\setmathsizes[#1/#2/#3]{% + \def\sizemtext{#1\ptmunit}\def\sizemscript{#2\ptmunit}% + \def\sizemsscript{#3\ptmunit}% +} +\ifx\ptuint\undefined \def\ptunit{pt}\fi +\ifx\ptmunit\undefined \csname newdimen\endcsname\ptmunit\fi \ptmunit=1\ptunit +\ifx\sizemtext\undefined \setmathsizes[10/7/5]\fi + +\ifx\normalmathloading\relax\else \normalmath \fi % load the fonts + +\newcount\umathnumA \newcount\umathnumB + +\def\umathcorr#1#2{\expandafter#1\expandafter{\the#2}} +\def\umathprepare#1{\def\umathscanholes##1[#1]##2##3\relax{##2}} +\def\umathvalue#1{\expandafter\umathscanholes\umathcharholes[#1]{#1}\relax} + +\def\umathcharholes{% holes in math alphabets: + [119893]{"210E}[119965]{"212C}[119968]{"2130}[119969]{"2131}% + [119971]{"210B}[119972]{"2110}[119975]{"2112}[119976]{"2133}[119981]{"211B}% + [119994]{"212F}[119996]{"210A}[120004]{"2134}% + [120070]{"212D}[120075]{"210C}[120076]{"2111}[120085]{"211C}[120093]{"2128}% + [120122]{"2102}[120127]{"210D}[120133]{"2115}[120135]{"2119} + [120136]{"211A}[120137]{"211D}[120145]{"2124}% +} +\def\umathrange#1#2{\umathnumB=#2\relax \umathrangeA#1} +\def\umathrangeA#1-#2{\umathnumA=`#1\relax + \loop + \umathcorr\umathprepare\umathnumB + \Umathcode \umathnumA = 7 1 \umathcorr\umathvalue{\umathnumB} + \ifnum\umathnumA<`#2\relax + \advance\umathnumA by1 \advance\umathnumB by1 + \repeat +} +\def\umathrangeGREEK{\begingroup + \lccode`A="0391 \lccode`Z="03A9 + \lowercase{\endgroup\umathrange{A-Z}}} +\def\umathrangegreek{\begingroup + \lccode`A="03B1 \lccode`Z="03D6 + \lowercase{\endgroup\umathrange{A-Z}}} +\def\greekdef#1{\ifx#1\relax \else + \begingroup \lccode`X=\umathnumB \lowercase{\endgroup \def#1{X}}% + \advance\umathnumB by 1 + \expandafter\greekdef \fi +} +\umathnumB="0391 +\greekdef \Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta \Iota \Kappa +\Lambda \Mu \Nu \Xi \Omicron \Pi \Rho \varTheta \Sigma \Tau \Upsilon \Phi \Chi \Psi +\Omega \relax + +\umathnumB="03B1 +\greekdef \alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \kappa +\lambda \mu \nu \xi \omicron \pi \rho \varsigma \sigma \tau \upsilon \varphi +\chi \psi \omega \varbeta \vartheta \phi \varpi \relax + +\chardef\ncharrmA=`A \chardef\ncharrma=`a +\chardef\ncharbfA="1D400 \chardef\ncharbfa="1D41A +\chardef\ncharitA="1D434 \chardef\ncharita="1D44E +\chardef\ncharbiA="1D468 \chardef\ncharbia="1D482 +\chardef\ncharclA="1D49C \chardef\ncharcla="1D4B6 +\chardef\ncharbcA="1D4D0 \chardef\ncharbca="1D4EA +\chardef\ncharfrA="1D504 \chardef\ncharfra="1D51E +\chardef\ncharbrA="1D56C \chardef\ncharbra="1D586 +\chardef\ncharbbA="1D538 \chardef\ncharbba="1D552 +\chardef\ncharsnA="1D5A0 \chardef\ncharsna="1D5BA +\chardef\ncharbsA="1D5D4 \chardef\ncharbsa="1D5EE +\chardef\ncharsiA="1D608 \chardef\ncharsia="1D622 +\chardef\ncharsxA="1D63C \chardef\ncharbsx="1D656 +\chardef\ncharttA="1D670 \chardef\nchartta="1D68A + +\protected\def\rmvariables {\umathrange{A-Z}\ncharrmA \umathrange{a-z}\ncharrma} +\protected\def\bfvariables {\umathrange{A-Z}\ncharbfA \umathrange{a-z}\ncharbfa} +\protected\def\nitvariables {\umathrange{A-Z}\ncharitA \umathrange{a-z}\ncharita} +\protected\def\bivariables {\umathrange{A-Z}\ncharbiA \umathrange{a-z}\ncharbia} +\protected\def\calvariables {\umathrange{A-Z}\ncharclA \umathrange{a-z}\ncharcla} +\protected\def\bcalvariables {\umathrange{A-Z}\ncharbcA \umathrange{a-z}\ncharbca} +\protected\def\frakvariables {\umathrange{A-Z}\ncharfrA \umathrange{a-z}\ncharfra} +\protected\def\bfrakvariables {\umathrange{A-Z}\ncharbrA \umathrange{a-z}\ncharbra} +\protected\def\bbvariables {\umathrange{A-Z}\ncharbbA \umathrange{a-z}\ncharbba} +\protected\def\sansvariables {\umathrange{A-Z}\ncharsnA \umathrange{a-z}\ncharsna} +\protected\def\bsansvariables {\umathrange{A-Z}\ncharbsA \umathrange{a-z}\ncharbsa} +\protected\def\isansvariables {\umathrange{A-Z}\ncharsiA \umathrange{a-z}\ncharsia} +\protected\def\bisansvariables {\umathrange{A-Z}\ncharsxA \umathrange{a-z}\ncharsxa} +\protected\def\ttvariables {\umathrange{A-Z}\ncharttA \umathrange{a-z}\nchartta} + +\chardef\greekrmA="0391 \chardef\greekrma="03B1 +\chardef\greekbfA="1D6A8 \chardef\greekbfa="1D6C2 +\chardef\greekitA="1D6E2 \chardef\greekita="1D6FC +\chardef\greekbiA="1D71C \chardef\greekbia="1D736 +\chardef\greeksnA="1D756 \chardef\greeksna="1D770 +\chardef\greeksiA="1D790 \chardef\greeksia="1D7AA + +\protected\def\nitgreek {\umathrangeGREEK\greekrmA \umathrangegreek\greekita} +\protected\def\rmgreek {\umathrangeGREEK\greekrmA \umathrangegreek\greekrma} +\protected\def\bfgreek {\umathrangeGREEK\greekbfA \umathrangegreek\greekbfa} +\protected\def\bigreek {\umathrangeGREEK\greekbfA \umathrangegreek\greekbia} +\protected\def\sansgreek {\umathrangeGREEK\greeksnA \umathrangegreek\greeksna} +\protected\def\isansgreek {\umathrangeGREEK\greeksnA \umathrangegreek\greeksia} + +% Another possibility (slanted capitals in \nitgreek, \bigreek, \isansgreek): +%\protected\def\nitgreek {\umathrangeGREEK\greekitA \umathrangegreek\greekita} +%\protected\def\rmgreek {\umathrangeGREEK\greekrmA \umathrangegreek\greekrma} +%\protected\def\bfgreek {\umathrangeGREEK\greekbfA \umathrangegreek\greekbfa} +%\protected\def\bigreek {\umathrangeGREEK\greekbiA \umathrangegreek\greekbia} +%\protected\def\sansgreek {\umathrangeGREEK\greeksnA \umathrangegreek\greeksna} +%\protected\def\isansgreek {\umathrangeGREEK\greeksiA \umathrangegreek\greeksia} + +\chardef\digitrmO=`0 +\chardef\digitbfO="1D7CE +\chardef\digitbbO="1D7D8 +\chardef\digitsnO="1D7E2 +\chardef\digitbsO="1D7EC +\chardef\digitttO="1D7F6 + +\protected\def\rmdigits {\umathrange{0-9}\digitrmO} +\protected\def\bfdigits {\umathrange{0-9}\digitbfO} +\protected\def\bbdigits {\umathrange{0-9}\digitbbO} +\protected\def\sansdigits {\umathrange{0-9}\digitsnO} +\protected\def\bsansdigits {\umathrange{0-9}\digitbsO} +\protected\def\ttdigits {\umathrange{0-9}\digitttO} + +\protected\def\inmath#1{\relax \ifmmode#1\fi} % to keep off \loop processing in text mode + +% You can redefine these macros to follow your wishes. +% For example you need upgright lowercase greek letters, you don't need +% \bf and \bi behaves as sans serif in math, ... + +\def\rm {\tenrm \inmath{\rmvariables \rmdigits}} +\def\it {\tenit \inmath{\nitvariables}} +\def\bf {\tenbf \inmath{\bsansvariables \sansgreek \bsansdigits}} +\def\bi {\tenbi \inmath{\bisansvariables \isansgreek \bsansdigits}} +\def\tt {\tentt \inmath{\ttvariables \ttdigits}} +\def\bbchar {\bbvariables \bbdigits} +\def\cal {\calvariables} +\def\frak {\frakvariables} +\def\misans {\isansvariables \isansgreek \sansdigits} +\def\mbisans {\bisansvariables \isansgreek \bsansdigits} +\def\script {\rmvariables \fam4 } + +% Math codes: + +\begingroup % \input MathClass.txt: + \def\p#1;#2{\edef\tmp{\pB#2}\ifx\tmp\empty \else\pA#1....\end#2\fi} + \def\pA#1..#2..#3\end#4{% + \ifx\relax#2\relax \pset{"#1}{#4}\else + \umathnumA="#1 + \loop + \pset{\umathnumA}{#4}% + \ifnum\umathnumA<"#2 \advance\umathnumA by1 + \repeat + \fi + } + \def\pB#1{\if#1L1\fi \if#1B2\fi \if#1V2\fi \if#1R3\fi \if#1N0\fi \if#1U0\fi + \if#1F0\fi \if#1O4\fi \if#1C5\fi \if#1P6\fi \if#1A7\fi} + \def\pset#1#2{\global\Umathcode#1=\tmp\space 1 #1\relax + \if#2O\global\Udelcode#1=1 #1\relax\fi + \if#2C\global\Udelcode#1=1 #1\relax\fi + \if#2F\global\Udelcode#1=1 #1\relax\fi + } + \catcode`#=14 + \everypar={\setbox0=\lastbox \par \p} + \input MathClass.txt +\endgroup + +\begingroup % \input unicode-math-table.tex: + \def\UnicodeMathSymbol #1#2#3#4{% + \global\Umathcharnumdef#2=\Umathcodenum#1\relax + \ifx#3\mathopen \gdef#2{\Udelimiter 4 1 #1 }\fi + \ifx#3\mathclose \gdef#2{\Udelimiter 5 1 #1 }\fi + \ifx#3\mathaccent \gdef#2{\Umathaccent fixed 7 1 #1 }\fi + } + \input unicode-math-table +\endgroup + +\nitgreek \nitvariables \rmdigits % default setting + +\Umathcode `- = 2 1 "2212 +\let\{=\lbrace \let\}=\rbrace + +\def\sqrt {\Uradical 1 "0221A } +\def\cuberoot {\Uradical 1 "0221B } +\def\fourthroot {\Uradical 1 "0221C } + +\let\intop=\int \def\int{\intop \nolimits} + +\def\overbrace #1{\mathop {\Umathaccent 7 1 "023DE{#1}}\limits} +\def\underbrace #1{\mathop {\Umathaccent bottom 7 1 "023DF{#1}}\limits} +\def\overparen #1{\mathop {\Umathaccent 7 1 "023DC{#1}}\limits} +\def\underparen #1{\mathop {\Umathaccent bottom 7 1 "023DD{#1}}\limits} +\def\overbracket #1{\mathop {\Umathaccent 7 1 "023B4{#1}}\limits} +\def\underbracket #1{\mathop {\Umathaccent bottom 7 1 "023B5{#1}}\limits} + +\def\widehat {\Umathaccent 7 1 "00302 } +\def\widetilde {\Umathaccent 7 1 "00303 } +\def\overleftharpoon {\Umathaccent 7 1 "020D0 } +\def\overrightharpoon {\Umathaccent 7 1 "020D1 } +\def\overleftarrow {\Umathaccent 7 1 "020D6 } +\def\overrightarrow {\Umathaccent 7 1 "020D7 } +\def\overleftrightarrow {\Umathaccent 7 1 "020E1 } + +\endinput + +-------------------------------------------- + +You can combine more fonts, if you register them to another +math families (5, 6, 7, etc.) in \normalmath macro. + +The default value of \normalmath shows a combination of base Unicode Math +font with 8bit Math font at family 4. See definition of \script macro where +\fam4 is used. Of course, we need to set \rmvariables too, because 8bit font +accepts only codes less than 255. + +See http://tex.stackexchange.com/questions/308749/ for more technical details. diff --git a/Master/texmf-dist/tex/csplain/opmac/fontfam-catalog.tex b/Master/texmf-dist/tex/csplain/opmac/fontfam-catalog.tex index 89f11620505..ac49cd7a224 100644 --- a/Master/texmf-dist/tex/csplain/opmac/fontfam-catalog.tex +++ b/Master/texmf-dist/tex/csplain/opmac/fontfam-catalog.tex @@ -10,7 +10,8 @@ \def\fontfamexecC#1#2#3#4#5#6#7{\ifx\relax#2\relax \else {\testfotenc{#6}\iftrue \par - \noindent {\currtt [#1]\quad (#6)\quad \def\tmp{#7} \detok\tmp}\par\nobreak + \noindent {\currtt [#1]\quad \char`\{+#5\char`\} \space(#6)\quad \def\tmp{#7} \detok\tmp}% + \par\nobreak #7 \edef\basicfont{\fontname\the\font}% \def\variants{#2} @@ -80,5 +81,23 @@ for information about usage of font modifiers. \fontfamL \endgroup +\bigskip +\noindent +The text variants of fonts (shown here) are combined with math collections +of fonts: + +\begtt +AMS ... AMS fonts math +TX .... TX fonts math +KP .... KP fonts math +\endtt + +If {\tt TX} is used then variables (math italic) and roman text are borrowed +from the selected text font. Other math characters are from TX math fonts +collection. +If you are using Xe\TeX{} or Lua\TeX{} then you can load Unicode Math font +instead of this default. See {\tt uni-math.tex} file for more information. + + \endinput -- cgit v1.2.3