summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/font-ini.mkvi
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/font-ini.mkvi')
-rw-r--r--Master/texmf-dist/tex/context/base/font-ini.mkvi135
1 files changed, 126 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/context/base/font-ini.mkvi b/Master/texmf-dist/tex/context/base/font-ini.mkvi
index 5f7aaa92f52..c1e6d939055 100644
--- a/Master/texmf-dist/tex/context/base/font-ini.mkvi
+++ b/Master/texmf-dist/tex/context/base/font-ini.mkvi
@@ -363,7 +363,7 @@
\let\thedefinedfont\relax % not to be confused with \everydefinefont
\unexpanded\def\definedfont
- {\doifnextoptionalelse\font_basics_defined_font_yes\font_basics_defined_font_nop}
+ {\doifnextoptionalcselse\font_basics_defined_font_yes\font_basics_defined_font_nop}
\def\font_basics_defined_font_yes[#specification]%
{\c_font_feature_inheritance_mode\c_font_feature_inheritance_fontonly
@@ -700,6 +700,7 @@
\let\somefontsize\zerocount
\newcount\scaledfontmode % also used at the lua end
+\newcount\scaledfontsize % also used at the lua end
\newcount\lastfontid % also used at the lua end / tex end
\newtoks \everydefinefont
@@ -755,6 +756,9 @@
\or
% scaled, don't use this one as it's unpredictable
\d_font_scaled_font_size-\somefontsize\scaledpoint
+ \else % ht cp
+ % experiment, yet undocumented
+ \d_font_scaled_font_size\somefontsize
\fi
\relax
\d_font_scaled_font_size\v_font_size_relative\d_font_scaled_font_size
@@ -770,7 +774,7 @@
\else
\d_font_scaled_text_face\textface
\fi
- \edef\somefontspec{at \number\d_font_scaled_font_size sp}%
+ \edef\somefontspec{at \number\d_font_scaled_font_size sp}% probably no longer used, needs checking
\edef\somefontfile{\truefontname\somefontname}%
\ifx\somefontfile\s!unknown
\edef\somefontfile{\defaultfontfile}%
@@ -797,9 +801,10 @@
"\m_font_class_goodies", % experiment (not yet used)
"\m_font_goodies",
"\m_font_class_designsize",
- "\m_font_designsize"
+ "\m_font_designsize",
+ \number\scaledfontmode
)}%
- \edef\somefontspec{at \number\d_font_scaled_font_size sp}% we need the resolved designsize (for fallbacks)
+ \edef\somefontspec{at \number\scaledfontsize sp}% we need the resolved designsize (for fallbacks)
\expandafter\let\expandafter\lastrawfontcall\csname#csname\endcsname
\the\everydefinefont
\c_font_feature_inheritance_mode\c_font_feature_inheritance_default}
@@ -1519,7 +1524,7 @@
\unexpanded\def\font_basics_define_body_font_name_identifier_a#name#identifier#style%
{%\writestatus\m!fonts{[#name:#style] => [##identifier:#style]}%
- \ifcsname\csname\??fontdefinitions#name:#style\endcsname
+ \ifcsname\??fontdefinitions#name:#style\endcsname
\expandafter\let\csname\??fontdefinitions#name:#style\expandafter\endcsname\csname\??fontdefinitions#identifier:#style\endcsname
\else
\expandafter\def\csname\??fontdefinitions#name:#style\endcsname{\csname\??fontdefinitions#identifier:#style\endcsname}%
@@ -1674,7 +1679,7 @@
\unexpanded\def\font_helpers_set_font_set_font_option_body#method#body#message%
{\normalizebodyfontsize\normalizedsetfont{#body}% redundant for some calls
\ifcsname\??fontbodyknown\normalizedsetfont\endcsname \else
- \font_helpers_define_unknown_font{#body}%
+ \font_helpers_define_unknown_font\normalizedsetfont
\fi
\ifcsname\??fontbodyknown\normalizedsetfont\endcsname
\localbodyfontsize\normalizedsetfont
@@ -1708,6 +1713,7 @@
\let\defaultfontstyle \s!rm
\let\defaultfontalternative\s!tf
\let\defaultfontsize \empty
+\let\defaultfontface \!!zerocount
%D So far for synchronisation. (We can inline the following macros.)
@@ -2076,7 +2082,7 @@
% \newtoks \everyswitchtobodyfont
\unexpanded\def\setupbodyfont
- {\doifnextoptionalelse\font_basics_setupbodyfont_yes\font_basics_setupbodyfont_nop}
+ {\doifnextoptionalcselse\font_basics_setupbodyfont_yes\font_basics_setupbodyfont_nop}
\def\font_basics_setupbodyfont_nop
{\restoreglobalbodyfont
@@ -2130,6 +2136,37 @@
%D $\cases{& \ccaron}$ $x=\hbox{\ccaron $x=\hbox{\ccaron}$}$
%D \stoptyping
+%D \macros
+%D {usebodyfont}
+%D
+%D This looks nicer then a switch in the preamble
+%D
+%D \starttyping
+%D \usebodyfont[pagella,10pt]
+%D \usebodyfont[termes,10pt]
+%D \usebodyfont[dejavu,10pt]
+%D
+%D \setupbodyfont[dejavu]
+%D
+%D \starttext
+%D test
+%D \stoptext
+%D \stoptyping
+
+% \unexpanded\def\usebodyfont[#1]%
+% {\pushmacro\fontclass
+% \switchtobodyfont[#1]%
+% \popmacro\fontclass
+% \ifx\fontclass\empty\else\setupbodyfont\relax\fi}
+
+\unexpanded\def\usebodyfont[#1]%
+ {\pushmacro\fontclass
+ \font_helpers_set_font\zerocount{#1}%
+ \popmacro\fontclass
+ \ifx\fontclass\empty \else
+ \font_basics_setupbodyfont_nop
+ \fi}
+
%D Handy for manuals:
\unexpanded\def\fontchar#character%
@@ -2138,7 +2175,8 @@
%D The next auxilliary macro is an alternative to \type
%D {\fontname}.
-\def\purefontname#font{\ctxlua{file.basename("\fontname#font"}} % will be function using id
+\def\purefontname#font{\ctxcommand{purefontname("\fontname#font")}}
+%def\purefontname#font{\ctxcommand{purefontname(\number\fontid#font)}}
%D \macros
%D {switchstyleonly}
@@ -2153,7 +2191,7 @@
%D \stoptyping
\unexpanded\def\switchstyleonly
- {\doifnextoptionalelse\font_basics_switch_style_only_opt\font_basics_switch_style_only_arg}
+ {\doifnextoptionalcselse\font_basics_switch_style_only_opt\font_basics_switch_style_only_arg}
\def\font_basics_switch_style_only_arg#name% stupid version
{\font_helpers_set_current_font_style{\csname\??fontshortstyle\checkedstrippedcsname#name\endcsname}%
@@ -2228,6 +2266,7 @@
\unexpanded\def\fullrestoreglobalbodyfont
{\let\fontsize\defaultfontsize
\let\fontbody\defaultfontbody
+ \let\fontface\defaultfontface
\currentxfontsize\zerocount
\let\fontclass\globalfontclass
\font_basics_switch_points\normalizedglobalbodyfontsize
@@ -2241,6 +2280,7 @@
\unexpanded\def\partialrestoreglobalbodyfont
{\let\fontsize\defaultfontsize
\let\fontbody\defaultfontbody
+ \let\fontface\defaultfontface
\currentxfontsize\zerocount
\redoconvertfont
\tf
@@ -2309,6 +2349,83 @@
\def\saveddefinedfontid {\number\fontid\font}
\def\saveddefinedfontname{\fontname\font}
+% yes or no:
+% \let\font_basics_check_text_bodyfont_slow\font_basics_check_text_bodyfont
+%
+% \unexpanded\def\font_basics_check_text_bodyfont
+% {\ifproductionrun
+% % not per se \s!..'s
+% \glet\font_basics_check_text_bodyfont \font_basics_check_text_bodyfont_slow
+% \glet\font_basics_check_text_bodyfont_fast\relax
+% \expandafter\font_basics_check_text_bodyfont
+% \else
+% \expandafter\font_basics_check_text_bodyfont_fast
+% \fi}
+%
+% \def\font_basics_check_text_bodyfont_fast#style#alternative#size% size can be empty (checking needed as \bf is already defined)
+% {\setugvalue{#style#size}% \rma
+% {\let\fontstyle#style%
+% \let\fontsize #size%
+% \font_helpers_check_big_math_synchronization % double? better in everymath?
+% \font_helpers_synchronize_font}%
+% \setugvalue{#alternative#size}% \sla
+% {\let\fontalternative#alternative%
+% \let\fontsize #size%
+% \font_helpers_check_big_math_synchronization % double? better in everymath?
+% \font_helpers_synchronize_font}%
+% \setugvalue{#style#alternative#size}% \rmsla
+% {\let\fontstyle #style%
+% \let\fontalternative#alternative%
+% \let\fontsize #size%
+% \font_helpers_check_big_math_synchronization % double? better in everymath?
+% \font_helpers_synchronize_font}%
+% \ifcsname\s!normal#style\endcsname % text/math check
+% \expandafter\let\csname#style\expandafter\endcsname\csname\s!normal#style\endcsname
+% \else
+% \setugvalue{#style}% \rm
+% {\let\fontstyle#style%
+% \font_typescripts_inherit_check\fontstyle
+% \ifmmode\mr\fi % otherwise \rm not downward compatible ... not adapted yet
+% \font_helpers_synchronize_font}%
+% \fi
+% \ifcsname\s!normal#alternative\endcsname % text/math check
+% \expandafter\let\csname#alternative\expandafter\endcsname\csname\s!normal#alternative\endcsname
+% \else
+% \setugvalue{#alternative}% \sl
+% {\let\fontalternative#alternative%
+% \font_helpers_synchronize_font}%
+% \fi
+% \setugvalue{#style\s!x}% \rmx
+% {\csname#style\endcsname\tx}%
+% \setugvalue{#style\s!xx}% \rmxx
+% {\csname#style\endcsname\txx}%
+% \setugvalue{#alternative\s!x}% \slx
+% {\font_helpers_check_nested_x_fontsize
+% \ifmmode
+% \scriptstyle
+% \else
+% \let\fontface\!!plusfour
+% \let\fontalternative#alternative%
+% \font_helpers_synchronize_font
+% \fi
+% \currentxfontsize\plusone
+% \let\tx\txx}%
+% \setugvalue{#alternative\s!xx}% \slxx
+% {\font_helpers_check_nested_x_fontsize
+% \ifmmode
+% \scriptscriptstyle
+% \else
+% \let\fontface\!!plusfive
+% \let\fontalternative#alternative%
+% \font_helpers_synchronize_font
+% \fi
+% \currentxfontsize\plustwo
+% \let\tx\empty
+% \let\txx\empty}%
+% \setugvalue{#style#alternative}% \rmsl
+% {\let\fontstyle #style%
+% \let\fontalternative#alternative%
+% \font_helpers_synchronize_font}}
\protect \endinput