[XeTeX] XeTeX, fontspec, OTF, and fontdimens

Will Robertson wspr81 at gmail.com
Sun Feb 27 06:28:19 CET 2011


On 2011-02-20 03:51:03 +1030, 
mskala at ansuz.sooke.bc.ca said:

> Manually setting \fontdimen3 and \fontdimen4 seems to correctly change the
> space stretchability - and in fact is the workaround I'm using for the
> time being - but it must be repeated after every size change and so it
> breaks semantic markup.  That is the case even with no use of WordSpace in
> the document at all.

Sorry I'm late to this discussion. Been overly busy.
This is pretty clearly a bug in the WordSpace feature.

The code here is

    \dim_set:Nn \@tempdima {#1\fontdimen2\zf at basefont}
    \dim_set:Nn \@tempdimb {#2\fontdimen3\zf at basefont}
    \dim_set:Nn \@tempdimc {#3\fontdimen4\zf at basefont}
...
  \tl_put_right:Nx \l_fontspec_postadjust_tl {
    \fontdimen2\font\the\@tempdima
    \fontdimen3\font\the\@tempdimb
    \fontdimen4\font\the\@tempdimc
  }

which is later used internally in \DeclareFontShape:

\DeclareFontShape{\zf at enc}{\zf at family}{#2}{#3}
      {\l_fontspec_nfss_tl}{\l_fontspec_postadjust_tl}


So it seems like I should be writing something more like

  \tl_put_right:Nn \l_fontspec_postadjust_tl {
    \fontdimen2\font=#1\fontdimen2\font
    \fontdimen3\font=#2\fontdimen3\font
    \fontdimen4\font=#3\fontdimen4\font
  }

instead. Does this seem right? (This code dates back years and years, 
so I might not have known what I was doing when this was first written.)

If replies could be CC-ed to me via email I'll be more likely to respond :)

Cheers,
Will




More information about the XeTeX mailing list