[XeTeX] Font protrusion --- new or old ?

Stephen Moye sgmoye at me.com
Sun Feb 8 20:28:19 CET 2009


On Feb 8, 2009, at 9:36 AM, Jonathan Kew wrote:

> Basically, borrow the ideas from Appendix D but use the transition
> between class 255 (non-character) and whatever classes you assign to
> the punctuation chars to insert the kerns. Beware of recursion.
>
> %%!TEX TS-program = xetex
> \font\tenrm="Times New Roman" at 10pt
> \tenrm
>
> \XeTeXinterchartokenstate=1
> \XeTeXcharclass "201C = 10
> \XeTeXcharclass "201D = 11
> \newdimen\quotehang
> \XeTeXinterchartoks 255 10 = {{\XeTeXinterchartokenstate=0
>     \setbox0=\hbox{\char"201C}\quotehang=\wd0
>     \ifhmode\kern\quotehang\vadjust{}\else\leavevmode\fi
>     \kern-\quotehang}}
> \XeTeXinterchartoks 11 255 = {{\XeTeXinterchartokenstate=0
>     \setbox0=\hbox{\char"201D}\quotehang=\wd0
>     \kern-\quotehang\kern\quotehang}}
>
> \hsize=3.25in
> \noindent
> The one thing which I would note is that one can do this sort of thing
> (to a certain degree) at the macro level — see Donald Knuth’s
> description of “hanging punctuation” as “an easier problem” in The
> \TeX{}book and Peter Wilson’s “hanging” package which enables this for
> La\TeX.
>
> \end

Wow. Very cool. Works like a charm! Now if we could just
get at the hyphen... ;>}

Your warning about recursion is ominous... When would that
rear its ugly head?

Thanks again.

Stephen


More information about the XeTeX mailing list