diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/font-ini.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/font-ini.mkiv | 691 |
1 files changed, 283 insertions, 408 deletions
diff --git a/Master/texmf-dist/tex/context/base/font-ini.mkiv b/Master/texmf-dist/tex/context/base/font-ini.mkiv index c39bdb8b79c..c7d515cca36 100644 --- a/Master/texmf-dist/tex/context/base/font-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/font-ini.mkiv @@ -12,6 +12,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% runtime commands will move to modules + % simplification ... we no longer deal with specific mmtfa specifications % todo: always fontclass, then less testing @@ -59,6 +61,7 @@ \registerctxluafile{font-syn}{1.001} \registerctxluafile{font-log}{1.001} \registerctxluafile{font-tfm}{1.001} +\registerctxluafile{font-enh}{1.001} \registerctxluafile{font-afm}{1.001} \registerctxluafile{font-cid}{1.001} % cid maps \registerctxluafile{font-ott}{1.001} % otf tables @@ -75,9 +78,11 @@ \registerctxluafile{font-ctx}{1.001} \registerctxluafile{font-xtx}{1.001} \registerctxluafile{font-fbk}{1.001} +\registerctxluafile{font-gds}{1.001} \registerctxluafile{font-ext}{1.001} \registerctxluafile{font-pat}{1.001} \registerctxluafile{font-chk}{1.001} +\registerctxluafile{font-agl}{1.001} \unprotect @@ -166,7 +171,7 @@ \unexpanded\def\startfont {\bgroup\definedfont} -\def\stopfont +\unexpanded\def\stopfont {\egroup} \def\doiffontcharelse#1#2% @@ -480,7 +485,7 @@ \let\currentmathsize\empty -\def\mathsizesuffix{\ifcase0\currentmathsize\or\mathtextsuffix\or\mathscriptscriptsuffix\or\mathscriptsuffix\fi} +\def\mathsizesuffix{\ifcase0\currentmathsize\or\mathtextsuffix\or\mathscriptsuffix\or\mathscriptscriptsuffix\fi} \def\dodosetmathfamily#1#2% {\ifcsname\fontclass \fontbody\c!mm\fontfamily\fontsize\currentmathsize\endcsname \autofontsizefalse @@ -531,6 +536,21 @@ \appendtoks \ifcase\boldmathmode\or\dosetmathfamily\mbfam\c!mb\fi \to \mathstrategies + +% \chardef\msfam\plustwo % math symbol +% +% \def\c!ms{ms} +% +% \unexpanded\def\ms{\ifmmode\fam\plustwo\else\setcurrentfontalternative\c!ms\fi} +% +% \chardef\symbolmathmode\zerocount +% +% \def\enablesymbolmath {\chardef\symbolmathmode\plusone } +% \def\disablesymbolmath{\chardef\symbolmathmode\zerocount} +% +% \appendtoks +% \ifcase\symbolmathmode\or\dosetmathfamily\msfam\c!ms\fi +% \to \mathstrategies %D All used styles, like rm, ss and tt, are saved in a comma %D separated list. Appart from practical limitations one can @@ -561,14 +581,38 @@ %D We could instead have used dirty grouping tricks, but this %D one works too. +% \enableexperiments[fonts.autorscale] +% +% \starttypescript[mscore] +% \definetypeface [mscore] [rm] [serif] [mscoretimes] [default] +% \definetypeface [mscore] [ss] [sans] [mscorearial] [default] [rscale=auto] % 0.860] +% \definetypeface [mscore] [tt] [mono] [mscorecourier] [default] [rscale=auto] % 1.065] +% \definetypeface [mscore] [mm] [math] [times] [default] [rscale=auto] % 1.020] +% \stoptypescript +% +% \starttext +% \setupbodyfont[mscore,12pt] +% \startTEXpage +% test \ss test \tt test +% \stopTEXpage +% \stoptext + \let\defaultrelativefontsize \plusone \let\localrelativefontsize \plusone \def\localabsolutefontsize {\fontbody} \let\relativefontsize \defaultrelativefontsize -\def\saverelativefontsize#1#2% #1=rm|ss|.. #2=waarde - {\setxvalue{\fontclass#1\s!rscale}{#2}} +% \def\saverelativefontsize#1#2% #1=rm|ss|.. #2=waarde +% {\setxvalue{\fontclass#1\s!rscale}{#2}} + +\def\checkrelativefontid + {\ifcsname\??tf\fontclass\s!rname\endcsname + \@EA\let\@EA\relativefontid\csname\??tf\fontclass\s!rname\endcsname + \else + \@EA\xdef\csname\??tf\fontclass\s!rname\endcsname{\the\lastfontid}% + \let\relativefontid\empty + \fi} \def\checkrelativefontsize#1% {\edef\relativefontsize @@ -578,29 +622,13 @@ \csname\defaultfontclass#1\s!rscale\endcsname \else \defaultrelativefontsize - \fi\fi}} - -% \letvalue{\s!default\s!rscale}\defaultrelativefontsize -% -% \def\checkrelativefontsize#1% -% {\edef\relativefontsize -% {\csname -% \ifcsname\fontclass#1\s!rscale\endcsname -% \fontclass#1% -% \else\ifcsname\defaultfontclass#1\s!rscale\endcsname -% \defaultfontclass#1% -% \else -% \s!default -% \fi\fi -% \s!rscale\endcsname}} - -%D We also save: - -\def\savemathtextstyle#1% #1=rm|ss|.. - {\doifsomething{#1}{\setxvalue{\fontclass\c!mm\s!text}{#1}}} - -\def\currentmathtextstyle % we default to empty ! - {\executeifdefined{\fontclass\c!mm\s!text}\empty} + \fi\fi}% + \ifx\relativefontsize\v!auto + \let\relativefontsize\plusone + \checkrelativefontid + \else + \let\relativefontid\minusone + \fi} %D Scaling macros: %D @@ -645,7 +673,8 @@ \newcount\scaledfontmode \newdimen\scaledfontsize -\newtoks\everydefinefont +\newtoks \everydefinefont +\newcount\lastfontid \def\currentfontbodysize {\ifcsname\??ft\s!default\somefontsize\endcsname @@ -654,6 +683,8 @@ \somefontsize \fi} +\let\relativefontid\empty + \def\lowleveldefinefont#1#2% #2 = cs {% \ctxlua{fonts.define.command_1("\luaescapestring{#1}")}% the escapestring catches at \somedimen @@ -697,15 +728,16 @@ "\@@fontclassfallbacks", "\@@fontfallbacks", 0\currentmathsize, - \number\dimexpr\textface\relax + \number\dimexpr\textface\relax, + "\relativefontid" % experiment )}% \edef\somefontspec{at \somefontsize}% we need the resolved designsize (for fallbacks) \expandafter\let\expandafter\lastrawfontcall\csname#2\endcsname \the\everydefinefont} \def\updatefontclassparameters - {\edef\@@fontclassfeatures {\ifcsname\fontclass\s!features \endcsname\csname\fontclass\s!features \endcsname\fi}% - \edef\@@fontclassfallbacks{\ifcsname\fontclass\s!fallbacks\endcsname\csname\fontclass\s!fallbacks\endcsname\fi}} + {\edef\@@fontclassfeatures {\ifcsname\fontclass\fontstyle\s!features \endcsname\csname\fontclass\fontstyle\s!features \endcsname\fi}% + \edef\@@fontclassfallbacks{\ifcsname\fontclass\fontstyle\s!fallbacks\endcsname\csname\fontclass\fontstyle\s!fallbacks\endcsname\fi}} % resolve @@ -762,6 +794,12 @@ \let\fontfile\s!unknown +% \definefontfeature[slanted] [default][slant=.25] +% \definefontfeature[stretched][default][stretch=2] +% +% \start \definedfont[SerifBold*slanted at 20pt] \ruledhbox{Test!} \stop +% \start \definedfont[SerifBold*stretched at 20pt] \ruledhbox{Test!} \stop + % \definefontfeature[default] [liga=yes,texligatures=yes,texquotes=yes] % \definefontfeature[default-caps][liga=yes,texligatures=yes,texquotes=yes,smcp=yes,script=latn] % @@ -878,7 +916,7 @@ % We could use an indirect method ... store in 'array' and refer to % slot. -\def\definefontsynonym[#1]#2[#3]% +\unexpanded\def\definefontsynonym[#1]#2[#3]% {\edef\@@fontname{#1}% \edef\@@fontfile{#3}% \ifx\fontclass\empty @@ -945,19 +983,11 @@ \let\definefontfile\definefontsynonym % dedicated to Taco Hoekwater -\def\setupfontsynonym +\unexpanded\def\setupfontsynonym {\dodoubleempty\dosetupfontsynonym} -\def\dosetupfontsynonym[#1][#2]% - {\edef\@@fontdata{#2}% - \ifx\@@fontdata\empty \else - \edef\@@fontfile{#1}% - \ifx\fontclass\empty - \getfontparameters - \else - \getglobalfontparameters - \fi - \fi} +\def\dosetupfontsynonym[#1][#2]% not yet supported, will do when needed + {} \def\truefontname#1% {\@EA\dotruefontname#1*\empty*\relax} @@ -1026,7 +1056,7 @@ % % \setupbodyfont[palatino] -\def\startfontclass +\unexpanded\def\startfontclass {\dosingleempty\dostartfontclass} \def\dostartfontclass[#1]% @@ -1035,7 +1065,7 @@ {\let\fontclass\empty} {\doifsomething{#1}{\def\fontclass{#1}}}} -\def\stopfontclass +\unexpanded\def\stopfontclass {\popmacro\fontclass} %D \macros @@ -1065,14 +1095,14 @@ %D %D The implementation looks as follows: -\def\definefont +\unexpanded\def\definefont {\dotripleempty\dodefinefont} \def\dodefinefont[#1][#2][#3]% [name][spec][1.6 | line=10pt | setup_id] {\ifthirdargument - \unexpanded\setvalue{#1}{\redodefinefont{#1}{#2}{#3}}% + \setuvalue{#1}{\redodefinefont{#1}{#2}{#3}}% \else - \unexpanded\setvalue{#1}{\dododefinefont{#1}{#2}}% + \setuvalue{#1}{\dododefinefont{#1}{#2}}% \fi} \def\redodefinefont#1#2#3% @@ -1082,7 +1112,7 @@ {\setuplocalinterlinespace[#3]% \setupspacing}} % needed ? -\def\definefrozenfont +\unexpanded\def\definefrozenfont {\dotripleempty\dodefinefrozenfont} \def\dodefinefrozenfont[#1][#2][#3]% @@ -1109,7 +1139,6 @@ \let\localrelativefontsize\defaultrelativefontsize \let\localabsolutefontsize\fontbody \lowleveldefinefont{#2}\rawfontidentifier -% \let\localrelativefontsize\defaultrelativefontsize % not needed \csname\rawfontidentifier\endcsname \autofontsizefalse \setfontcharacteristics @@ -1122,7 +1151,6 @@ \def\localrelativefontsize{#1}% \def\localabsolutefontsize{#2}% \lowleveldefinefont{#4}\newfontidentifier -% \let\localrelativefontsize\defaultrelativefontsize % not needed \fi \csname\newfontidentifier\endcsname \autofontsizefalse @@ -1198,11 +1226,11 @@ \processcommacommand[\fontalternativelist]\dodocommand}% \processcommacommand[\fontsizelist]\docommand} -\def\definefontsize[#1]% sneller met toks +\unexpanded\def\definefontsize[#1]% sneller met toks {\addtocommalist{#1}\fontsizelist \checkfontnamecombinations} -\def\definefontalternative[#1]% +\unexpanded\def\definefontalternative[#1]% {\addtocommalist{#1}\fontalternativelist \checkfontnamecombinations} @@ -1292,7 +1320,11 @@ %D have a similar meaning, and therefore can lead to an %D unwanted loop, we temporary redefine \type{\c!text}. For %D the moment this in only place that some trickery is needed -%D to fool the multilingual interface. +%D to fool the multilingual interface. However, long ago +%D we decided to stick to \s!text in definitions as it closely +%D relates to the math model where text, script and scriptscript +%D are used untranslated. Also, we are now english at the low +%D level so it cannot go wrong anymore. %D %D When instead of a size the keyword \type{unknown} is %D passed, fractions (relations) are used instead of fixed @@ -1320,7 +1352,7 @@ \let\k!text \k!savedtext \fi} -\def\definebodyfontenvironment +\unexpanded\def\definebodyfontenvironment {\dotripleempty\dodefinebodyfontenvironment} \def\dodefinebodyfontenvironment[#1][#2][#3]% class size settings @@ -1348,12 +1380,9 @@ % we test for em as we assume it to be set \else \def\docommand##1% -% fails: \def\checkbodyfontenvironment[#1]{! #1 ! \definebodyfontenvironment[\fontclass][#1][]} \setupbodyfont[8.5pt] -% {\normalizebodyfontsize\csname\??ft\s!default##1\endcsname\dimexpr#1\relax\to\tempbodyfontsize -% \letvalue{\??ft#2#1##1}\tempbodyfontsize}% - {\scratchdimen\csname\??ft\s!default##1\endcsname\dimexpr#1\relax - \normalizebodyfontsize\scratchdimen\to\tempbodyfontsize - \letvalue{\??ft#2#1##1}\tempbodyfontsize}% + {\scratchdimen\csname\??ft\s!default##1\endcsname\dimexpr#1\relax + \normalizebodyfontsize\scratchdimen\to\tempbodyfontsize + \letvalue{\??ft#2#1##1}\tempbodyfontsize}% \processcommacommand[\fontrelativesizelist]\docommand \copyparameters [\??ft#2#1][\??ft\s!default] @@ -1369,7 +1398,10 @@ \else % prevent loop (hence \empty) \letvalue{\@size@#1}\empty + \pushmacro\fontclass % new per 26102009 + \edef\fontclass{#2}% % new per 26102009 \defineunknownfont{#1}% + \popmacro\fontclass % new per 26102009 \fi\fi % so far \setvalue{\@size@#1}{\docompletefontswitch[#1]}} @@ -1406,7 +1438,7 @@ % this one already catches both define/setup -\def\setupbodyfontenvironment{\definebodyfontenvironment} +\let\setupbodyfontenvironment\definebodyfontenvironment %D Just a couple of interface macros: @@ -1499,7 +1531,7 @@ %D user definitions like \type{\tfw} or \type{\bfq} for real %D large alternatives. -\def\definebodyfont +\unexpanded\def\definebodyfont {\doquadrupleempty\redefinebodyfont} \def\redefinebodyfont[#1][#2][#3][#4]% @@ -1580,30 +1612,30 @@ \def\dodefinebodyfontnopxx#1#2[#3#4#5=#6]% style body def {\ifcsname#1#3#4#5\endcsname\else\checkbodyfont{#1}{#3#4}{#5}\fi% not \definefontsize[#5] \@EA\let\csname*#2#1#3#4#5*\endcsname\undefined - \normalprotected\@EA\edef\csname#2#1#3#4#5\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#5}{\normalunexpanded{#6}}}} + \unexpanded\@EA\edef\csname#2#1#3#4#5\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#5}{\normalunexpanded{#6}}}} \def\dodefinebodyfontyesxx#1#2[#3#4#5=#6]% style body def {\ifcsname#1#3#4#5\endcsname\else\checkbodyfont{#1}{#3#4}{#5}\fi% not \definefontsize[#5] \fcglobal\@EA\let\csname*\fontclass#2#1#3#4#5*\endcsname\undefined - \normalprotected\@EA\fcxdef\csname\fontclass#2#1#3#4#5\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#5}{\normalunexpanded{#6}}}} + \unexpanded\@EA\fcxdef\csname\fontclass#2#1#3#4#5\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#5}{\normalunexpanded{#6}}}} \def\dodefinebodyfontnopmm#1#2[#3#4#5=#6]% style body def {\ifcsname#1#3#4#5\endcsname\else\checkbodyfont{#1}{#3#4}{#5}\fi% not \definefontsize[#5] \@EA\let\csname*#2#1#3#4#51*\endcsname\undefined \@EA\let\csname*#2#1#3#4#52*\endcsname\undefined \@EA\let\csname*#2#1#3#4#53*\endcsname\undefined - \normalprotected\@EA\edef\csname#2#1#3#4#51\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#51}{\normalunexpanded{#6}}}% - \normalprotected\@EA\edef\csname#2#1#3#4#52\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#52}{\normalunexpanded{#6}}}% - \normalprotected\@EA\edef\csname#2#1#3#4#53\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#53}{\normalunexpanded{#6}}}} + \unexpanded\@EA\edef\csname#2#1#3#4#51\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#51}{\normalunexpanded{#6}}}% + \unexpanded\@EA\edef\csname#2#1#3#4#52\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#52}{\normalunexpanded{#6}}}% + \unexpanded\@EA\edef\csname#2#1#3#4#53\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#53}{\normalunexpanded{#6}}}} \def\dodefinebodyfontyesmm#1#2[#3#4#5=#6]% style body def {\ifcsname#1#3#4#5\endcsname\else\checkbodyfont{#1}{#3#4}{#5}\fi% not \definefontsize[#5] \fcglobal\@EA\let\csname*\fontclass#2#1#3#4#51*\endcsname\undefined \fcglobal\@EA\let\csname*\fontclass#2#1#3#4#52*\endcsname\undefined \fcglobal\@EA\let\csname*\fontclass#2#1#3#4#53*\endcsname\undefined - \normalprotected\@EA\fcxdef\csname\fontclass#2#1#3#4#51\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#51}{\normalunexpanded{#6}}}% - \normalprotected\@EA\fcxdef\csname\fontclass#2#1#3#4#52\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#52}{\normalunexpanded{#6}}}% - \normalprotected\@EA\fcxdef\csname\fontclass#2#1#3#4#53\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#53}{\normalunexpanded{#6}}}} + \unexpanded\@EA\fcxdef\csname\fontclass#2#1#3#4#51\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#51}{\normalunexpanded{#6}}}% + \unexpanded\@EA\fcxdef\csname\fontclass#2#1#3#4#52\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#52}{\normalunexpanded{#6}}}% + \unexpanded\@EA\fcxdef\csname\fontclass#2#1#3#4#53\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#53}{\normalunexpanded{#6}}}} \def\checkbodyfont#1% tests for ttsl mmbf {\edef\c!!mm{#1}% @@ -1618,21 +1650,21 @@ \def\checkmathbodyfont#1#2#3% style alt size / gdef % #3 can be empty {%\message{!m #1 #2 #3!}% % #1 #2 #3 = signal - %unexpanded\setgvalue {#2}{\setcurrentfontalternative {#2}}% \mr \mb - \unexpanded\setgvalue {#1}{\setcurrentfontstyle {#1}}}% \mm + %setugvalue {#2}{\setcurrentfontalternative {#2}}% \mr \mb + \setugvalue {#1}{\setcurrentfontstyle {#1}}}% \mm \def\checktextbodyfont#1#2#3% style alt size / gdef % #3 can be empty {%\message{!t #1 #2 #3!}% - \unexpanded\setgvalue {#1#3}{\setcurrentfontstylesize {#1}{#3}}% \rma - \unexpanded\setgvalue {#2#3}{\setcurrentfontalternativesize {#2}{#3}}% \sla - \unexpanded\setgvalue {#1#2#3}{\setcurrentfontstylealternativesize{#1}{#2}{#3}}% \rmsla - \unexpanded\setgvalue {#1}{\setcurrentfontstyle {#1}}% \rm - \unexpanded\setgvalue {#2}{\setcurrentfontalternative {#2}}% \sl - \unexpanded\setgvalue {#1\c!x}{\setcurrentfontxstylealternative {#1}}% \rmx - \unexpanded\setgvalue{#1\c!xx}{\setcurrentfontxxstylealternative {#1}}% \rmxx - \unexpanded\setgvalue {#2\c!x}{\setcurrentfontxalternative {#2}}% \slx - \unexpanded\setgvalue{#2\c!xx}{\setcurrentfontxxalternative {#2}}% \slxx - \unexpanded\setgvalue {#1#2}{\setcurrentfontstylealternative {#1}{#2}}}% \rmsl + \setugvalue {#1#3}{\setcurrentfontstylesize {#1}{#3}}% \rma + \setugvalue {#2#3}{\setcurrentfontalternativesize {#2}{#3}}% \sla + \setugvalue {#1#2#3}{\setcurrentfontstylealternativesize{#1}{#2}{#3}}% \rmsla + \setugvalue {#1}{\setcurrentfontstyle {#1}}% \rm + \setugvalue {#2}{\setcurrentfontalternative {#2}}% \sl + \setugvalue {#1\c!x}{\setcurrentfontxstylealternative {#1}}% \rmx + \setugvalue{#1\c!xx}{\setcurrentfontxxstylealternative {#1}}% \rmxx + \setugvalue {#2\c!x}{\setcurrentfontxalternative {#2}}% \slx + \setugvalue{#2\c!xx}{\setcurrentfontxxalternative {#2}}% \slxx + \setugvalue {#1#2}{\setcurrentfontstylealternative {#1}{#2}}}% \rmsl \def\dodefinedefaultbodyfont[#1][#2][#3]% sizes styles identifier {\def\dododefinedefaultbodyfont##1% @@ -1673,7 +1705,7 @@ \defineunknownfont{\csname\??ft#1#2\endcsname}% \fi} -\def\defineunknownfont#1% +\unexpanded\def\defineunknownfont#1% {\let\c!savedtext\c!text \let\c!text\s!text \donefalse @@ -1685,7 +1717,7 @@ [\fontstylelist] {\dodefineunknownbodyfont{#1}}% \ifdone - \donefalse + \donefalse \setvalue{\@size@#1}{\docompletefontswitch[#1]}% \ifdefiningunknownfont \else \definingunknownfonttrue @@ -1702,23 +1734,6 @@ %D Fonts are not loaded yet! This means that at format %D generation time, no font files are preloaded. -%D A previous implementation used: -%D -%D \starttyping -%D \type {\setvalue{name}{\donottest...}} -%D \stoptyping -%D -%D instead of the more memory hungry: -%D -%D \starttyping -%D \unexpanded\setvalue{name}{...} -%D \stoptyping -%D -%D The first alternative saves about 500 hash entries (about -%D 2.5\% of the total number of entries used. The second -%D alternative is currently used, because that one can more -%D easily be made \ETEX\ aware. - %D \macros %D {everybodyfont,Everybodyfont,everyglobalbodyfont} %D @@ -1762,15 +1777,6 @@ \newdimen\bodyfontsize \bodyfontsize=\globalbodyfontsize %D \macros -%D {outputresolution} -%D -%D Sometimes (to be honest: not in this module) we need to -%D take the system resolution into account. Therefore we also -%D define a macro: - -\def\outputresolution {600} - -%D \macros %D {bodyfontfactor,bodyfontpoints} %D %D For multiplication purposes we keep an auxiliary counter @@ -1787,34 +1793,24 @@ \chardef\fontdigits=2 % was 1 -\def\normalizebodyfontsize#1\to#2% - {\@EA\@EA\@EA\donormalizedbodyfontsize\@EA\WITHOUTPT\the\dimexpr#1+\ifcase\fontdigits.5\or.05\or.005\fi\points\relax000\to#2} - -\def\donormalizedbodyfontsize#1.#2#3#4#5\to#6% \points ? - {\edef#6% not \ifcase#2\else due to \relax adding - {#1% - \ifcase\fontdigits - \or \ifcase#2 \else .#2\fi % 1 - \or \ifcase#2#3 \else .#2\ifcase#3 \else #3\fi\fi % 2 - \else \ifcase#2#3#4 \else .#2\ifcase#4 \ifcase#3 \else#3\fi \else#3#4\fi\fi % 3 - \fi - \s!pt}} - -% not faster, just less tracing -% -% \def\setfontdigits#1% -% {\chardef\fontdigits\ifnum#1>\plusthree\plusthree\else#1\fi\relax -% \@EA\let\@EA\normalizedbfs\csname normalizedbfs\number\fontdigits\endcsname} -% % \def\normalizebodyfontsize#1\to#2% -% {\@EA\@EA\@EA\normalizedbfs\@EA\WITHOUTPT\the\dimexpr#1+\ifcase\fontdigits.5\or.05\or.005\fi\points\relax000\to#2} -% -% \setvalue{normalizedbfs0}#1.#2\to #3{\edef#3{#1\s!pt}} -% \setvalue{normalizedbfs1}#1.#2#3\to #4{\edef#4{#1\ifcase#2 \else.#2\fi\s!pt}} -% \setvalue{normalizedbfs2}#1.#2#3#4\to #5{\edef#5{#1\ifcase#2#3 \else.#2\ifcase#3 \else#3\fi\fi\s!pt}} -% \setvalue{normalizedbfs3}#1.#2#3#4#5\to#6{\edef#6{#1\ifcase#2#3#4 \else.#2\ifcase#4 \ifcase#3 \else#3\fi\else#3#4\fi\fi\s!pt}} +% {\@EA\@EA\@EA\donormalizedbodyfontsize\@EA\WITHOUTPT\the\dimexpr#1+\ifcase\fontdigits.5\or.05\or.005\fi\points\relax000\to#2} % -% \setfontdigits2 +% \def\donormalizedbodyfontsize#1.#2#3#4#5\to#6% \points ? +% {\edef#6% not \ifcase#2\else due to \relax adding +% {#1% +% \ifcase\fontdigits +% \or \ifcase#2 \else .#2\fi % 1 +% \or \ifcase#2#3 \else .#2\ifcase#3 \else #3\fi\fi % 2 +% \else \ifcase#2#3#4 \else .#2\ifcase#4 \ifcase#3 \else#3\fi \else#3#4\fi\fi % 3 +% \fi +% \s!pt}} + +\def\normalizebodyfontsize#1\to#2% + {\edef#2{\ctxlua{fonts.nbfs(\number\dimexpr#1\relax,\number\fontdigits)}}} + +\def\thenormalizedbodyfontsize#1% + {\ctxlua{fonts.nbfs(\number\dimexpr#1\relax,\number\fontdigits)}} \normalizebodyfontsize\bodyfontsize\to\normalizedglobalbodyfontsize \normalizebodyfontsize\bodyfontsize\to\normalizedlocalbodyfontsize @@ -2069,9 +2065,57 @@ \def\registerfontclass#1% {\letgvalue{\@fontclass@#1}\v!yes} % global ? +\edef\@no@fontclass@{\@fontclass@:?:} + \def\setcurrentfontclass#1% {\ifcsname\@fontclass@#1\endcsname \edef\fontclass{#1}% + \else\ifcsname\@no@fontclass@#1\endcsname + % already tried + \else\ifcase\currentgrouplevel + \trycurrentfontclass{#1}% + \fi\fi\fi} + +\def\savefontclassparameters#1#2#3#4% #1=rm|ss|.. rscale features fallbacks + {\setxvalue{\fontclass#1\s!rscale }{#2}% + \setxvalue{\fontclass#1\s!features }{#3}% + \setxvalue{\fontclass#1\s!fallbacks}{#4}} + +\settrue\autotypescripts + +% \def\trycurrentfontclass#1% +% {\ifconditional\autotypescripts +% \usetypescript[#1]% +% \ifcsname\@fontclass@#1\endcsname +% \edef\fontclass{#1}% +% \else +% \letvalue{\@no@fontclass@#1}\empty +% \fi +% \else +% \letvalue{\@no@fontclass@#1}\empty +% \fi} + +\def\trycurrentfontclass#1% + {\ifconditional\autotypescripts + % try to load typescript #1 + \usetypescript[#1]% + \ifcsname\@fontclass@#1\endcsname + \edef\fontclass{#1}% + \else + % try to load type-#1.mkiv + \usetypescriptfile[\f!typeprefix#1]% + % try to load typescript #1 + \usetypescript[#1]% + \ifcsname\@fontclass@#1\endcsname + \edef\fontclass{#1}% + \else + % todo: message + \letvalue{\@no@fontclass@#1}\empty + \fi + \fi + \else + % todo: message + \letvalue{\@no@fontclass@#1}\empty \fi} \let\defaultfontstyle \c!rm @@ -2211,48 +2255,6 @@ \let\fontstrategy\relax -% \def\synchronizefont -% {\tryingfonttrue -% \ifx\fontclass\empty\else -% \global\let\fontstrategy\dofontclassstrategy -% \the\fontstrategies \relax % \relax still needed ? -% \fi -% \iftryingfont -% \global\let\fontstrategy\dofontstrategy -% \the\fontstrategies \relax % \relax still needed ? -% \fi -% \autofontsizefalse -% \ifskipfontcharacteristics -% \setfontcharacteristics -% \the\everyfontswitch -% \fi} - -% \def\dofontstrategy#1#2#3#4#5% -% {\ifcsname#2#3#4#5\endcsname -% #1\csname#2#3#4#5\endcsname \tryingfontfalse -% \fi} - -% \def\dofontclassstrategy#1#2#3#4#5% -% {\ifcsname\fontclass#2#3#4#5\endcsname -% #1\csname\fontclass#2#3#4#5\endcsname \tryingfontfalse -% \fi} - -% \def\synchronizefont % we can have dups i.e. no need to let fontstrategy -% {\tryingfonttrue -% \ifx\fontclass\empty\else -% \global\let\fontstrategy\dofontclassstrategy -% \applyfontstrategies -% \fi -% \iftryingfont -% \global\let\fontstrategy\dofontstrategy -% \applyfontstrategies -% \fi -% \autofontsizefalse -% \ifskipfontcharacteristics -% \setfontcharacteristics -% \the\everyfontswitch -% \fi} - \def\synchronizefont % we can have dups i.e. no need to let fontstrategy {\tryingfonttrue \ifx\fontclass\empty @@ -2266,69 +2268,6 @@ \the\everyfontswitch \fi} -% \appendtoks \iftryingfont \fontstrategy \autofontsizefalse % --- --- --- --- % pt tt bf a -% \fontbody \fontstyle \fontalternative \fontsize -% \fi \to \fontstrategies -% -% \appendtoks \iftryingfont \fontstrategy \autofontsizetrue % --- --- --- def % pt tt bf -% \fontbody \fontstyle \fontalternative \defaultfontsize -% \fi \to \fontstrategies -% -% \appendtoks \iftryingfont \fontstrategy \autofontsizetrue % --- --- def --- % pt tt tf a -% \fontbody \fontstyle \defaultfontalternative \fontsize -% \fi \to \fontstrategies -% -% \appendtoks \iftryingfont \fontstrategy \autofontsizetrue % --- --- def def % pt tt tf -% \fontbody \fontstyle \defaultfontalternative \defaultfontsize -% \fi \to \fontstrategies -% -% \appendtoks \iftryingfont \fontstrategy \autofontsizefalse % --- def def def % pt rm tf -% \fontbody \defaultfontstyle \defaultfontalternative \defaultfontsize -% \fi \to \fontstrategies -% -% \appendtoks \iftryingfont \fontstrategy \autofontsizetrue % def def def def % rm tf -% \defaultfontbody \defaultfontstyle \defaultfontalternative \defaultfontsize -% \fi \to \fontstrategies - -% \def\fontstrategiesa % --- --- --- --- % pt tt bf a -% {\fontstrategy \autofontsizefalse \fontbody \fontstyle \fontalternative \fontsize -% \iftryingfont \fontstrategiesb \fi} -% \def\fontstrategiesb % --- --- --- def % pt tt bf -% {\fontstrategy \autofontsizetrue \fontbody \fontstyle \fontalternative \defaultfontsize -% \iftryingfont \fontstrategiesc \fi} -% \def\fontstrategiesc % --- --- def --- % pt tt tf a -% {\fontstrategy \autofontsizetrue \fontbody \fontstyle \defaultfontalternative \fontsize -% \iftryingfont \fontstrategiesd \fi} -% \def\fontstrategiesd % --- --- def def % pt tt tf -% {\fontstrategy \autofontsizetrue \fontbody \fontstyle \defaultfontalternative \defaultfontsize -% \iftryingfont \fontstrategiese \fi} -% \def\fontstrategiese % --- def def def % pt rm tf -% {\fontstrategy \autofontsizefalse \fontbody \defaultfontstyle \defaultfontalternative \defaultfontsize -% \iftryingfont \fontstrategiesf \fi} -% \def\fontstrategiesf % def def def def % rm tf -% {\fontstrategy \autofontsizetrue \defaultfontbody \defaultfontstyle \defaultfontalternative \defaultfontsize} - -% \fontstrategies {\fontstrategiesa} -% \let\applyfontstrategies\fontstrategiesa - -% \def\fontclassstrategiesa % --- --- --- --- % pt tt bf a -% {\dofontclassstrategy \autofontsizefalse \fontbody \fontstyle \fontalternative \fontsize -% \iftryingfont \fontclassstrategiesb \fi} -% \def\fontclassstrategiesb % --- --- --- def % pt tt bf -% {\dofontclassstrategy \autofontsizetrue \fontbody \fontstyle \fontalternative \defaultfontsize -% \iftryingfont \fontclassstrategiesc \fi} -% \def\fontclassstrategiesc % --- --- def --- % pt tt tf a -% {\dofontclassstrategy \autofontsizetrue \fontbody \fontstyle \defaultfontalternative \fontsize -% \iftryingfont \fontclassstrategiesd \fi} -% \def\fontclassstrategiesd % --- --- def def % pt tt tf -% {\dofontclassstrategy \autofontsizetrue \fontbody \fontstyle \defaultfontalternative \defaultfontsize -% \iftryingfont \fontclassstrategiese \fi} -% \def\fontclassstrategiese % --- def def def % pt rm tf -% {\dofontclassstrategy \autofontsizefalse \fontbody \defaultfontstyle \defaultfontalternative \defaultfontsize -% \iftryingfont \fontclassstrategiesf \fi} -% \def\fontclassstrategiesf % def def def def % rm tf -% {\dofontclassstrategy \autofontsizetrue \defaultfontbody \defaultfontstyle \defaultfontalternative \defaultfontsize} - \def\fontclassstrategiesa % --- --- --- --- % pt tt bf a {\ifcsname\fontclass\fontbody \fontstyle \fontalternative \fontsize\endcsname \autofontsizefalse @@ -2379,24 +2318,6 @@ % no class -% \def\fontstrategiesa % --- --- --- --- % pt tt bf a -% {\dofontstrategy \autofontsizefalse \fontbody \fontstyle \fontalternative \fontsize -% \iftryingfont \fontstrategiesb \fi} -% \def\fontstrategiesb % --- --- --- def % pt tt bf -% {\dofontstrategy \autofontsizetrue \fontbody \fontstyle \fontalternative \defaultfontsize -% \iftryingfont \fontstrategiesc \fi} -% \def\fontstrategiesc % --- --- def --- % pt tt tf a -% {\dofontstrategy \autofontsizetrue \fontbody \fontstyle \defaultfontalternative \fontsize -% \iftryingfont \fontstrategiesd \fi} -% \def\fontstrategiesd % --- --- def def % pt tt tf -% {\dofontstrategy \autofontsizetrue \fontbody \fontstyle \defaultfontalternative \defaultfontsize -% \iftryingfont \fontstrategiese \fi} -% \def\fontstrategiese % --- def def def % pt rm tf -% {\dofontstrategy \autofontsizefalse \fontbody \defaultfontstyle \defaultfontalternative \defaultfontsize -% \iftryingfont \fontstrategiesf \fi} -% \def\fontstrategiesf % def def def def % rm tf -% {\dofontstrategy \autofontsizetrue \defaultfontbody \defaultfontstyle \defaultfontalternative \defaultfontsize} - \def\fontstrategiesa % --- --- --- --- % pt tt bf a {\ifcsname\fontbody \fontstyle \fontalternative \fontsize\endcsname \autofontsizefalse @@ -2562,7 +2483,7 @@ \setvalue{\@style@##1}{\csname#2\endcsname}}% \processcommalist[#1]\docommand} -\def\definefontstyle +\unexpanded\def\definefontstyle {\dodoubleargument\dodefinefontstyle} \def\setfontstyle#1#2% #1:name (roman, romaan) #2:style (rm) @@ -2570,29 +2491,6 @@ \checkfontnamecombinations \setcurrentfontstyle\normalizedbodyfontsize} -%D The previous macros show that it's is not always -%D neccessary to define the whole bunch of fonts, take for -%D instance the sequence: -%D -%D \starttyping -%D \setupbodyfont -%D [ams] -%D -%D \definebodyfont [24pt] [mm] -%D [ma=msam10 at 24pt, -%D mb=msbm10 at 24pt] -%D -%D \switchtobodyfont -%D [24pt] -%D -%D This is a 24pt $\blacktriangleleft$ -%D \stoptyping -%D -%D Here we didn't define the 24 point bodyfont environment, so -%D it's defined automatically. Of course one can always use the -%D \TEX\ primitive \type{\font} to switch to whatever font -%D needed. - %D When asking for a complete font switch, for instance from 10 %D to 12~points, the next macro does the job. First we %D normalize the size, next we define the current range of @@ -2623,7 +2521,7 @@ %D and/or options defined in files, for example: %D %D \starttyping -%D \setupbodyfont[cmr,ams,12pt,roman] +%D \setupbodyfont[modern,12pt,roman] %D \stoptyping %D %D This command affects the document as a whole: text, headers @@ -2644,6 +2542,9 @@ \ifx\saveinterlinespace \undefined \let\saveinterlinespace \relax \fi \ifx\restoreinterlinespace\undefined \let\restoreinterlinespace\relax \fi +% \newtoks \everysetupbodyfont +% \newtoks \everyswitchtobodyfont + \chardef\bodyfontsetstate=0 \definecomplexorsimple\setupbodyfont @@ -2662,7 +2563,8 @@ \the\everybodyfont \the\everyglobalbodyfont \saveinterlinespace - \fi}} + \fi + \the\everysetupbodyfont}} \unexpanded\def\switchtobodyfont[#1]% {\doifsomething{#1} @@ -2671,7 +2573,8 @@ \else \dosetfont0{#1}% \fi - \the\everybodyfont}} % indeed needed in case nothing is executed + \the\everybodyfont + \the\everyswitchtobodyfont}} %D The following alternative is meant for math||to||text %D switching and will be optimized. @@ -2709,27 +2612,32 @@ %D Experimental: -\def\definefontfeature +\unexpanded\def\definefontfeature {\dotripleargument\dodefinefontfeature} \def\dodefinefontfeature[#1][#2][#3]% - {\global\expandafter\chardef\csname\??fq=#1\endcsname - \ctxlua{tex.write(fonts.define.specify.preset_context("#1","#2","#3"))}\relax} + {\global\expandafter\chardef\csname\??fq=#1\endcsname % beware () needed as we get two values returned + \ctxlua{tex.write((fonts.define.specify.preset_context("#1","#2","#3")))}\relax} \definefontfeature [default] - [%mode=node,% + [%mode=node, liga=yes,kern=yes,tlig=yes,trep=yes] % texligatures=yes,texquotes=yes \definefontfeature [smallcaps] - [%mode=node,% - liga=yes,kern=yes,tlig=yes,trep=yes,smcp=yes] % texligatures=yes,texquotes=yes + [%mode=node,liga=yes, + smcp=yes,kern=yes,tlig=yes,trep=yes] % texligatures=yes,texquotes=yes \definefontfeature [oldstyle] - [%mode=node,% - liga=yes,kern=yes,tlig=yes,trep=yes,onum=yes] % texligatures=yes,texquotes=yes + [%mode=node, + onum=yes,liga=yes,kern=yes,tlig=yes,trep=yes] % texligatures=yes,texquotes=yes + +\definefontfeature % == default unless redefined + [ligatures] + [%mode=node, + liga=yes,kern=yes,tlig=yes,trep=yes] \definefontfeature % can be used for type1 fonts [complete] @@ -2744,7 +2652,7 @@ \definefontfeature [none] - [mode=none,features=off] + [mode=none,features=no] \definefontfeature [virtualmath] @@ -2764,11 +2672,12 @@ % \definefontfeature[mathscript] [math-script] % \definefontfeature[mathscriptscript] [math-scriptscript] -%D Also new: +%D Also new, handy for manuals: -% handy for manuals +\unexpanded\def\fontchar#1{\ctxlua{fonts.char("#1")}} -\def\otfchar#1{\ctxlua{fonts.otf.char("#1")}} +\let\otfchar\fontchar % will disappear, for compatibility only +\let\afmchar\fontchar % will disappear, for compatibility only %D: We cannot yet inherit because no colors are predefined. @@ -2818,10 +2727,10 @@ \def\setfontfeature #1{\edef\currentfeature{#1}\attribute\zerocount\featureattribute{#1}\relax} \def\resetfontfeature#1{\let\currentfeature\empty\attribute\zerocount\zerocount} % initial value -\def\addfontfeaturetoset #1{\ctxlua{fonts.withset("#1", 1)}} -\def\subtractfontfeaturefromset #1{\ctxlua{fonts.withset("#1",-1)}} -\def\addfontfeaturetofont #1{\ctxlua{fonts.withfnt("#1", 2)}} -\def\subtractfontfeaturefromfont#1{\ctxlua{fonts.withfnt("#1",-2)}} +\def\addfontfeaturetoset #1{\ctxlua{fonts.withset("#1", 1)}} % merge +\def\subtractfontfeaturefromset #1{\ctxlua{fonts.withset("#1",-1)}} % merge +\def\addfontfeaturetofont #1{\ctxlua{fonts.withfnt("#1", 2)}} % overload +\def\subtractfontfeaturefromfont#1{\ctxlua{fonts.withfnt("#1",-2)}} % overload \let\setff\setfontfeature \let\addfs\addfontfeaturetoset @@ -2832,13 +2741,7 @@ %D The next auxilliary macro is an alternative to \type %D {\fontname}. -% \def\purefontname#1{\expandafter\splitoffpurefontname\fontname#1 \\} -% -% extra level is needed: - -\def\purefontname#1{\@EA\splitoffpurefontname\@EA{\@EA{\@EA\unstringed\fontname#1}} \\} - -\def\splitoffpurefontname#1 #2\\{#1} +\def\purefontname#1{\ctxlua{file.basename("\fontname#1"}} % will be function using id %D \macros %D {switchstyleonly} @@ -2872,9 +2775,9 @@ [mode=node,onum=yes] % \def\sc{\setfontfeature{smallcaps}} -\def\os{\setfontfeature{just-os}} +\unexpanded\def\os{\setfontfeature{just-os}} -%D Code for swithcing to fraktur and script has also been +%D Code for switching to fraktur and script has also been %D changed. We now have an alphabet switcher. \ifx\mathtext\undefined \let\mathtext\hbox \fi @@ -2897,7 +2800,7 @@ {\def\docommand##1{\setvalue{##1}{\switchtobodyfont[#2]}}% \processcommalist[#1]\docommand} -\def\definebodyfontswitch +\unexpanded\def\definebodyfontswitch {\dodoubleargument\dodefinebodyfontswitch} %D \macros @@ -2955,6 +2858,8 @@ \chardef\currentxfontsize\zerocount \redoconvertfont \tf + \the\everybodyfont % indeed needed + \the\everyglobalbodyfont % indeed needed \saveinterlinespace} \def\restoreglobalbodyfont % ook style etc @@ -3036,15 +2941,15 @@ \def\dodefinealternativestyle[#1][#2][#3]% {\def\docommand##1% - {\ifcsname##1\endcsname\else\setvalue{##1}{\groupedcommand{#2}{}}\fi + {\ifcsname##1\endcsname\else\setuvalue{##1}{\groupedcommand{#2}{}}\fi \setvalue{\@letter@ ##1}{#2}% \setvalue{\@noletter@##1}{#3}}% \processcommalist[#1]\docommand} -\def\definealternativestyle +\unexpanded\def\definealternativestyle {\dotripleempty\dodefinealternativestyle} -\def\definestyle{\definealternativestyle} +\unexpanded\def\definestyle{\definealternativestyle} %D Maybe too geneneric, but probably ok is the following. (Maybe one %D day we will use a dedicated grouped command for styles.) @@ -3169,19 +3074,6 @@ %D or even better: -% \def\doemphasistypeface#1#2% slow -% {\doifelsevalue{\??ft\fontclass\normalizedbodyfontsize\c!em}\v!slanted -% {#1}% -% {\doifelsevalue{\??ft\fontclass\normalizedbodyfontsize\c!em}\v!italic -% {#2}% -% {\doifelsevaluenothing{\??ft\fontclass\normalizedbodyfontsize\c!em} -% {\doifelsevalue{\??ft\normalizedbodyfontsize\c!em}\v!slanted -% {#1}% -% {\doifelsevalue{\??ft\normalizedbodyfontsize\c!em}\v!italic -% {#2}% -% {\getvalue{\??ft\normalizedbodyfontsize\c!em}}}} -% {\getvalue{\??ft\fontclass\normalizedbodyfontsize\c!em}}}}} - \def\doemphasistypeface#1#2% {\edef\emphasizedtypeface{\csname\??ft\fontclass\normalizedbodyfontsize\c!em\endcsname}% \ifx\emphasizedtypeface\v!slanted @@ -3248,7 +3140,7 @@ %D takes care of \type {\em \bf ...} sitiations. \def\setemphasisboldface - {\let\normalbf\bf + {\let\savedemphasisboldface\bf \let\setemphasisboldface\relax \unexpanded\def\bf {%\relax @@ -3258,9 +3150,9 @@ \else\ifx\fontalternative\c!sl \bs \else - \normalbf + \savedemphasisboldface \fi\fi - \let\bf\normalbf}} + \let\bf\savedemphasisboldface}} %D Donald's (adapted) macros take the next character into %D account when placing italic correction. As a bonus we also @@ -3274,18 +3166,6 @@ \expandafter\emphasislook \fi} -% \def\emphasislook -% {\begingroup -% \beginrobusttest -% \futurelet\next\emphasistest} - -% \def\emphasistest -% {\normalifcat\noexpand\next,% -% \endrobusttest\expandafter\doemphasiscorrection -% \normalelse -% \endrobusttest\expandafter\dododoemphasiscorrection -% \normalfi} - \def\emphasislook {\begingroup \futurelet\next\emphasistest} @@ -3377,7 +3257,7 @@ %D some typing: \def\setfont% geen \dosetfont mogelijk - {\def\next{\nextfont\setupinterlinespace}% + {\def\next{\nextfont\setupinterlinespace}% hm, we need to use \setuplocalinterlinespace \afterassignment\next\font\nextfont=} %D One can call this macro as: @@ -3404,7 +3284,7 @@ %D The implementation is rather straightforward in using %D \type{\halign}. -\fetchruntimecommand \showbodyfont {\f!fontprefix\s!run.mkii} +\fetchruntimecommand \showbodyfont {\f!fontprefix\s!run.mkiv} %D \macros %D {showfontstrip, testminimalbaseline, showminimalbaseline} @@ -3415,9 +3295,9 @@ %D %D \showfontstrip \blank \showminimalbaseline -\fetchruntimecommand \showfontstrip {\f!fontprefix\s!run.mkii} -\fetchruntimecommand \testminimalbaseline {\f!fontprefix\s!run.mkii} -\fetchruntimecommand \showminimalbaseline {\f!fontprefix\s!run.mkii} +\fetchruntimecommand \showfontstrip {\f!fontprefix\s!run.mkiv} +\fetchruntimecommand \testminimalbaseline {\f!fontprefix\s!run.mkiv} +\fetchruntimecommand \showminimalbaseline {\f!fontprefix\s!run.mkiv} %D \macros %D {showkerning} @@ -3426,7 +3306,7 @@ %D %D \showkerning{Can you guess what kerning is?} -\fetchruntimecommand \showkerning {\f!fontprefix\s!run.mkii} +\fetchruntimecommand \showkerning {\f!fontprefix\s!run.mkiv} %D \macros %D {showbodyfontenvironment} @@ -3439,7 +3319,7 @@ %D %D \showsetup{showbodyfontenvironment} -\fetchruntimecommand \showbodyfontenvironment {\f!fontprefix\s!run.mkii} +\fetchruntimecommand \showbodyfontenvironment {\f!fontprefix\s!run.mkiv} %D \macros %D {showfont,showfontstyle,showligatures} @@ -3455,11 +3335,11 @@ % to be internationalized -\fetchruntimecommand \showfont {\f!fontprefix\s!run.mkii} -\fetchruntimecommand \showfontstyle {\f!fontprefix\s!run.mkii} -\fetchruntimecommand \showligature {\f!fontprefix\s!run.mkii} -\fetchruntimecommand \showligatures {\f!fontprefix\s!run.mkii} -\fetchruntimecommand \showcharratio {\f!fontprefix\s!run.mkii} +\fetchruntimecommand \showfont {\f!fontprefix\s!run.mkiv} +\fetchruntimecommand \showfontstyle {\f!fontprefix\s!run.mkiv} +\fetchruntimecommand \showligature {\f!fontprefix\s!run.mkiv} +\fetchruntimecommand \showligatures {\f!fontprefix\s!run.mkiv} +\fetchruntimecommand \showcharratio {\f!fontprefix\s!run.mkiv} %D \macros %D {getglyph, symbolicfont} @@ -3863,56 +3743,23 @@ %D \macros %D {definefontvariant,fontvariant,variant} %D -%D A slightly adapted version of Adam Lindsays variant patches: -%D -%D \starttyping -%D \usetypescriptfile[type-psc] \loadmapfile[texnansi-public-fpl] -%D \usetypescript[palatino][texnansi] \setupbodyfont[palatino] -%D -%D \definefontvariant [Serif][osf] [OsF] -%D -%D \startlines -%D {\sc abcdefgHIJKlmnop} -%D 123{\Var[osf]456}789 -%D {\Var[osf] 123{\Var[reset]456}789} -%D {\it 123{\Var[osf]456}789 -%D {\Var[osf]123{\Var[reset]456}789}} -%D {\tfb\bf 123{\Var[osf]456}789 -%D {\Var[osf] 123{\Var[reset]456}789}} -%D {\sc 123{\Var[osf]456}789 -%D {\Var[osf] 123{\Var[reset]456}789}} -%D \stoplines -%D \stoptyping - -\def\definefontvariant - {\dotripleargument\dodefinefontvariant} +%D This command is obsolete in \MKIV\ as we have features. It might +%D come back using the local features handlers. -\def\dodefinefontvariant[#1][#2][#3]% - {\setvalue{\??fv#1#2}{#3}} +\unexpanded\def\definefontvariant{\dotripleargument\dodefinefontvariant} -\def\fontvariant#1#2{\executeifdefined{\??fv#1#2}\empty} +\def\dodefinefontvariant[#1][#2][#3]{} +\def\variant [#1]{} -\def\dosetscaledfont - {\checkrelativefontsize\fontstyle - \scaledfontsize\currentfontscale\bodyfontsize - \scaledfontsize\relativefontsize\scaledfontsize} - -\unexpanded\def\variant[#1]% slow - {\dosetscaledfont - \normalexpanded{\noexpand\definedfont[\fontstringA\fontstylesuffix\fontvariant\fontstringA{#1} at \the\dimexpr\scaledfontsize\relax]}% - \ignoreimplicitspaces} - -\ifx\Var\undefined \let\Var\variant \fi +\ifdefined\Var\else \let\Var\variant \fi %D By default we load the Computer Modern Roman fonts (but %D not yet at this moment) and activate the 12pt roman %D bodyfont. Sans serif and teletype are also available and -%D can be called for by \type{\ss} and \type{\tt}. - -% \setupbodyfont [unk, rm] -% \setupbodyfont [rm] - -%D Also needed is: +%D can be called for by \type{\ss} and \type{\tt}. Loading +%D takes place elsewhere. +%D +%D For tracing purposes we define: \definefont[tinyfont][Mono at 1ex] @@ -3922,19 +3769,19 @@ % % \setupfonts[check=...] -\def\checkcharactersinfont {\ctxlua{fonts.checkers.enabled=true}} -\def\removemissingcharacters{\ctxlua{fonts.checkers.enabled=true fonts.checkers.delete=true}} +\def\checkcharactersinfont {\ctxlua{fonts.checkers.enable()}} +\def\removemissingcharacters{\ctxlua{fonts.checkers.enable(true)}} %D New commands (not yet interfaced): \def\style[#1]% for inline usage, like \color {\groupedcommand{\ifcsname#1\endcsname\csname#1\endcsname\else\definedfont[#1]\fi}{}} -\def\startstyle[#1]% +\unexpanded\def\startstyle[#1]% {\begingroup \ifcsname#1\endcsname\csname#1\endcsname\else\definedfont[#1]\fi} -\def\stopstyle +\unexpanded\def\stopstyle {\endgroup} %D Still experimental (might even go away). @@ -3949,21 +3796,19 @@ % {\bf test \mine test \sl test \mine test \bs oeps \mine oeps {\tt test \mine \bf test}} -\definesystemvariable{sx} - -\def\definestylecollection +\unexpanded\def\definestylecollection {\dosingleargument\dodefinestylecollection} \def\dodefinestylecollection[#1]% {\iffirstargument - \unexpanded\setvalue{#1}{\styleinstance[#1]}% + \setuvalue{#1}{\styleinstance[#1]}% \def\docommand##1% {\def\dodocommand####1{\letbeundefined{\??sx##1:####1:\commalistelement}}% \processcommacommand[\fontalternativelist,\s!default]\dodocommand}% \processcommacommand[\fontstylelist,\s!default]\docommand \fi} -\def\definestyleinstance +\unexpanded\def\definestyleinstance {\doquadrupleargument\dodefinestyleinstance} \def\dodefinestyleinstance[#1][#2][#3][#4]% [name] [rm|ss|tt|..] [sl|bf|...] [whatever] @@ -4000,6 +3845,36 @@ % \fi\fi\fi\fi % \endcsname} +%D goodies: + +\def\showchardata#1{\ctxlua{fonts.show_char_data("#1")}} +\def\showfontdata {\ctxlua{fonts.show_font_parameters()}} + +%D some low level helpers +%D +%D \starttyping +%D \def\TestLookup#1% +%D {\dolookupfontbyspec{#1} +%D pattern: #1, found: \dolookupnoffound +%D \blank +%D \dorecurse {\dolookupnoffound} {% +%D \recurselevel:~\dolookupgetkeyofindex{fontname}{\recurselevel}\quad +%D }% +%D \blank} +%D +%D \TestLookup{familyname=helveticaneue} +%D \TestLookup{familyname=helveticaneue,weight=bold} +%D \TestLookup{familyname=helveticaneue,weight=bold,style=italic} +%D \stoptyping + +% we can also move the lookups to the fonts.namespace (of commands) + +\def\dolookupfontbyspec #1{\ctxlua{fonts.names.lookup("#1")}} +\def\dolookupnoffound {\ctxlua{tex.write(fonts.names.noflookups())}} +\def\dolookupgetkeyofindex#1#2{\ctxlua{tex.write(fonts.names.getlookupkey("#1",#2))}} +\def\dolookupgetkey #1{\ctxlua{tex.write(fonts.names.getlookupkey("#1"))}} +\def\cleanfontname #1{\ctxlua{fonts.cleanname("#1")}} + \protect \endinput % \startluacode |