Am Fri, 28 Jul 2017 23:21:18 +0200 schrieb Hans Hagen:
Is it possible to refer in fonts.handlers.otf.addfeature to the word boundary? The luatex manual speaks of a virtual "left_boundary" char, but I couldn't find a way to use it.
It is possible to check against spaces in contextual lookups. There isn't something like left boundary. I added some test code to the beta but keep in mind that this will only work with self-made features.
Thanks. It seems to work quite good and after some playing around I also got the knack of the syntax. A few questions: 1. "lookups = { 1 }," refers to the first lookup. Is it possible to name the lookups and to refer to this name?. 2. 0xFFFC refers more or less to the begin and end of line, right? Why doesn't it interfere with hyphenations? I tried to get ab- ab and the second wasn't replaced (as wanted) and I wondered how it worked. 3. Why is in the following example "abcd" not replaced by "12"? \startluacode fonts.handlers.otf.addfeature { name = "test-a", type = "chainsubstitution", lookups = { { type = "ligature", data = { ['1'] = { "a", "b" }, ['2'] = { "c", "d" }, }, }, }, data = { rules = { { before = { { " ", 0xFFFC } }, current = { { "a" }, { "b" } }, lookups = { 1 }, }, { current = { { "c" }, { "d" } }, after = { { 0xFFFC, " " } }, lookups = { 1 }, }, }, }, } \stopluacode \definefontfeature[test-a][test-a=yes] \startbuffer xxx abcd abxcd xxx \stopbuffer \starttext \typebuffer \definedfont[file:dejavu-serif.ttf*default] \getbuffer \blank \definedfont[file:dejavu-serif.ttf*default,test-a] \getbuffer \blank \stoptext -- Ulrike Fischer http://www.troubleshooting-tex.de/