[XeTeX] XeTeX Digest, Vol 45, Issue 12

Sonam sonamm at sohu.com
Tue Dec 18 16:37:28 CET 2007


On 9 Dec 2007, at 3:10 am, Jonathan wrote:

>I think the main problem is that at  
>the time XeTeX is applying OpenType features or similar character/ 
>glyph level actions, it has not yet done line-breaking, and so it's  
>not possible to make the substitution at this stage.

	Yes, that's right. I think the best place to do it is in the XeTeX line
breaking algorithm and after XeTeX has decided the best break points. I'm
thinking about extending the Locale class of ICU with:

	* Given a line of texts, can return a iterator on the sequences of possible
      variation of the texts.

	* With the iterator, one can get the variation of the texts together with 
      some penalty to break at the end of the texts.

    * A method to change the relevent penalty, to be called by typesetting software
      when certain penalty parameter is changed in, e.g. TeX scripts.

   And try to implement a specific Tib-tan Break Iterator can also prevent XeTeX to
break at the wrong place.
  
>What I think would be needed is something more like TeX's  
>\discretionary primitive, where there are alternative texts, and  
>which one will be used depends on whether the line-break is chosen or  
>not. In fact, it might be possible to achieve the result you showed  
>by clever use of the existing \discretionary feature, but I haven't  
>worked out the exact details of this. And it would certainly be a  
>rather clumsy way to encode the text, so you'd want to do it  
>automatically with a pre-processor rather than expecting users to  
>enter the necessary markup.

    I've tested it the typesetting result by manually insert \discretionary, it
can solve most of the problem except one thing: the {pre-break text}{post-break text}
{no-break text} parameters does not allow glues, only kern is possible. So the text
losts strechbility, and may have some undesirable results sometimes.

    I'm rewriting my pre-processor to do this, with a option to disable it when
the typesetting result is not satisfying.

>I don't think you can do what you're wanting just within the "layout  
>engine" (either by modifying ICU itself or the XeTeXLayoutEngine that  
>provides the interface to it), because at this level, the engine has  
>no knowledge of position on the line. It is just working on an  
>individual word or other text run, but doesn't know where it will occur.

    That's right. I didn't spent much time with ICU documents then. And now I
think it must be implemented with the cooperation of XeTeX & extending ICU
interface.

= = = = = = = = = = = = = = = = = = = =

Best regards!
Lobsang Sonam




More information about the XeTeX mailing list