[XeTeX] XeTeX, fontspec, OTF, and fontdimens

Will Robertson wspr81 at gmail.com
Sun Feb 27 23:18:03 CET 2011


On 28/02/2011, at 12:56 AM, mskala at ansuz.sooke.bc.ca wrote:

> If I edit the fontspec.sty file to include the above definition instead of
> the existing one, then inter-word spaces scale correctly.  Inter-sentence
> spaces don't.  Ideally there would be similar code addressing \fontdimen7
> in relation to the PunctuationSpace option.

Yep, exactly.

>> Could we measure the width of an "i" and an "m", and if they're the same
>> we'd be 99% sure it's a monospace font? If there are fontdimen features that
>> could be set more appropriately for such cases, I'd be happy to add an
>> automatic feature for this.
> 
> That has obvious problems (in particular, what about a font that isn't
> designed for the Latin script and doesn't have "i" or "m"?) but it's
> probably the best that can be done.

Right; it's easy to bail out early in this test if these two glyphs don't exist.

>  As has been discussed elsewhere in
> this thread, OTF files do include a flag saying whether the font is
> monospace, but that flag's value may not really be the right thing to look
> at.  I'm not sure that fontspec would have any way of checking the flag
> value.

Also true.

> One little gotcha:  the current WordSpace option syntax accepts
> multipliers to be applied to the defaults.  If fontspec for whatever
> reason defaulted to zero - which I think it should, in the case of
> stretchability for a monospace font - then it's not clear how the user
> could override that and make the spaces stretchable after all, should they
> want to.

Aha, good thinking! That is definitely of some concern.

How about, instead, if 

    WordSpace={2,2,2}

was a multiplier, but

    WordSpace={6pt,2pt,1pt}

set the values explicitly? (Subject to scaling according to the font size.)

> Don't forget to include the inter-sentence extra space among things
> affected by monospace; as I mentioned elsewhere on the thread, people
> argue about whether the inter-sentence space (word space plus extra)
> should be one word space (no extra) or two word spaces (one word space
> plus one extra) in a monospace setting, but I think everybody who cares
> agrees that the current default of one word space plus 1/3 word space,
> which might be appropriate for propotional spacing, isn't appropriate for
> monospace.

I'm going to need a quick summary of everything we want to do here. I've opened three issues in the fontspec tracker; first to fix the WordSpace/PunctuationSpace behaviour:

   http://github.com/wspr/fontspec/issues/97

Second to extend the syntax to allow absolute lengths:

   http://github.com/wspr/fontspec/issues/98

And lastly to add a feature for detecting monospace fonts:

   http://github.com/wspr/fontspec/issues/99

Have I missed anything?
I'll address them when possible (and patches are certainly accepted!) but I'm juggling a lot right now.

-- Will




More information about the XeTeX mailing list