summaryrefslogtreecommitdiff
path: root/tex/context/base/spac-fnt.mkiv
blob: 35e9b6dd5ca0ff614ef1659ac3a4c90789797ee1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
%D \module
%D   [       file=spac-fnt,
%D        version=2009.10.16, % 1997.03.31, was core-spa.tex
%D          title=\CONTEXT\ Spacing Macros,
%D       subtitle=Fonts,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt Spacing Macros / Fonts}

%D For historic reasons here, will move and/or disappear:

\unprotect

\let\dostopattributes\relax % in case these commands end up in an edef

\unexpanded\def\@@dostopattributes
  {\stopcolor
   \finishparbasedattributes
   \endgroup}

\unexpanded\def\@@nostopattributes
  {\finishparbasedattributes
   \endgroup}

\unexpanded\def\doattributes#1#2#3#4%
  {\dostartattributes{#1}{#2}{#3}{#4}\dostopattributes}

% An even faster \ETEX\ version:

\unexpanded\def\dostartattributes#1#2#3%
  {\begingroup  % geen \bgroup, anders in mathmode lege \hbox
   \ifincolor
     \ifcsname#1#3\endcsname
       \let\dostopattributes\@@dostopattributes
       \faststartcolor[\csname#1#3\endcsname]%
     \else
       \let\dostopattributes\@@nostopattributes
     \fi
   \else
     \let\dostopattributes\@@nostopattributes
   \fi
   \ifcsname#1#2\endcsname
   % \@EAEAEA\doconvertfont\@EA\@EA\csname#1#2\endcsname
     \@EA\doconvertfont\csname#1#2\@EA\endcsname
   \fi}

\unexpanded\def\@@dostopattributes
  {\faststopcolor
   \finishparbasedattributes
   \endgroup}

\unexpanded\def\@@nostopattributes
  {\finishparbasedattributes
   \endgroup}

%D Bonus macro, see core-sec.tex

\newconditional\fontattributeisset

\unexpanded\def\dosetfontattribute#1#2%
  {\ifcsname#1#2\endcsname
     \settrue\fontattributeisset % reset is done elsewhere
     \@EA\doconvertfont\csname#1#2\@EA\endcsname
   \fi\empty}

%D Since this happens a lot, and sometimes large arguments
%D are passed in \type {#4}, we just copy some code:

\unexpanded\def\doattributes#1#2#3#4%
  {\begingroup  % geen \bgroup, anders in mathmode lege \hbox
   \ifincolor
     \ifcsname#1#3\endcsname
       \let\dostopattributes\@@dostopattributes
       \faststartcolor[\csname#1#3\endcsname]%
     \else
       \let\dostopattributes\endgroup
     \fi
     \else
       \let\dostopattributes\endgroup
     \fi
     \ifcsname#1#2\endcsname
     % \@EAEAEA\doconvertfont\@EA\@EA\csname#1#2\endcsname
       \@EA\doconvertfont\csname#1#2\@EA\endcsname
     \fi
     {#4}%
     \dostopattributes}

\protect \endinput