[XeTeX] New feature planned for xetex

Jonathan Kew jfkthame at gmail.com
Thu Feb 18 15:06:07 CET 2016


On 18/2/16 12:51, Philip Taylor wrote:
>
> Jonathan Kew wrote:
>
>> When \XeTeXinterwordspaceshaping is greater than 0, XeTeX will attempt
>> to support fonts where the width of inter-word spaces may vary
>> contextually, depending on the preceding and following text. This is
>> needed by fonts such as SIL's Awami Nastaliq (in development) where
>> words are expected to kern together across spaces.
>
>> These [other] cases are addressed with \XeTeXinterwordspaceshaping=2. With this
>> value, not only are inter-word spaces measured in context, but also each
>> run of text (words and intervening spaces) in a single font will be
>> re-shaped as a unit at \shipout time. This allows full shaping
>> (contextual swashes, ligatures, etc) to take effect across inter-word
>> spaces.
>
> I like these ideas, Jonathan, but wonder whether the two concepts should
> be orthogonal (possible implementation :  treat the value of
> \XeTeXinterwordspaceshaping as a bit mask, such that
> \XeTeXinterwordspaceshaping = 1 would be for SIL's Awami Nastaliq, etc.,
> \XeTeXinterwordspaceshaping = 2 would be for Hoefler Italic, etc., and
> \XeTeXinterwordspaceshaping = 3 would be for both). This would also
> allow future extensibility without compromising backward compatibility.


Hmm. It doesn't really make sense to re-shape text across inter-word 
spaces (as required for Hoefler Italic swashes, multi-word ligatures, 
etc) and yet NOT take account of this during line breaking (which is 
what level 1 provides).

As it happens, that exact combination IS what current xetex does with 
AAT fonts (only, not with OT or Graphite)... it doesn't do anything 
special w.r.t. line-breaking, but it does have a little-known (and not 
user-controllable) feature whereby it tries to re-shape entire runs of 
words in a single font. In practice, however, this doesn't always work 
very well, precisely because it fails to find the line-breaks that would 
be optimal for the globally-shaped text. So using Hoefler Text Italic 
with word-final swashes enabled will result in poor word spacing. The 
new implementation - when set to level 2 - gives markedly superior output.

IMO, the "two concepts" here build upon each other in a logical 
sequence: (1) do we allow smart-font shaping behavior beyond the 
boundaries of a single word to affect text measurement and line 
breaking; and (2) do we also allow it to affect the actual rendering of 
each word? Allowing it to affect the rendering WITHOUT affecting 
measurement and line-breaking would be somewhat nonsensical.

In an ideal world, \XeTeXinterwordspaceshaping=2 would be the default 
(perhaps the only) behavior. I'm not doing this, though, because there 
are compatibility implications (and in particular, there are potential 
side-effects on \special that may require workarounds at the macro 
level), as well as a significant performance cost for a feature that 
will make no visible difference with most fonts.

So... that was an interesting and thought-provoking suggestion, but at 
this point I think I'm inclined towards keeping the existing model. To 
me, it makes sense to think of these as increasing levels of support, 
rather than as independent features.

JK



More information about the XeTeX mailing list