[XeTeX] fontspec and tabularx (was: Colored Arabic in Tables)

Ross Moore ross at ics.mq.edu.au
Thu Mar 12 03:16:17 CET 2009


Hi Will,

On 12/03/2009, at 11:31 AM, Will Robertson wrote:

> On 2009-03-12 07:11:00 +1030, François Charette
> <firmicus at ankabut.net> said:
>
>> Note that the problem also occurs more generally with any font  
>> mapping.
>> Any change in a given font mapping outside tabularx is simply  
>> ignored by
>> fontspec:
>
> Sorry I didn't catch this thread until now.
> Yeah, it sure seems like tabularx is really weird; fontspec is usually
> fine with these sorts of grouping things.
>
> Thanks, Ross, for the code to fix things up; I'm not sure yet if I  
> want
> to start patching others' packages in fontspec, but maybe doing it in
> xltxtra would be okay.

The alternative is to patch only  \addfontfeature  with a check
to see whether it is inside a  {tabularx}  environment, etc.
But this is less efficient, for then the test will need to be done
even for instances of \addfontfeature  which are not inside a table.

When you also have other array-like environments, then you would
need to overload the same macro with all the different tests.
I think adding the test to the environment's code is a better way
to proceed.


Now having said that, I now realise that the strategy I devised
isn't the best way to handle the {tabularx} situation.
It could be that the font feature to be added is to scale the
font to a different size, which is then going to affect the
measurement of table-column widths.
In this case it is wrong to cancel \addfontfeature as my hack
implements. Instead you want the font change to occur, so that
the measurement takes place correctly.

Instead what is needed is for the proper (typesetting) instance
of \addfontfeature to generate a different internal name,
*even though the parameters are the same* as when measuring
took place.

Is there a null feature that can be included among the font
attributes? This feature would do nothing, except to force
the font-instance counter to be incremented, thus getting
a new font name referring to the font with the same added
properties.


>
> Cheers,
> Will


Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------





More information about the XeTeX mailing list