schlcht / microtype

The microtype package
https://ctan.org/pkg/microtype
LaTeX Project Public License v1.3c
86 stars 4 forks source link

XeTeX compatibility #22

Open appetrosyan opened 2 years ago

appetrosyan commented 2 years ago

Hi, I'd like to request XeTeX compatibility be considered. Currently any attempt to compile a package results in the following "error":

Package microtype Error: Letterspacing currently doesn't work with xetex.

See the microtype package documentation for explanation.
Type  H <return>  for immediate help
error: halted on potentially-recoverable error as specified

The currently part makes me hope that it is possible to re-enable the compatibility.

Rationale

https://github.com/tectonic-typesetting/tectonic uses a customised fork of XeLaTeX. Aside from that it is an incredibly convenient typesetting system: it doesn't occupy tens of gigabytes, it fetches only the packages that are needed and frankly the choice to use a more modern version of LaTeX allows it to be built for other platforms.

Currently any document that requires microtype cannot be built with tectonic, necessitating a TeXLive installation.

schlcht commented 2 years ago

First of all, you must be doing something to provoke this error message (either you're loading the package with the tracking option, or you're using the \textls command). Just loading microtype should not result in any errors, and it should run just fine with tectonic/xetex. So if you really get this error message for no apparent reason, something else would be wrong (for which I'd need a MWE).

As to whether it's possible to allow letterspacing with xetex: in principle yes, because xetex is able to add letterspacing to (OpenType) fonts via fontspec's LetterSpace option. I could integrate this into microtype's interface -- in fact this has long been on my todo list, and your report has now upped it... For the time being, you could use the interface provided by fontspec.

appetrosyan commented 2 years ago

(either you're loading the package with the tracking option, or you're using the \textls command)

Exactly! I didn't notice it before making the MWE.

af2005 commented 6 months ago

I'm also using tectonic and therefore a fork of xetex and would love to use the automatic font expansion option of microtype. Is it difficult to implement this for xetex?

appetrosyan commented 6 months ago

I wonder if there can be a simple package that can convert the microtyping macros into XeTeX native instructions.

schlcht commented 6 months ago

I'm also using tectonic and therefore a fork of xetex and would love to use the automatic font expansion option of microtype. Is it difficult to implement this for xetex?

Font expansion would have to be implemented in the engine itself, so there's nothing microtype can do. (Some time ago, there were some rumours that expansion would be made available in xetex, but nothing seems to have come of it. Since development is basically frozen, I wouldn't hold my breath.)

As for the original request (letterspacing): this is feasible, and I'll have a look.