summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/font-glf.mklx
blob: ba950feea2048729b98ce6c5964cf2651d5fb7dd (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
%D \module
%D   [       file=font-glf,
%D        version=2020.12.21,
%D          title=\CONTEXT\ Font Macros,
%D       subtitle=Glyph Scaling,
%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 Font Macros / Glyph Scaling}

\unprotect

%D Experiment:

\installcorenamespace{scaledfont}
\installcorenamespace{scaledfontxscale}
\installcorenamespace{scaledfontyscale}

\installcommandhandler \??scaledfont {scaledfont} \??scaledfont

\appendtoks
    \ifempty\currentscaledfont\else
        \expandafter\integerdef\csname\??scaledfontxscale\currentscaledfont\endcsname\numericscale\scaledfontparameter\c!xscale\relax
        \expandafter\integerdef\csname\??scaledfontyscale\currentscaledfont\endcsname\numericscale\scaledfontparameter\c!yscale\relax
    \fi
\to \everysetupscaledfont

\integerdef\bodyglyphscale\plusthousand

\appendtoks
    \expandafter\integerdef\csname\??scaledfontxscale\currentscaledfont\endcsname\numericscale\scaledfontparameter\c!xscale\relax
    \expandafter\integerdef\csname\??scaledfontyscale\currentscaledfont\endcsname\numericscale\scaledfontparameter\c!yscale\relax
    \overloaded\frozen\protected\edefcsname\currentscaledfont\endcsname
      {\glyphxscale\numexpr\csname\??scaledfontxscale\currentscaledfont\endcsname*\bodyglyphscale/\plusthousand\relax
       \glyphyscale\numexpr\csname\??scaledfontyscale\currentscaledfont\endcsname*\bodyglyphscale/\plusthousand\relax
       \begincsname\scaledfontparameter\c!style\endcsname}%
\to \everydefinescaledfont

\setupscaledfont
  [\c!scale=\plusthousand,
   \c!xscale=\scaledfontparameter\c!scale,
   \c!yscale=\scaledfontparameter\c!scale]

% \installcorenamespace{scaledfontbody}
%
% \permanent\protected\def\definescaledfontbody[#1]#*[#2]% only for testing
%   {%\expandafter\integerdef\csname\??scaledfontbody#1\endcsname\integerdef\bodyglyphscale\numericscale#2\relax
%    \frozen\protected\defcsname#1\endcsname%
%      {\integerdef\bodyglyphscale\numericscale#2\relax
%       \glyphxscale\bodyglyphscale
%       \glyphyscale\bodyglyphscale
%       \the\everybodyfont}}

\protect \endinput