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.mkvi62
1 files changed, 48 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/context/base/font-ini.mkvi b/Master/texmf-dist/tex/context/base/font-ini.mkvi
index 61fa7afd118..63b7863c8cc 100644
--- a/Master/texmf-dist/tex/context/base/font-ini.mkvi
+++ b/Master/texmf-dist/tex/context/base/font-ini.mkvi
@@ -1746,7 +1746,7 @@
\unexpanded\def\font_helpers_set_current_font_size#size%
{\edef\fontsize{#size}%
- \font_helpers_check_big_math_synchronization
+ \font_helpers_check_big_math_synchronization % double? better in everymath?
\font_helpers_synchronize_font}
\unexpanded\def\font_helpers_set_current_font_style_alternative#style#alternative% \rmsl
@@ -1757,20 +1757,20 @@
\unexpanded\def\font_helpers_set_current_font_style_size#style#size% \rma
{\edef\fontstyle{#style}%
\edef\fontsize {#size}%
- \font_helpers_check_big_math_synchronization
+ \font_helpers_check_big_math_synchronization % double? better in everymath?
\font_helpers_synchronize_font}
\unexpanded\def\font_helpers_set_current_font_alternative_size#alternative#size% \sla
{\edef\fontalternative{#alternative}%
\edef\fontsize {#size}%
- \font_helpers_check_big_math_synchronization
+ \font_helpers_check_big_math_synchronization % double? better in everymath?
\font_helpers_synchronize_font}
\unexpanded\def\font_helpers_set_current_font_style_alternative_size#style#alternative#size% \rmsla
{\edef\fontstyle {#style}%
\edef\fontalternative{#alternative}%
\edef\fontsize {#size}%
- \font_helpers_check_big_math_synchronization
+ \font_helpers_check_big_math_synchronization % double? better in everymath?
\font_helpers_synchronize_font}
\unexpanded\def\font_helpers_synchronize_font % we can have dups i.e. no need to let fontstrategy
@@ -2095,16 +2095,18 @@
\fi
\the\everysetupbodyfont}}
-\unexpanded\def\switchtobodyfont[#specification]%
- {\doifsomething{#specification}
- {\edef\m_font_step{\bodyfontvariable{#specification}}%
- \ifx\m_font_step\empty
- \font_helpers_set_font\zerocount{#specification}%
- \else
- \font_helpers_switch_bodyfont_step % so we have a fast [small] switch
- \fi
- \the\everybodyfont
- \the\everyswitchtobodyfont}}
+\unexpanded\def\font_basics_switchtobodyfont#specification%
+ {\edef\m_font_step{\bodyfontvariable{#specification}}%
+ \ifx\m_font_step\empty
+ \font_helpers_set_font\zerocount{#specification}%
+ \else
+ \font_helpers_switch_bodyfont_step % so we have a fast [small] switch
+ \fi
+ \the\everybodyfont
+ \the\everyswitchtobodyfont}
+
+\unexpanded\def\switchtobodyfont[#specification]% could become an ifx
+ {\doifsomething{#specification}{\font_basics_switchtobodyfont{#specification}}}
\def\font_helpers_switch_bodyfont_step
{\font_basics_switch_points\m_font_step
@@ -2263,4 +2265,36 @@
% in case of troubles: \let\restorebodyfont\fullrestoreglobalbodyfont
+%D Here are some fast variants that can be used in cases where no font
+%D system is needed and where fonts are frozen:
+%D
+%D \starttyping
+%D \definefont [TestA][Serif at 10pt]
+%D \predefinefont[TestB][Serif at 20pt]
+%D
+%D \testfeatureonce{1000}{{\TestA}} % .312
+%D \testfeatureonce{1000}{{\TestB}} % < .016
+%D \testfeatureonce{1000}{{\definedfont[Serif at 30pt]}} % .312
+%D \testfeatureonce{1000}{{\predefinedfont[Serif at 40pt]}} % < .016
+%D \stoptyping
+
+\installcorenamespace{predefinedfont}
+
+\unexpanded\def\predefinefont[#1]#2[#3]% global !
+ {\setugvalue{#1}{\font_basics_predefine{#1}{#3}}}
+
+\unexpanded\def\predefinedfont[#1]% global !
+ {\ifcsname\??predefinedfont#1\endcsname
+ \csname\??predefinedfont#1\endcsname
+ \else
+ \font_basics_predefined{#1}%
+ \fi}
+
+\unexpanded\def\font_basics_predefine#1#2%
+ {\font_basics_defined_font_yes[#2]%
+ \global\expandafter\let\csname#1\expandafter\endcsname\csname\v_font_identifier_basic\endcsname}
+
+\unexpanded\def\font_basics_predefined#1%
+ {\font_basics_predefine{\??predefinedfont#1}{#1}}
+
\protect \endinput