[XeTeX] Font scaling problem

Ross Moore ross at maths.mq.edu.au
Mon Oct 18 14:52:36 CEST 2004


On 18/10/2004, at 7:10 PM, Jonathan Kew wrote:

> On 18 Oct 2004, at 9:57 am, Ross Moore wrote:
>
>> Hi Jonathan and Will,
>>
>> On 18/10/2004, at 5:32 PM, Jonathan Kew wrote:
>>
>>> To demonstrate that this is the problem, you can wrap your \mkfont 
>>> **definition** so that the proper NFSS catcodes are in effect:
>>>
>>> {\makeatletter \nfss at catcodes \globaldefs=1
>>>  \newcommand\mkfont{
>>>  \DeclareFontFamily{U}{fontB}{}%
>>>  \DeclareFontShape{U}%
>>>     {fontB}{m}{n}{<-> s*[0.5] "Didot"}{}%
>>>  }
>>> }
>>>
>>> Then it will work as expected.
>>
>> Uh uh -- no it won't ...
>
> Oh yes it will.... :-)
>
>>   ... since \mkfont is undefined upon leaving that last '}'
>> closing the \makeatletter grouping.
>
> ....since \globaldefs=1 makes the definitions executed by 
> \newcommand\mkfont global by default, so your added step using 
> \global\let is unnecessary.

OK; I've not ever used that previously.

It's typical with TeX that there's more than one way
to skin the cat.

>
> True, that's probably not how it would be done in a real package, as 
> it's nice to minimize global definitions,

The  \globaldefs  setting is presumably itself local, so applies
only to \mkfont . Hence your solution is perhaps as good as mine
in that respect...

> ... and I don't know quite what \newcommand may do internally.

  ... apart from any side effects that this may leave;
e.g. due to the \futurelet commands used to look for
optional arguments and stars, etc.



Yet another solution is to use a token register to collect
the \newcommand's expansion, having the correct \catcode for
each token, but preceded by an \egroup . Then execute the
value of the token list.


> I was just doing a minimal test to check that the explanation of 
> Will's problem was the right one. But the example did work as 
> written---at least, it did when I tried it.

Fair enough.

Here's the expansion of  \nfss at catcodes :

\def\nfss at catcodes{%
      \makeatletter
      \catcode`\ 9%
      \catcode`\^^I9%
      \catcode`\^^M9%
      \catcode`\\\z@
      \catcode`\{\@ne
      \catcode`\}\tw@
      \catcode`\#6%
      \catcode`\^7%
      \catcode`\%14%
    \@makeother\<%
    \@makeother\>%
    \@makeother\*%
    \@makeother\.%
    \@makeother\-%
    \@makeother\/%
    \@makeother\[%
    \@makeother\]%
    \@makeother\`%
    \@makeother\'%
    \@makeother\"%
}


That all looks pretty normal to me, except
for the space characters: `\  `\^^I  `\^^M
(which are normally 10, not 9).

After some testing, I think it is this \catcode
for `\  (space)  that is the crucial one.



Cheers,

	Ross


>
> FWIW,
>
> JK
>
> _______________________________________________
> XeTeX mailing list
> postmaster at tug.org
> http://tug.org/mailman/listinfo/xetex
>
------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia                                  fax: +61 +2 9850 8114
------------------------------------------------------------------------



More information about the XeTeX mailing list