[Fontinst] Tokens in 6th argument of \DeclareFontShape

Lars Hellström Lars.Hellstrom at residenset.net
Thu May 12 17:25:17 CEST 2016


Arash Esbati skrev 2016-05-12 11.07:
> "Lars Hellström"<Lars.Hellstrom at residenset.net>  writes:
>
>> Arash Esbati skrev 2016-05-10 18.06:
>>> Hi all,
>>>
>>> I can't find a way to insert code into the last argument of
>>> \DeclareFontShape in a .fd-file directly from a fontinst driver file.
>>> [...]
>>> Any hint, or am I missing the obvious?
>>
>> No, you're not missing anything. Fontinst has an interface for putting
>> custom loading-settings in the \DeclareFontFamily declaration (last
>> argument of \installfamily), but not for putting such in individual
>> \DeclareFontShape declarations. Indeed, \fd_shape (which is
>> responsible for generating the \DeclareFontShape declarations) has
>> this sixth argument hardwired to being empty.
>
> Thanks for your response and the clarification.
>
>> It's not too hard to implement---easiest would be to have a variant
>> macro \fd_shape_with_loadspec to be used instead of \fd_shape---but I
>> don't see an obvious user level interface for specifying the extra
>> information (\installfont already has a ton of arguments).
>>
>> Do you have a use-case in mind, or was it just a matter of exploring
>> all options? In the former case, I would be interested to hear about
>> it.
>
> I worte a small package AnonymousPro supporting the fonts with the
> same name [1].  I was thinking about touching the package again and
> add an option I saw provided by erewhon.sty [2].  It has an option
> `space' to modify the interword spacing:
>
>      \DeclareOptionX{space}[1.2]{\DeclareRobustCommand{\erewhon at sf}{%
>          \fontdimen2\font=##1\fontdimen2\font}}
>
> The command `\erewhon at sf' the is in the sixth argument of
> \DeclareFontShape in the .fd files, e.g. [3]
>
>      \DeclareFontFamily{T1}{erewhon-OsF}{\providecommand{\erewhon at sf}{}}
>
>      \DeclareFontShape{T1}{erewhon-OsF}{m}{n}{
>            <->  \erewhon@@scale Erewhon-Regular-osf-t1
>      }{\erewhon at sf}

But if it's the same snippet of code for all fonts in the family, then you 
can just put it in the \DeclareFontFamily argument instead:

    \DeclareFontFamily{T1}{erewhon-OsF}{%
       \providecommand{\erewhon at sf}{}\erewhon at sf
    }

Slightly shortens your FD file. You only need to put it in the 
\DeclareFontShape if some part of it is different for different fonts in the 
family (e.g. the scaling of the fontdimen additionally is different for 
different series, and the \erewhon at sf takes an argument that somehow adjusts 
this).

>
> Do you see a chance to implement something?

Yes, but not now; I'm quite swamped with work at the moment. :-(

Lars Hellström

> If not, not a big deal,
> there is still `sed'.
>
> Best, Arash
>
>
> Footnotes:
> [1]  https://www.ctan.org/pkg/anonymouspro
>
> [2]  https://www.ctan.org/pkg/erewhon
>
> [3]  http://mirrors.ctan.org/fonts/erewhon/tex/T1erewhon-OsF.fd
>





More information about the fontinst mailing list