%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{tweakedfont}

\installcommandhandler \??tweakedfont {tweakedfont} \??tweakedfont

\appendtoks
    % we can optimize for zero and 1000 .. maybe also options?
    \overloaded\frozen\protected\edefcsname\currenttweakedfont\endcsname
      {\begincsname\tweakedfontparameter\c!style\endcsname
       \glyphxscale {\numericscale\tweakedfontparameter\c!xscale*\glyphxscale/\plusthousand}%
       \glyphyscale {\numericscale\tweakedfontparameter\c!yscale*\glyphyscale/\plusthousand}%
       \glyphxoffset{\glyphxoffset+(\tweakedfontparameter\c!xoffset)}%
       \glyphyoffset{\glyphyoffset+(\tweakedfontparameter\c!yoffset)}}%
\to \everydefinetweakedfont

\setuptweakedfont
  [\c!scale=\plusthousand,
   \c!xscale=\tweakedfontparameter\c!scale,
   \c!yscale=\tweakedfontparameter\c!scale,
   \c!xoffset=\zeropoint,
   \c!yoffset=\zeropoint]

\protect \endinput
