On Sat, 19 Feb 2011, Martin Schröder wrote: > Methinks the ragged2e package offers a solution.
The ragged2e package doesn't work for me because it recognizes monospace fonts by detecting that the value of \fontdimen3 is zero. For OTF fonts, XeTeX sets \fontdimen3 to nonzero regardless of whether the font is monospace; that's part of the origin of my problem, and it means ragged2e can't detect that the font is monospace. However, the "everysel" package used by ragged2e helps a lot. I still need to hack the fontdimens directly, but I can put the code to do that in an \EverySelectfont so that it will execute, as it must, after font size changes; thereby letting me set up the monospace stuff once and not having to change all other size-changing code in a way that breaks semantic markup. Thanks! For anyone else facing this kind of situation, the code I'm now using runs as follows: \usepackage{everysel} \makeatletter \def\fixmonofont{% \dimen@\f@size pt\multiply\dimen@ by 2\divide\dimen@ by 5% \fontdimen2\font\the\dimen@% \fontdimen3\font0pt% \fontdimen4\font0pt% \dimen@\f@size pt\multiply\dimen@ by 11\divide\dimen@ by 20% \fontdimen5\font\the\dimen@% \dimen@\f@size pt\multiply\dimen@ by 4\divide\dimen@ by 5% \fontdimen8\font\the\dimen@% \dimen@\f@size pt\multiply\dimen@ by 2\divide\dimen@ by 5% \fontdimen7\font\the\dimen@% } \makeatother \EverySelectfont{\fixmonofont} Those ratios are specific to the fonts I'm using and might have to be changed for others. This does not accomodate the possibility of justification, but it's pretty much unheard-of to justify monospace type. I still think that XeTeX or fontspec are buggy in their handling of monospace fonts, but this is a better workaround. -- Matthew Skala msk...@ansuz.sooke.bc.ca People before principles. http://ansuz.sooke.bc.ca/
-------------------------------------------------- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex