diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/font-ini.tex')
-rw-r--r-- | Master/texmf-dist/tex/context/base/font-ini.tex | 261 |
1 files changed, 201 insertions, 60 deletions
diff --git a/Master/texmf-dist/tex/context/base/font-ini.tex b/Master/texmf-dist/tex/context/base/font-ini.tex index b2007ee3122..8e620309e67 100644 --- a/Master/texmf-dist/tex/context/base/font-ini.tex +++ b/Master/texmf-dist/tex/context/base/font-ini.tex @@ -226,6 +226,21 @@ 14: bodyfont -- is defined (can better be done global) \stopmessages +\startmessages french library: fonts + title: corps de texte + 1: encodage -- + 2: la variante -- est chargée + 3: variante -- inconnue + 4: policecorps -- n'est pas définie + 5: le style -- n'est pas défini + 6: -- est chargé + 7: format -- inconnu + 8: style -- défini +% 9: mapping -- is loaded + 10: fichier de police -- inconnu + 14: policecorps -- est défini (une définition globale pourrait être plus adéquat) +\stopmessages + %D This module is one of the oldest modules of \CONTEXT. The %D macros below evolved out of the \PLAIN\ \TEX\ macros and %D therefore use a similar naming scheme (\type{\rm}, @@ -848,7 +863,7 @@ %D defining it here, we have at least an safeguard for utility %D file reading. -\unexpanded\def\uchar#1#2{[#1,#2]} +\ifx\uchar\undefined \unexpanded\def\uchar#1#2{[#1,#2]} \fi %D We define some (very private) constants to improve speed, %D memory usage and consistency. @@ -1033,21 +1048,21 @@ \def\dodosetmathfamily#1#2% {\@EA\ifx \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname\relax - \@EA\ifx \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \relax - \@EA\ifx \csname\fontclass\fontbody\backfamily\fontsize\endcsname \relax - \@EA\ifx \csname\fontclass\fontbody\backfamily\endcsname \relax + \@EA\ifx \csname\fontclass\fontbody\c!mm\fontfamily \endcsname\relax + \@EA\ifx \csname\fontclass\fontbody \backfamily\fontsize\endcsname\relax + \@EA\ifx \csname\fontclass\fontbody \backfamily \endcsname\relax \@EA\ifx \csname \fontbody\c!mm\fontfamily\fontsize\endcsname\relax - \@EA\ifx \csname \fontbody\c!mm\fontfamily\endcsname \relax - \@EA\ifx \csname \fontbody\backfamily\fontsize\endcsname \relax - \@EA\ifx \csname \fontbody\backfamily\endcsname \relax - \autofontsizetrue \nullfont \else - \autofontsizetrue \csname \fontbody\backfamily\endcsname \fi \else - \autofontsizefalse \csname \fontbody\backfamily\fontsize\endcsname \fi \else - \autofontsizetrue \csname \fontbody\c!mm\fontfamily\endcsname \fi \else + \@EA\ifx \csname \fontbody\c!mm\fontfamily \endcsname\relax + \@EA\ifx \csname \fontbody \backfamily\fontsize\endcsname\relax + \@EA\ifx \csname \fontbody \backfamily \endcsname\relax + \autofontsizetrue \nullfont \else + \autofontsizetrue \csname \fontbody \backfamily \endcsname\fi \else + \autofontsizefalse \csname \fontbody \backfamily\fontsize\endcsname\fi \else + \autofontsizetrue \csname \fontbody\c!mm\fontfamily \endcsname\fi \else \autofontsizefalse \csname \fontbody\c!mm\fontfamily\fontsize\endcsname\fi \else - \autofontsizetrue \csname\fontclass\fontbody\backfamily\endcsname \fi \else - \autofontsizefalse \csname\fontclass\fontbody\backfamily\fontsize\endcsname \fi \else - \autofontsizetrue \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \fi \else + \autofontsizetrue \csname\fontclass\fontbody \backfamily \endcsname\fi \else + \autofontsizefalse \csname\fontclass\fontbody \backfamily\fontsize\endcsname\fi \else + \autofontsizetrue \csname\fontclass\fontbody\c!mm\fontfamily \endcsname\fi \else \autofontsizefalse \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname\fi #1#2\font} @@ -1088,12 +1103,12 @@ \def\dodosetmathfamilyA#1#2% {\ifcsname \fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse \csname \fontbody\c!mm\fontfamily\fontsize\endcsname \else - \ifcsname \fontbody\c!mm\fontfamily\endcsname \autofontsizetrue - \csname \fontbody\c!mm\fontfamily\endcsname \else - \ifcsname \fontbody\backfamily\fontsize\endcsname \autofontsizefalse - \csname \fontbody\backfamily\fontsize\endcsname \else - \ifcsname \fontbody\backfamily\endcsname \autofontsizetrue - \csname \fontbody\backfamily\endcsname \else + \ifcsname \fontbody\c!mm\fontfamily \endcsname \autofontsizetrue + \csname \fontbody\c!mm\fontfamily \endcsname \else + \ifcsname \fontbody \backfamily\fontsize\endcsname \autofontsizefalse + \csname \fontbody \backfamily\fontsize\endcsname \else + \ifcsname \fontbody \backfamily \endcsname \autofontsizetrue + \csname \fontbody \backfamily \endcsname \else \nullfont \autofontsizetrue \fi\fi\fi\fi #1#2\font} @@ -1101,12 +1116,12 @@ \def\dodosetmathfamilyB#1#2% {\ifcsname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \else - \ifcsname\fontclass\fontbody\c!mm\fontfamily\endcsname \autofontsizetrue - \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \else - \ifcsname\fontclass\fontbody\backfamily\fontsize\endcsname \autofontsizefalse - \csname\fontclass\fontbody\backfamily\fontsize\endcsname \else - \ifcsname\fontclass\fontbody\backfamily\endcsname \autofontsizetrue - \csname\fontclass\fontbody\backfamily\endcsname \else + \ifcsname\fontclass\fontbody\c!mm\fontfamily \endcsname \autofontsizetrue + \csname\fontclass\fontbody\c!mm\fontfamily \endcsname \else + \ifcsname\fontclass\fontbody \backfamily\fontsize\endcsname \autofontsizefalse + \csname\fontclass\fontbody \backfamily\fontsize\endcsname \else + \ifcsname\fontclass\fontbody \backfamily \endcsname \autofontsizetrue + \csname\fontclass\fontbody \backfamily \endcsname \else \dodosetmathfamilyA#1#2% \fi\fi\fi\fi #1#2\font} @@ -1260,6 +1275,16 @@ \endETEX +%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} + +%D Scaling macros: + \newdimen\scaledfont \let\somefontspec\empty @@ -1295,6 +1320,81 @@ \def\setforcedfontspec#1 #2\relax]% {\csname\@fs@#1\endcsname#2\relax} +%D For \XETEX\ we need to support a bit more: +%D +%D \starttyping +%D \definedfont[{cmr10} at 40pt] test +%D \definedfont['cmss10' at 40pt] test +%D \definedfont["cmtt10" at 40pt] test +%D +%D \definedfont[{cmr10} at 40pt] test +%D \definedfont['cmss10' at 40pt] test +%D \definedfont["cmtt10" at 40pt] test +%D +%D \definedfont["Gentium" at 40pt] test +%D \stoptyping + +\beginXETEX \font + + % actually, we can use "" in pdftex> 1.20 as well + + \def\parsefontspec#1% + {\xdef\somefontspec{#1\space}% + \@EA\doparsefontspec\somefontspec\relax]% =>#1 \empty] + \donoparsefontspec} + + \def\doparsefontspec#1% + {\ifx"#1% + \@EA\dodqparsefontspec + \else\ifx'#1% + \@EAEAEA\dosqparsefontspec + \else + \@EAEAEA\dodoparsefontspec + \fi\fi#1} + + \def\dqfontquote{"} + \def\sqfontquote{'} + + \def\dodqparsefontspec"#1"#2% + {\def\somefontname{#1}% + \let\somefontquote\dqfontquote + \ifx#2\relax\@EA\setnaturalfontspec\else\@EA\setforcedfontspec\fi#2} + + \def\dosqparsefontspec'#1'#2% + {\def\somefontname{#1}% + \let\somefontquote\sqfontquote + \ifx#2\relax\@EA\setnaturalfontspec\else\@EA\setforcedfontspec\fi#2} + + \def\dodoparsefontspec#1 #2% + {\def\somefontname{#1}% + \let\somefontquote\empty + \ifx\somefontname\empty % space before fontname + \@EA\doparsefontspec + \else\ifx#2\relax + \@EAEAEA\setnaturalfontspec + \else + \@EAEAEA\setforcedfontspec + \fi\fi + #2} + + \def\setnaturalfontspec#1]% + {\@fs@scaled\plusthousand\relax} + + \def\setforcedfontspec#1 #2\relax]% + {\csname\@fs@#1\endcsname#2\relax} + + \def\donoparsefontspec % #1 == \cs + {\edef\fontfile{\somefontquote\truefontname\somefontname\somefontquote}% + \ifx\fontfile\s!unknown \let\fontfile\defaultfontfile \fi + \edef\lastfontname{\fontfile\somefontspec}% + \ifx\fontclass\empty + \expandafter\definefontlocal + \else + \expandafter\definefontglobal + \fi} % #1 == \cs + +\endXETEX + \def\@fs@scaled {\afterassignment\do@fs@scaled\scratchcounter} @@ -1510,6 +1610,9 @@ % % \testfeatureonce{5000}{\definefontsynonym[somefont][somename]} \end + +\def\classfont#1#2{#1#2} % \definefont[whatever][\classfont{xx}{yy} at 10pt] + \def\definefontsynonym[#1]#2[#3]% {\edef\@@fontfile{#3}% \@EA\let\csname\??ff\fontclass#1\endcsname\@@fontfile @@ -1798,6 +1901,14 @@ \def\rawfontidentifier{**\lastfontidentifier\fontsize**} \def\newfontidentifier{*\fontclass\lastfontidentifier\fontsize*} +% best we can add the style as well because otherwise we get math encoding mixups +% +% \setupbodyfont [8pt] [\currentencoding/\ccaron\scaron\zcaron] +% \blank +% \switchtobodyfont[7pt] [\currentencoding/\ccaron\scaron\zcaron] + +\def\newfontidentifier{*\fontclass\lastfontidentifier\fontstyle\fontsize*} + \def\dododefinefont#1#2% {\edef\lastfontidentifier{#1}% \let\localrelativefontsize\defaultrelativefontsize @@ -2712,30 +2823,13 @@ {\ifloadfontfileonce \letvalue{\c!file\f!fontprefix#2}\empty \fi + \makeshortfilename[\truefilename{\f!fontprefix#2}]% \startreadingfile - \readsysfile{\truefilename{\f!fontprefix#2}} - {\showmessage\m!fonts2{#2}} - {\makeshortfilename[\truefilename{\f!fontprefix#2}]% - \readsysfile\shortfilename - {\showmessage\m!fonts2{#2}} - {\showmessage\m!fonts3{#2}}}% + \readsysfile\shortfilename + {\showmessage\m!fonts2{#2}} + {\showmessage\m!fonts3{#2}}% \stopreadingfile}} -% \def\doreadfontdefinitionfile#1#2% #1 = set/switch state -% {\doifundefined{\c!file\f!fontprefix#2}% -% {\ifloadfontfileonce -% \letvalue{\c!file\f!fontprefix#2}\empty -% \fi -% \startreadingfile -% \readsysfile{\truefilename{\f!fontprefix#2}} -% {\showmessage\m!fonts2} -% {\makeshortfilename[\truefilename{\f!fontprefix#2}]% -% \readsysfile\shortfilename -% {\showmessage\m!fonts2} -% {\showmessage\m!fonts3}}% -% {#2}% argument to \showmessage -% \stopreadingfile}} - %D When \type {\loadfontfileoncetrue}, such files are %D only loaded once! This permits redundant loading, but at %D the same time forced grouping when we want continuously mix @@ -2842,8 +2936,8 @@ \fi}% \chardef\currentxfontsize\zerocount} -\def\dodosetfont#1#2% #1 = set/switch state - {\dododosetfont{#1}{#2}{\showmessage\m!fonts4{#2}}} +\def\dodosetfont#1#2% #1 = set/switch state | check fo rempty, else space + {\doifsomething{#2}{\dododosetfont{#1}{#2}{\showmessage\m!fonts4{#2}}}} \def\dododosetfont#1#2#3% #1 = set/switch state {\doifnumberelse{#2} @@ -2852,7 +2946,8 @@ {\edef\fontstep{\bodyfontcsname\normalizedbodyfontsize\interfaced{#2}\endcsname}% \expanded{\dodododosetfont{#1}{\fontstep}}{#3}} {\doifelse{#2}\v!reset - {\let\fontsize\empty} + {\let\fontstyle\empty % new 31/7/2006 + \let\fontsize \empty} {\doifdefinedelse{\@style@#2} {\edef\fontstyle{#2}} {\doreadfontdefinitionfile{#1}{#2}}}}}} @@ -2980,12 +3075,23 @@ \edef\fontbody{#1}% \synchronizefont} +% \def\setcurrentfontstyle#1% +% {%\message{[3 #1]}% +% \edef\fontstyle{#1}% +% \ifmmode\mr\fi % otherwise \rm not downward compatible +% \synchronizefont} +% +% For Taco: optional fall backs: + \def\setcurrentfontstyle#1% {%\message{[3 #1]}% + \checkfontclass{#1}% \edef\fontstyle{#1}% \ifmmode\mr\fi % otherwise \rm not downward compatible \synchronizefont} +\let\checkfontclass\gobbleoneargument % implemented in type-ini + \def\setcurrentfontbodyalternative#1#2% {%\message{[4 #1 #2]}% \edef\fontbody{#1}% @@ -3441,6 +3547,18 @@ \def\dosetmathfont {\def\rm{\fam\mrfam}\dodosetmathfont} +\def\enableencodinginmath + {\appendtoks + \everyhbox{\mr\everyhbox\emptytoks}% + \everyvbox{\mr\everyvbox\emptytoks}% + \to \everymathematics} % was \everymath + +% \enableencodinginmath % too untested to enable by default + +%D \startyping +%D $\cases{& \ccaron}$ $x=\hbox{\ccaron $x=\hbox{\ccaron}$}$ +%D \stoptyping + %D The font specific features are bound to the filename. \def\updatefontparameters @@ -3588,8 +3706,7 @@ %D because \PLAIN\ \TEX\ is english anyway. \def\dodefinebodyfontswitch[#1][#2]% - {\def\docommando##1% - {\setvalue{##1}{\switchtobodyfont[#2]}}% + {\def\docommando##1{\setvalue{##1}{\switchtobodyfont[#2]}}% \processcommalist[#1]\docommando} \def\definebodyfontswitch @@ -3741,6 +3858,13 @@ \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.) + +\appendtoks + \let\groupedcommand\thirdofthreearguments +\to \simplifiedcommands + %D This command also defines the keyword as command. This means %D that the example definition of \type{bold} we gave before, %D results in a command \type{\bold} which can be used as: @@ -4208,15 +4332,30 @@ \let\thedefinedfont\relax -\def\symbolicscaledfont#1#2% - {\scaledfont\fontbody - \scaledfont#1\scaledfont - \font\thedefinedfont\truefontname{\glyphfontfile{#2}} at +% \def\symbolicscaledfont#1#2% +% {\scaledfont\fontbody +% \scaledfont#1\scaledfont +% \font\thedefinedfont\truefontname{\glyphfontfile{#2}} at +% \currentfontbodyscale\scaledfont +% \thedefinedfont} +% +% \unexpanded\def\symbolicfont +% {\symbolicscaledfont\plusone} +% +% even more control (needed for mthsqrt etc) + +\def\symbolicsizedfont#1#2#3% + {\scaledfont#1% + \scaledfont#2\scaledfont + \font\thedefinedfont\truefontname{\glyphfontfile{#3}} at \currentfontbodyscale\scaledfont \thedefinedfont} +\def\symbolicscaledfont + {\symbolicsizedfont\fontbody} + \unexpanded\def\symbolicfont - {\symbolicscaledfont\plusone} + {\symbolicsizedfont\fontbody\plusone} \unexpanded\def\getglyph#1#2% slow, faster, much faster %{{\definefont[\s!dummy][\glyphfontfile{#1} sa \currentfontscale]\dummy#2}} @@ -4570,6 +4709,7 @@ \definealternativestyle [\v!normal] [\tf] [] \definealternativestyle [\v!bold] [\bf] [] \definealternativestyle [\v!type] [\tt] [] +\definealternativestyle [\v!mono] [\tt] [] \definealternativestyle [\v!slanted] [\sl] [] \definealternativestyle [\v!italic] [\it] [] \definealternativestyle [\v!boldslanted,\v!slantedbold] [\bs] [] @@ -4698,15 +4838,16 @@ \scaledfont\currentfontscale\bodyfontsize \scaledfont\relativefontsize\scaledfont} -\def\variant[#1]% slow +\unexpanded\def\variant[#1]% slow {\dosetscaledfont \expanded{\definedfont [\truefontname{\fontstringA\fontstylesuffix\fontvariant\fontstringA{#1}} - at \scaledfont]}} + at \scaledfont]}% + \ignoreimplicitspaces} \beginXETEX \font - \def\variant[#1]% + \unexpanded\def\variant[#1]% {\dosetscaledfont \font\variantfont\truefontname{\fontstringA\fontstylesuffix\fontvariant\fontstringA{#1}} at \scaledfont |