diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/context/documents/general/qrcs/setup-cs.pdf | bin | 845153 -> 845467 bytes | |||
-rw-r--r-- | doc/context/documents/general/qrcs/setup-de.pdf | bin | 843045 -> 843087 bytes | |||
-rw-r--r-- | doc/context/documents/general/qrcs/setup-en.pdf | bin | 848083 -> 848226 bytes | |||
-rw-r--r-- | doc/context/documents/general/qrcs/setup-fr.pdf | bin | 841724 -> 841945 bytes | |||
-rw-r--r-- | doc/context/documents/general/qrcs/setup-it.pdf | bin | 843463 -> 843541 bytes | |||
-rw-r--r-- | doc/context/documents/general/qrcs/setup-nl.pdf | bin | 840158 -> 840328 bytes | |||
-rw-r--r-- | doc/context/documents/general/qrcs/setup-ro.pdf | bin | 840226 -> 840752 bytes | |||
-rw-r--r-- | doc/context/sources/general/fonts/fonts/fonts-extensions.tex | 194 |
8 files changed, 193 insertions, 1 deletions
diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex 37c7a68fb..a0053d6f5 100644 --- a/doc/context/documents/general/qrcs/setup-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf Binary files differindex 5da0c198c..03475267e 100644 --- a/doc/context/documents/general/qrcs/setup-de.pdf +++ b/doc/context/documents/general/qrcs/setup-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf Binary files differindex 909024974..d1f8f2779 100644 --- a/doc/context/documents/general/qrcs/setup-en.pdf +++ b/doc/context/documents/general/qrcs/setup-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf Binary files differindex dad17cbcf..af01a90e6 100644 --- a/doc/context/documents/general/qrcs/setup-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf Binary files differindex 82212f1ca..f1c34d492 100644 --- a/doc/context/documents/general/qrcs/setup-it.pdf +++ b/doc/context/documents/general/qrcs/setup-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf Binary files differindex 7b65a0afb..c85de095b 100644 --- a/doc/context/documents/general/qrcs/setup-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf Binary files differindex 55a3ade53..1492351bd 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf 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 }, - } } |