Funny that the ZWNJ method should come up, as it so happens that I'm working on 
updating selnolig. 

The next version will offer a choice of tree methods for suppressing ligatures. 
In addition to the current method (i.e.,insertion of a whatsit) I'm thinking of 
implementing two further methods: the ZWNJ method you describe (very flexible, 
but requires an Opentype font), and what I'll call the babel method for obvious 
reasons: insertion  of a discretionary that provides 0.03em of whitespace in 
case there's no line break. The babel method will work with any font (and, its 
name notwithstanding, doesn't require that babel be loaded). 

In terms of programming, whereas the whatsit method works with the "ligaturing" 
callback, the two newer methods need to work with the "pre_linebreak_filter" 
callback, which takes an input and provides a return. (The ligaturing callback, 
by contrast, takes two inputs but does not provide a return value.) 

I've subscribed to the Trennmuster list, by the way. 

Best, Mico

Sent from my iPhone.

> Message: 1
> Date: Wed, 26 Nov 2014 20:18:27 +0100
> From: Stephan Hennig <[email protected]>
> To: "LuaTeX discussion." <[email protected]>
> Subject: Re: [luatex] What are user-defined whatsit nodes?
> 
>> Am 24.11.2014 um 20:23 schrieb Khaled Hosny:
>> 
>> The ?official? Unicode was for suppressing a ligature is by inserting a
>> ZWNJ character, so I guess inserting a whatsit is as close
> 
> That seems to work just as well (see attached example).  But ideally,
> I'd like to not do the low-level node handling myself.  I'll post a
> proposal of what I have in mind in a few days.
> 
> 
>> (of course if one can get a ZWNJ to the output stream so that
>> ligature suppression is maintained even when text is copied around,
>> that would be even better IMO).
> 
> Doesn't look like that's happening, currently.
> 
>> BT
>> /F1 9.96264 Tf 1 0 0 1 91.925 759.927 Tm [(butterflies)-333(butterflies)]TJ
>> 1 0 0 1 303.509 105.18 Tm [(1)]TJ
>> ET
> 
> Best regards,
> Stephan Hennig
> 
> % -*- coding: utf-8 -*-
> \pdfcompresslevel=0
> \directlua{
> % Declare constants.
>  local GLYPH = node.id('glyph')
>  local CHAR_f = string.byte('f')
>  local CHAR_l = string.byte('l')
>  local Ncopy = node.copy
>  local Nnew = node.new
>  local Ninsert_before = node.insert_before
>  local Ntraverse = node.traverse
> % Create ZWNJ template.
>  local zwnj = Nnew(GLYPH)
>  zwnj.char = 0x200c
> % Register callback.
>  callback.register('ligaturing',
>    function (head, tail)
> %     Iterate over node list.
>      for n in Ntraverse(head) do
>        if n.id == GLYPH and n.char == CHAR_l then
>          local p = n.prev
>          if p.id == GLYPH and p.char == CHAR_f then
>            local zwnjx = Ncopy(zwnj)
>            zwnjx.font = n.font
>            zwnjx.lang = n.lang
>            Ninsert_before(head, n, zwnjx)
>          end
>        end
>      end
>      node.ligaturing(head, tail)
>    end
>  )
> }
> \righthyphenmin=3
> \showhyphens{butterflies}butterflies
> \righthyphenmin=5
> \showhyphens{butterflies}butterflies
> \bye
> 
> 
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> luatex mailing list
> [email protected]
> http://tug.org/mailman/listinfo/luatex
> 
> 
> ------------------------------
> 
> End of luatex Digest, Vol 71, Issue 19
> **************************************

Reply via email to