[luatex] luatex Digest, Vol 57, Issue 5

Graham Douglas graham.douglas at readytext.co.uk
Mon Sep 16 13:54:59 CEST 2013


On 16/09/2013 11:00, luatex-request at tug.org wrote:
> I have a feeling the following shouldn't be difficult to accomplish, but somehow I'm not succeeding. Advice/critiques/suggestions welcome!
>
> I'm trying to insert a specific character, a so-called "zero width non joining" character (unicode point "200C) into specific points in the node stream. So far, I've tried to create such a node via
>
>      local zwnjnode = node.new(glyph)
>      zwnj.type      = 1
>      zwnjnode.char  = unicode2utf("200C")
>
> where "glyph" is created via 
>
>      glyph   = node.id('glyph')
>
> and unicode2utf is a function whose only instruction is
>
>      return unicode.utf8.char(tonumber(c,16))
>
> and 'c' would be "200C". Later on in the code, these zwnjnode objects are inserted into the node list via
>
>       node.insert_before(hh, curr, node.copy(zwnjnode) )
>
> where "curr" is the current node processed by node.traverse
>
>
> Here's the problem: While **something** definitely ends up being inserted into the node list, it doesn't appear to be a ZWNJ character. If somebody could help me figure out the error(s) in my ways, I'd be much obliged. Is a ZWNJ character maybe not suitable for a node of type "glyph"? Am I doing something wrong in the process of creating the zwnjnode objects? Please advise.
>
> Many thanks in advance,
>
> Mico

Hi Mico

the .char field should not be UTF-8 but simply the integer value of the
character.

Assuming \test is a font with the ZWNJ as a displayable glyph, this works:

\test % set your font first...

\directlua{

local head= node.new("glyph")
head.font = font.current()
head.lang = tex.language
head.char=8204

tex.box[500]=node.hpack(head)

}

\copy500

best

Graham




More information about the luatex mailing list