From 488dc02c27841eced466d9b6594666c923fef649 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 30 Jul 2017 00:12:09 +0200 Subject: 2017-07-29 23:14:00 --- doc/context/documents/general/qrcs/setup-cs.pdf | Bin 845153 -> 845467 bytes doc/context/documents/general/qrcs/setup-de.pdf | Bin 843045 -> 843087 bytes doc/context/documents/general/qrcs/setup-en.pdf | Bin 848083 -> 848226 bytes doc/context/documents/general/qrcs/setup-fr.pdf | Bin 841724 -> 841945 bytes doc/context/documents/general/qrcs/setup-it.pdf | Bin 843463 -> 843541 bytes doc/context/documents/general/qrcs/setup-nl.pdf | Bin 840158 -> 840328 bytes doc/context/documents/general/qrcs/setup-ro.pdf | Bin 840226 -> 840752 bytes .../general/fonts/fonts/fonts-extensions.tex | 194 ++++++++++++++++++++- 8 files changed, 193 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf index 37c7a68fb..a0053d6f5 100644 Binary files a/doc/context/documents/general/qrcs/setup-cs.pdf and b/doc/context/documents/general/qrcs/setup-cs.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf index 5da0c198c..03475267e 100644 Binary files a/doc/context/documents/general/qrcs/setup-de.pdf and b/doc/context/documents/general/qrcs/setup-de.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf index 909024974..d1f8f2779 100644 Binary files a/doc/context/documents/general/qrcs/setup-en.pdf and b/doc/context/documents/general/qrcs/setup-en.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf index dad17cbcf..af01a90e6 100644 Binary files a/doc/context/documents/general/qrcs/setup-fr.pdf and b/doc/context/documents/general/qrcs/setup-fr.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf index 82212f1ca..f1c34d492 100644 Binary files a/doc/context/documents/general/qrcs/setup-it.pdf and b/doc/context/documents/general/qrcs/setup-it.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf index 7b65a0afb..c85de095b 100644 Binary files a/doc/context/documents/general/qrcs/setup-nl.pdf and b/doc/context/documents/general/qrcs/setup-nl.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf index 55a3ade53..1492351bd 100644 Binary files a/doc/context/documents/general/qrcs/setup-ro.pdf and b/doc/context/documents/general/qrcs/setup-ro.pdf differ diff --git a/doc/context/sources/general/fonts/fonts/fonts-extensions.tex b/doc/context/sources/general/fonts/fonts/fonts-extensions.tex index 87e362569..1d84bfdc6 100644 --- a/doc/context/sources/general/fonts/fonts/fonts-extensions.tex +++ b/doc/context/sources/general/fonts/fonts/fonts-extensions.tex @@ -1714,6 +1714,199 @@ Here the dataset is a sequence of rules. There can be a \type {before}, \type {lookups} entry and the numbers are indices in the provided \type {lookups} table. +Here is another example. This one demonstrates that one can check against spaces +(some fonts kerns against them) and against boundaries as well. The later is +something \CONTEXT\ specific. First we define a feature that create ligatures but +only when we touch a space: + +\startbuffer +\startluacode + fonts.handlers.otf.addfeature { + name = "test-a", + type = "chainsubstitution", + lookups = { + { + type = "ligature", + data = { + ['1'] = { "a", "b" }, + ['2'] = { "c", "d" }, + }, + }, + }, + data = { + rules = { + { + before = { { " " } }, + current = { { "a" }, { "b" } }, + lookups = { 1 }, + }, + { + current = { { "c" }, { "d" } }, + after = { { " " } }, + lookups = { 1 }, + }, + }, + }, + } + +\stopluacode +\stopbuffer + +\typebuffer \getbuffer + +The next example also checks against whatever boundary we have. + +\startbuffer +\startluacode + fonts.handlers.otf.addfeature { + name = "test-b", + 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 +\stopbuffer + +\typebuffer \getbuffer + +We can actually simplify this one to: + +\startbuffer +\startluacode + fonts.handlers.otf.addfeature { + name = "test-c", + 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 +\stopbuffer + +\typebuffer \getbuffer + +As a bonus we show how to do more complex things: + +\startbuffer +\startluacode + fonts.handlers.otf.addfeature { + name = "test-d", + type = "chainsubstitution", + lookups = { + { + type = "substitution", + data = { + ["a"] = "A", + ["b"] = "B", + ["c"] = "C", + ["d"] = "D", + }, + }, + { + type = "ligature", + data = { + ['1'] = { "a", "b" }, + ['2'] = { "c", "d" }, + }, + }, + }, + data = { + rules = { + { + before = { { 0xFFFC } }, + current = { { "a" }, { "b" } }, + lookups = { 2 }, + }, + { + current = { { "c" }, { "d" } }, + after = { { 0xFFFC } }, + lookups = { 2 }, + }, + { + current = { { "a" } }, + after = { { "b" } }, + lookups = { 1 }, + }, + { + current = { { "c" } }, + after = { { "d" } }, + lookups = { 1 }, + }, + }, + }, + } +\stopluacode +\stopbuffer + +\typebuffer \getbuffer + +\definefontfeature[test-a][test-a=yes] +\definefontfeature[test-b][test-b=yes] +\definefontfeature[test-c][test-c=yes] +\definefontfeature[test-d][test-d=yes] + +\startbuffer +abababcdcd abababcdcd abababcdcd +\stopbuffer + +With the test text: + +\typebuffer + +These four result in: + +\blank \start + + \definedfont[file:dejavu-serif.ttf*default] + + \start \addff{test-a} \getbuffer \stop\par + \start \addff{test-b} \getbuffer \stop\par + \start \addff{test-c} \getbuffer \stop\par + \start \addff{test-d} \getbuffer \stop\par + +\stop \blank + \stopsubsection \startsubsection[title={Language dependencies}] @@ -2075,7 +2268,6 @@ fonts.handlers.otf.addfeature { { "down", depth + height }, { "rule", 3*height, width/5 }, - } } -- cgit v1.2.3