# [Fontinst] Putting "stuff" in \declaresize

Lars Hellström Lars.Hellstrom at residenset.net
Mon Jul 21 16:02:29 CEST 2008

Plamen Tanovski skrev:
> Hi,
>
> I use \declaresize to put macros as size funcitons in the font
> definition files like this:
>
> \declaresize{}{<-> \string\GSMTPRO at scale }
>
> This works but I want to know generally how one can control the
> expansion and the verbatim writing in the .fd file for the second
> parameter of \declaresize.

Your best bet is to store as fontinst size the exact string (no
expandable tokens, just category 10 (space), 11 (letter), and 12
(other) ones) you want to place in the FD file. \string'ing everything
that's special is typically the easiest way to achieve that.

> The definition
> \def\declaresize#1#2{\x_cs\edef{siz-#1}{#2}} doesn't explain much to
> me.

True, this part of fontinst hasn't seen much documenting work (and the
fact that much of the code is dynamically generated doesn't help). For
what it's worth: Size declarations are used by the \fd_size command,
which essentially applies an \immediate\write to them.

> For example, my first try was using \noexpand like
> \declaresize{}{<-> \noexpand\GSMTPRO at scale }, but then \GSMTPRO at scale
> was expanded neverthenless in the .fd file.

Do you mean it came out as \GSMTPRO @scale? That's a catcode problem (@
isn't a letter). Otherwise, a trick used in many places in fontinst to
protect a macro that's not supposed to be expanded is to \let it to
\relax. I don't see why there should be a definition of \GSMTPRO at scale
in the first place though when running fontinst, though. (Well,
probably you're running fontinst on top of LaTeX and has \GSMTPRO at scale
defined for the sake of font loading, but you can run fontinst without
LaTeX.)

But in summary: Continue to use \string. Declared sizes *are* strings,
and shouldn't contain any expandable material.

Lars Hellström