%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 \numexpr\numericscale\tweakedfontparameter\c!xscale*\glyphxscale/\plusthousand\relax
       \glyphyscale \numexpr\numericscale\tweakedfontparameter\c!yscale*\glyphyscale/\plusthousand\relax
       \glyphxoffset\dimexpr\glyphxoffset+\tweakedfontparameter\c!xoffset\relax
       \glyphyoffset\dimexpr\glyphyoffset+\tweakedfontparameter\c!yoffset\relax}%
\to \everydefinetweakedfont

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

\protect \endinput

