* ligature exceptions @ 2017-09-27 12:09 Henning Hraban Ramm 2017-09-27 12:16 ` Thomas Widmann ` (2 more replies) 0 siblings, 3 replies; 32+ messages in thread From: Henning Hraban Ramm @ 2017-09-27 12:09 UTC (permalink / raw) To: mailing list for ConTeXt users Hi all, I know I can break ligatures with \/, like Auf\/lage, but is there a general dictionary approach, like \hyphenation{} ? Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 12:09 ligature exceptions Henning Hraban Ramm @ 2017-09-27 12:16 ` Thomas Widmann 2017-09-27 13:39 ` Thomas A. Schmitz 2017-09-27 13:10 ` Tomas Hala 2017-09-27 17:26 ` Herbert Voss 2 siblings, 1 reply; 32+ messages in thread From: Thomas Widmann @ 2017-09-27 12:16 UTC (permalink / raw) To: mailing list for ConTeXt users On 27 September 2017 at 13:09, Henning Hraban Ramm <texml@fiee.net> wrote: > > I know I can break ligatures with \/, like Auf\/lage, but is there a general > dictionary approach, like \hyphenation{} ? That's a nice idea. If something like that existed, it could be used to change 's' to 'ſ' in relevant places, too. Thomas -- Thomas Widmann Director Complexli Limited +44 789 444 3009 ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 12:16 ` Thomas Widmann @ 2017-09-27 13:39 ` Thomas A. Schmitz 2017-09-27 15:02 ` Florian Grammel 2017-09-27 20:25 ` Henning Hraban Ramm 0 siblings, 2 replies; 32+ messages in thread From: Thomas A. Schmitz @ 2017-09-27 13:39 UTC (permalink / raw) To: ntg >> mailing list for ConTeXt users On 09/27/2017 02:16 PM, Thomas Widmann wrote: > That's a nice idea. If something like that existed, it could be used > to change 's' to 'ſ' in relevant places, too. This exists, see here: https://www.mail-archive.com/ntg-context@ntg.nl/msg79381.html ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 13:39 ` Thomas A. Schmitz @ 2017-09-27 15:02 ` Florian Grammel 2017-09-27 20:25 ` Henning Hraban Ramm 1 sibling, 0 replies; 32+ messages in thread From: Florian Grammel @ 2017-09-27 15:02 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 342 bytes --] There is a LuaLaTeX-package "selnolig" to achieve this goal. Its wordlists and rules could probably be adapted. There is also a thorough discussion of this challenge in the documentation. https://www.ctan.org/pkg/selnolig Best regards, Florian ____________________________________________ Florian Grammel Copenhagen, Denmark [-- Attachment #1.2: Type: text/html, Size: 754 bytes --] [-- Attachment #2: Type: text/plain, Size: 492 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 13:39 ` Thomas A. Schmitz 2017-09-27 15:02 ` Florian Grammel @ 2017-09-27 20:25 ` Henning Hraban Ramm 2017-09-27 21:02 ` Herbert Voss 2017-09-27 21:08 ` Thomas A. Schmitz 1 sibling, 2 replies; 32+ messages in thread From: Henning Hraban Ramm @ 2017-09-27 20:25 UTC (permalink / raw) To: mailing list for ConTeXt users Am 2017-09-27 um 15:39 schrieb Thomas A. Schmitz <thomas.schmitz@uni-bonn.de>: > On 09/27/2017 02:16 PM, Thomas Widmann wrote: >> That's a nice idea. If something like that existed, it could be used >> to change 's' to 'ſ' in relevant places, too. > > This exists, see here: https://www.mail-archive.com/ntg-context@ntg.nl/msg79381.html Thank you for the suggestion. I tried \replaceword[eka][Auflage][Au{fl}age] \setreplacements[eka] and even converted the german wordlist from the selnolig package, but it doesn’t help. If I try \replaceword[eka][Auflage][Au\noligature{fl}age] I get a literal "Au noligature fl age" in my text. Simply Au\noligature{fl}age doesn’t help either. My active features are: \definefontfeature[default] [mode=node,liga=yes,kern=yes,tlig=yes, ccmp=yes,language=dflt, protrusion=quality, expansion=quality] Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 20:25 ` Henning Hraban Ramm @ 2017-09-27 21:02 ` Herbert Voss 2017-09-28 7:24 ` Henning Hraban Ramm 2017-09-27 21:08 ` Thomas A. Schmitz 1 sibling, 1 reply; 32+ messages in thread From: Herbert Voss @ 2017-09-27 21:02 UTC (permalink / raw) To: ntg-context Am 27.09.2017 um 22:25 schrieb Henning Hraban Ramm: > Am 2017-09-27 um 15:39 schrieb Thomas A. Schmitz <thomas.schmitz@uni-bonn.de>: > >> On 09/27/2017 02:16 PM, Thomas Widmann wrote: >>> That's a nice idea. If something like that existed, it could be used >>> to change 's' to 'ſ' in relevant places, too. >> >> This exists, see here: https://www.mail-archive.com/ntg-context@ntg.nl/msg79381.html > > Thank you for the suggestion. > I tried > > \replaceword[eka][Auflage][Au{fl}age] > \setreplacements[eka] > > and even converted the german wordlist from the selnolig package, but it doesn’t help. > If I try > \replaceword[eka][Auflage][Au\noligature{fl}age] > I get a literal "Au noligature fl age" in my text. > > Simply Au\noligature{fl}age doesn’t help either. > > My active features are: > \definefontfeature[default] > [mode=node,liga=yes,kern=yes,tlig=yes, > ccmp=yes,language=dflt, > protrusion=quality, > expansion=quality] > \definefontfeature[default] [mode=node,liga=yes,kern=yes,tlig=yes, ccmp=yes,language=dflt, protrusion=quality, expansion=quality] \replaceword[eka][Auflage][Au{fl}age] \starttext Auflage Au\noligature{fl}age \setreplacements[eka] Auflage \stoptext no problem here, first with ligature the other two without Herbert > > Greetlings, Hraban > --- > http://www.fiee.net > http://wiki.contextgarden.net > GPG Key ID 1C9B22FD > > > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to the Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ > ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 21:02 ` Herbert Voss @ 2017-09-28 7:24 ` Henning Hraban Ramm 0 siblings, 0 replies; 32+ messages in thread From: Henning Hraban Ramm @ 2017-09-28 7:24 UTC (permalink / raw) To: mailing list for ConTeXt users Am 2017-09-27 um 23:02 schrieb Herbert Voss <Herbert.Voss@FU-Berlin.DE>: >> Thank you for the suggestion. >> I tried >> \replaceword[eka][Auflage][Au{fl}age] >> \setreplacements[eka] >> and even converted the german wordlist from the selnolig package, but it doesn’t help. >> If I try >> \replaceword[eka][Auflage][Au\noligature{fl}age] >> I get a literal "Au noligature fl age" in my text. >> Simply Au\noligature{fl}age doesn’t help either. >> My active features are: >> \definefontfeature[default] >> [mode=node,liga=yes,kern=yes,tlig=yes, >> ccmp=yes,language=dflt, >> protrusion=quality, >> expansion=quality] > > \definefontfeature[default] > [mode=node,liga=yes,kern=yes,tlig=yes, > ccmp=yes,language=dflt, > protrusion=quality, > expansion=quality] > > \replaceword[eka][Auflage][Au{fl}age] > > \starttext > Auflage > Au\noligature{fl}age > \setreplacements[eka] > Auflage > \stoptext > > > no problem here, first with ligature the other two without Yes, today it works. Thank you! Didn’t change anything. Strange. Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 20:25 ` Henning Hraban Ramm 2017-09-27 21:02 ` Herbert Voss @ 2017-09-27 21:08 ` Thomas A. Schmitz 2017-09-27 23:16 ` Hans Hagen 1 sibling, 1 reply; 32+ messages in thread From: Thomas A. Schmitz @ 2017-09-27 21:08 UTC (permalink / raw) To: ntg >> mailing list for ConTeXt users On 09/27/2017 10:25 PM, Henning Hraban Ramm wrote: > Thank you for the suggestion. > I tried > > \replaceword[eka][Auflage][Au{fl}age] > \setreplacements[eka] > > and even converted the german wordlist from the selnolig package, but it doesn’t help. Works here. You'll have to make a real example. Thomas ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 21:08 ` Thomas A. Schmitz @ 2017-09-27 23:16 ` Hans Hagen 0 siblings, 0 replies; 32+ messages in thread From: Hans Hagen @ 2017-09-27 23:16 UTC (permalink / raw) To: mailing list for ConTeXt users, Thomas A. Schmitz On 9/27/2017 11:08 PM, Thomas A. Schmitz wrote: > On 09/27/2017 10:25 PM, Henning Hraban Ramm wrote: >> Thank you for the suggestion. >> I tried >> >> \replaceword[eka][Auflage][Au{fl}age] >> \setreplacements[eka] >> >> and even converted the german wordlist from the selnolig package, but >> it doesn’t help. > > > Works here. You'll have to make a real example. I'll add an extra (simple) definition format: \replaceword [eka] [Au{fl}age Shiff{f}ahrt] I leave it to others to collect (reasonable) lists of words. We can these to the distribution then. ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 12:09 ligature exceptions Henning Hraban Ramm 2017-09-27 12:16 ` Thomas Widmann @ 2017-09-27 13:10 ` Tomas Hala 2017-09-27 15:53 ` Ulrike Fischer 2017-09-27 17:26 ` Herbert Voss 2 siblings, 1 reply; 32+ messages in thread From: Tomas Hala @ 2017-09-27 13:10 UTC (permalink / raw) To: mailing list for ConTeXt users Hi Hraban, I am afraid that \/ will break not only the ligature but moreover it will erase the possible breakpoint between f and l. From this point of view, Auf{}lage seems better. General approach might be connected with font some features as Hans shown at ConTeXt Meeting this year. I recorded this case into the list of things we have to keep in mind for testing of free fonts. Best wishes, Tomas Wed, Sep 27, 2017 ve 02:09:50PM +0200 Henning Hraban Ramm napsal(a): # Hi all, # # I know I can break ligatures with \/, like Auf\/lage, but is there a general dictionary approach, like \hyphenation{} ? # # # Greetlings, Hraban # --- # http://www.fiee.net # http://wiki.contextgarden.net # GPG Key ID 1C9B22FD # # ___________________________________________________________________________________ # If your question is of interest to others as well, please add an entry to the Wiki! # # maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context # webpage : http://www.pragma-ade.nl / http://context.aanhet.net # archive : https://bitbucket.org/phg/context-mirror/commits/ # wiki : http://contextgarden.net # ___________________________________________________________________________________ Tomáš Hála -------------------------------------------------------------------- Mendelova univerzita, Provozně ekonomická fakulta, ústav informatiky Zemědělská 1, CZ-613 00 Brno, tel. +420 545 13 22 28 -------------------------------------------------------------------- http://akela.mendelu.cz/~thala ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 13:10 ` Tomas Hala @ 2017-09-27 15:53 ` Ulrike Fischer 2017-09-27 16:13 ` Hans Hagen 0 siblings, 1 reply; 32+ messages in thread From: Ulrike Fischer @ 2017-09-27 15:53 UTC (permalink / raw) To: ntg-context Am Wed, 27 Sep 2017 15:10:33 +0200 schrieb Tomas Hala: > From this point of view, Auf{}lage seems better. This doesn't prevent the ligature: \starttext Auflage Auf{}lage Auf\/lage \stoptext This also documented: "The most important change is that adding a brace group in the middle of a word (like in of{}fice) does not prevent ligature creation." With pdftex it does avoid ligatures, but not reliably. There are cases where the brace group disappear when pdftex tries out hyphenation points. -- Ulrike Fischer http://www.troubleshooting-tex.de/ ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 15:53 ` Ulrike Fischer @ 2017-09-27 16:13 ` Hans Hagen 2017-09-27 20:27 ` Henning Hraban Ramm 0 siblings, 1 reply; 32+ messages in thread From: Hans Hagen @ 2017-09-27 16:13 UTC (permalink / raw) To: ntg-context On 9/27/2017 5:53 PM, Ulrike Fischer wrote: > Am Wed, 27 Sep 2017 15:10:33 +0200 schrieb Tomas Hala: > >> From this point of view, Auf{}lage seems better. > > This doesn't prevent the ligature: > > \starttext > > Auflage Auf{}lage Auf\/lage > > \stoptext > > This also documented: "The most important change is that adding a > brace group in the middle of a word (like in of{}fice) does not > prevent ligature creation." > > With pdftex it does avoid ligatures, but not reliably. There are > cases where the brace group disappear when pdftex tries out > hyphenation points. in traditional tex hyphenation is integrated in the par builder which comes after ligaturing and kerning and tex only hyphenated where it 'makes sense' and in the process (multi-pass, going into disc nodes) it will consult (deconstruct / reconstruct) ligatures and at that point it's not known that the input had a {}. Tricks like inserting something in between is also unreliable when done at the wrong time and it can also prevent for instance kerns of hyphenation. Anyway, in addition to Thomas answer ... we already have this \blockligatures[fi,ff] \blockligatures[fl] \blockligatures[u:fl:age] \definefontfeature[default:nolig][default][blockligatures=yes] \startTEXpage[offset=1em] \definedfont[Serif*default:nolig] fi ff fl auflage \definedfont[Serif*default] fi ff fl auflage \stopTEXpage The \blockligatures[u:fl:age] is new and something of a joke experiment ... I can probably come up with a real advanced and robust mechanism if motivated enough Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 16:13 ` Hans Hagen @ 2017-09-27 20:27 ` Henning Hraban Ramm 2017-09-28 6:40 ` Pablo Rodriguez 0 siblings, 1 reply; 32+ messages in thread From: Henning Hraban Ramm @ 2017-09-27 20:27 UTC (permalink / raw) To: mailing list for ConTeXt users Am 2017-09-27 um 18:13 schrieb Hans Hagen <pragma@wxs.nl>: > Anyway, in addition to Thomas answer ... we already have this > > \blockligatures[fi,ff] \blockligatures[fl] > \blockligatures[u:fl:age] > > \definefontfeature[default:nolig][default][blockligatures=yes] > > \startTEXpage[offset=1em] > \definedfont[Serif*default:nolig] > fi ff fl auflage > \definedfont[Serif*default] > fi ff fl auflage > \stopTEXpage > > The \blockligatures[u:fl:age] is new and something of a joke experiment ... I can probably come up with a real advanced and robust mechanism if motivated enough Thank you, I tried it, and while blocking ligatures generally works (\blockligatures[fl]), the selective blocking (\blockligatures[u:fl:age]) doesn’t change anything. Do you have this only in your local version? Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 20:27 ` Henning Hraban Ramm @ 2017-09-28 6:40 ` Pablo Rodriguez 2017-09-28 7:17 ` Herbert Voss 0 siblings, 1 reply; 32+ messages in thread From: Pablo Rodriguez @ 2017-09-28 6:40 UTC (permalink / raw) To: ntg-context On 09/27/2017 10:27 PM, Henning Hraban Ramm wrote: > Am 2017-09-27 um 18:13 schrieb Hans Hagen <pragma@wxs.nl>: >> [...] >> The \blockligatures[u:fl:age] is new and something of a joke >> experiment ... I can probably come up with a real advanced and robust >> mechanism if motivated enough > > Thank you, I tried it, and while blocking ligatures generally works > (\blockligatures[fl]), the selective blocking > (\blockligatures[u:fl:age]) doesn’t change anything. > Do you have this only in your local version? Hi Hraban, using latest beta (from 2017.09.25 19:19), the following sample works: \starttext \blockligatures[fi,ff] \blockligatures[fl] \blockligatures[u:fl:age, u:fl:eg] \definefontfeature[default:b][default][blockligatures=yes] \setupbodyfont[times]\showfontkerns \startTEXpage[offset=1em] fi ff fl Auflage auflegt \definedfont[Serif*default:b] fi ff fl Auflage auflegt \stopTEXpage \stoptext Just in case it helps, Pablo -- http://www.ousia.tk ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-28 6:40 ` Pablo Rodriguez @ 2017-09-28 7:17 ` Herbert Voss 2017-09-28 11:51 ` Pablo Rodriguez 0 siblings, 1 reply; 32+ messages in thread From: Herbert Voss @ 2017-09-28 7:17 UTC (permalink / raw) To: ntg-context Am 28.09.2017 um 08:40 schrieb Pablo Rodriguez: > using latest beta (from 2017.09.25 19:19), the following sample works: > > \starttext > \blockligatures[fi,ff] \blockligatures[fl] > \blockligatures[u:fl:age, u:fl:eg] > > \definefontfeature[default:b][default][blockligatures=yes] > > \setupbodyfont[times]\showfontkerns > > \startTEXpage[offset=1em] > fi ff fl Auflage auflegt > > \definedfont[Serif*default:b] > fi ff fl Auflage auflegt How do you catch "Aufl." (the abbreviation of Auflage), which is written _with_ a ligature? Herbert > \stopTEXpage > \stoptext > > Just in case it helps, > > Pablo > ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-28 7:17 ` Herbert Voss @ 2017-09-28 11:51 ` Pablo Rodriguez 2017-09-28 13:54 ` Hans Hagen 0 siblings, 1 reply; 32+ messages in thread From: Pablo Rodriguez @ 2017-09-28 11:51 UTC (permalink / raw) To: ntg-context On 09/28/2017 09:17 AM, Herbert Voss wrote: > Am 28.09.2017 um 08:40 schrieb Pablo Rodriguez: > >> using latest beta (from 2017.09.25 19:19), the following sample works: > [...] > How do you catch "Aufl." (the abbreviation of Auflage), > which is written _with_ a ligature? Herbert, I overlooked that \blockligatures[u:fl:age, u:fl:eg] only works if there is also a \blockligatures[fl]. Hans, is this a bug or is it intended? Pablo -- http://www.ousia.tk ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-28 11:51 ` Pablo Rodriguez @ 2017-09-28 13:54 ` Hans Hagen 2017-09-29 6:30 ` Pablo Rodriguez 0 siblings, 1 reply; 32+ messages in thread From: Hans Hagen @ 2017-09-28 13:54 UTC (permalink / raw) To: ntg-context On 9/28/2017 1:51 PM, Pablo Rodriguez wrote: > On 09/28/2017 09:17 AM, Herbert Voss wrote: >> Am 28.09.2017 um 08:40 schrieb Pablo Rodriguez: >> >>> using latest beta (from 2017.09.25 19:19), the following sample works: >> [...] >> How do you catch "Aufl." (the abbreviation of Auflage), >> which is written _with_ a ligature? > > Herbert, > > I overlooked that \blockligatures[u:fl:age, u:fl:eg] only works if there > is also a \blockligatures[fl]. > > Hans, is this a bug or is it intended? do you indeed use the latest beta? anyway, the \replaceword mechanism is a bit more flexible and efficient Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-28 13:54 ` Hans Hagen @ 2017-09-29 6:30 ` Pablo Rodriguez 0 siblings, 0 replies; 32+ messages in thread From: Pablo Rodriguez @ 2017-09-29 6:30 UTC (permalink / raw) To: ntg-context On 09/28/2017 03:54 PM, Hans Hagen wrote: > On 9/28/2017 1:51 PM, Pablo Rodriguez wrote: >> [...] >> I overlooked that \blockligatures[u:fl:age, u:fl:eg] only works if there >> is also a \blockligatures[fl]. >> >> Hans, is this a bug or is it intended? > do you indeed use the latest beta? anyway, the \replaceword mechanism is > a bit more flexible and efficient Hans, after updating to latest beta (from 2017.09.25 19:19 to 2017.09.28 10:07 [I didn’t realize that there was a newer beta yesterday]), it works. Just in case it may be relevant, \blockligatures[u:fl:age] blocks ligatures in auflegt and Aufl. Minimal sample: \starttext \blockligatures[u:fl:age] \definefontfeature[default:b][default][blockligatures=yes] \setupbodyfont[times]\showfontkerns \startTEXpage[offset=1em] fl Auflage auflegt Aufl. \definedfont[Serif*default:b] fl Auflage auflegt Aufl. \stopTEXpage \stoptext Pablo -- http://www.ousia.tk ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-09-27 12:09 ligature exceptions Henning Hraban Ramm 2017-09-27 12:16 ` Thomas Widmann 2017-09-27 13:10 ` Tomas Hala @ 2017-09-27 17:26 ` Herbert Voss 2 siblings, 0 replies; 32+ messages in thread From: Herbert Voss @ 2017-09-27 17:26 UTC (permalink / raw) To: ntg-context Am 27.09.2017 um 14:09 schrieb Henning Hraban Ramm: > > I know I can break ligatures with \/, like Auf\/lage, but is there a general dictionary approach, like \hyphenation{} ? https://ctan.org/tex-archive/macros/luatex/latex/selnolig is a selnolig.lua which could be used for a solution with context. A list of all german words where a ligature should be suppressed is also there. Herbert > > > Greetlings, Hraban > --- > http://www.fiee.net > http://wiki.contextgarden.net > GPG Key ID 1C9B22FD > > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to the Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ > ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
[parent not found: <009E164E-926C-4014-94BC-704EFDFF5228@fiee.net>]
* Fwd: ligature exceptions [not found] <009E164E-926C-4014-94BC-704EFDFF5228@fiee.net> @ 2017-10-06 15:21 ` Henning Hraban Ramm 2017-10-07 11:25 ` Henning Hraban Ramm 0 siblings, 1 reply; 32+ messages in thread From: Henning Hraban Ramm @ 2017-10-06 15:21 UTC (permalink / raw) To: mailing list for ConTeXt users Am 2017-09-28 um 01:16 schrieb Hans Hagen <pragma@wxs.nl>: > On 9/27/2017 11:08 PM, Thomas A. Schmitz wrote: >> On 09/27/2017 10:25 PM, Henning Hraban Ramm wrote: >>> Thank you for the suggestion. >>> I tried >>> >>> \replaceword[eka][Auflage][Au{fl}age] >>> \setreplacements[eka] >>> >>> and even converted the german wordlist from the selnolig package, but it doesn’t help. >> Works here. You'll have to make a real example. > I'll add an extra (simple) definition format: > > \replaceword [eka] [Au{fl}age Shiff{f}ahrt] > > I leave it to others to collect (reasonable) lists of words. We can these to the distribution then. Thank you very much, it works now. Here’s* the converted German wordlist from the selnolig package, still in the "old" single word syntax. I just \input it in my environment. I didn’t measure, but I don’t experience a delay - great! I’ll also add a wiki page about ligatures.** *) The message didn’t make it to the list on the first try, because the attachment was too big. It’s now at http://wiki.contextgarden.net/images/b/be/nolig-german-wordlist.tex **) http://wiki.contextgarden.net/Ligatures Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-10-06 15:21 ` Fwd: " Henning Hraban Ramm @ 2017-10-07 11:25 ` Henning Hraban Ramm 2017-10-07 19:21 ` Pablo Rodriguez 0 siblings, 1 reply; 32+ messages in thread From: Henning Hraban Ramm @ 2017-10-07 11:25 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1: Type: text/plain, Size: 1064 bytes --] I rejoiced too early: While the ligature exception handling works with some of the default fonts (lm, termes, pagella), it fails with the Alegreya fonts that I’m using. I’d be glad if someone (you?) could look into my attached typescript file or even try downloading the fonts* to check what’s going on. *) https://fonts.google.com/?selection.family=Alegreya|Alegreya+SC|Alegreya+Sans|Alegreya+Sans+SC \mainlanguage[de] %\usetypescriptfile [type-alegreya] %\usetypescript [alegreya-light] %\setupbodyfont [alegreya,rm,16pt] \setupbodyfont [termes,rm,16pt] \definefontfeature[default] [mode=node,kern=yes, liga=yes,tlig=yes, ccmp=yes,language=dflt, protrusion=quality, expansion=quality] \replaceword[eka][Auflage][Au{fl}age] \replaceword[eka][Kampffront][Kamp{ff}ront] \starttext falsch: Auflage Kampffront richtig: Au\noligature{fl}age Kamp\noligature{ff}ront \setreplacements[eka] richtig: Auflage Kampffront \stoptext Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD [-- Attachment #2: type-alegreya.tex --] [-- Type: application/octet-stream, Size: 8005 bytes --] \definefontfeature [alefeatures] [mode=node,kern=yes, tlig=yes,liga=yes, ccmp=yes,language=dflt, protrusion=quality, expansion=quality] \starttypescript [sans] [alegreya,alegreya-light,alegreya-medium] %\setups[font:fallback:serif] \definefontsynonym[AlegreyaSans-Thin] [name:AlegreyaSans-Thin] \definefontsynonym[AlegreyaSans-ThinItalic] [name:AlegreyaSans-ThinItalic] \definefontsynonym[AlegreyaSans-ThinCaps] [name:AlegreyaSansSC-Thin] \definefontsynonym[AlegreyaSans-ThinItalicCaps] [name:AlegreyaSansSC-ThinItalic] \definefontsynonym[AlegreyaSans-Light] [name:AlegreyaSans-Light] \definefontsynonym[AlegreyaSans-LightItalic] [name:AlegreyaSans-LightItalic] \definefontsynonym[AlegreyaSans-LightCaps] [name:AlegreyaSansSC-Light] \definefontsynonym[AlegreyaSans-LightItalicCaps] [name:AlegreyaSansSC-LightItalic] \definefontsynonym[AlegreyaSans-Regular] [name:AlegreyaSans-Regular] \definefontsynonym[AlegreyaSans-Italic] [name:AlegreyaSans-Italic] \definefontsynonym[AlegreyaSans-Caps] [name:AlegreyaSansSC-Regular] \definefontsynonym[AlegreyaSans-ItalicCaps] [name:AlegreyaSansSC-Italic] \definefontsynonym[AlegreyaSans-Medium] [name:AlegreyaSans-Medium] \definefontsynonym[AlegreyaSans-MediumItalic] [name:AlegreyaSans-MediumItalic] \definefontsynonym[AlegreyaSans-MediumCaps] [name:AlegreyaSansSC-Medium] \definefontsynonym[AlegreyaSans-MediumItalicCaps] [name:AlegreyaSansSC-MediumItalic] \definefontsynonym[AlegreyaSans-Bold] [name:AlegreyaSans-Bold] \definefontsynonym[AlegreyaSans-BoldItalic] [name:AlegreyaSans-BoldItalic] \definefontsynonym[AlegreyaSans-BoldCaps] [name:AlegreyaSansSC-Bold] \definefontsynonym[AlegreyaSans-BoldItalicCaps] [name:AlegreyaSansSC-BoldItalic] \definefontsynonym[AlegreyaSans-ExtraBold] [name:AlegreyaSans-ExtraBold] \definefontsynonym[AlegreyaSans-ExtraBoldItalic] [name:AlegreyaSans-ExtraBoldItalic] \definefontsynonym[AlegreyaSans-ExtraBoldCaps] [name:AlegreyaSansSC-ExtraBold] \definefontsynonym[AlegreyaSans-ExtraBoldItalicCaps][name:AlegreyaSansSC-ExtraBoldItalic] \definefontsynonym[AlegreyaSans-Black] [name:AlegreyaSans-Black] \definefontsynonym[AlegreyaSans-BlackItalic] [name:AlegreyaSans-BlackItalic] \definefontsynonym[AlegreyaSans-BlackCaps] [name:AlegreyaSansSC-Black] \definefontsynonym[AlegreyaSans-BlackItalicCaps] [name:AlegreyaSansSC-BlackItalic] \stoptypescript \starttypescript [serif] [alegreya] \definefontsynonym[AlegreyaSerif-Regular] [name:Alegreya-Regular] \definefontsynonym[AlegreyaSerif-Italic] [name:Alegreya-Italic] \definefontsynonym[AlegreyaSerif-Caps] [name:AlegreyaSC-Regular] \definefontsynonym[AlegreyaSerif-Bold] [name:Alegreya-Bold] \definefontsynonym[AlegreyaSerif-BoldItalic] [name:Alegreya-BoldItalic] \definefontsynonym[AlegreyaSerif-BoldCaps] [name:AlegreyaSC-Bold] \definefontsynonym[AlegreyaSerif-Black] [name:Alegreya-Black] \definefontsynonym[AlegreyaSerif-BlackItalic] [name:Alegreya-BlackItalic] \definefontsynonym[AlegreyaSerif-BlackCaps] [name:AlegreyaSC-Black] \stoptypescript \starttypescript [sans] [alegreya] [name] %\setups[font:fallback:sans] \definefontsynonym [Sans] [AlegreyaSans-Regular] [features=alefeatures] \definefontsynonym [SansItalic] [AlegreyaSans-Italic] [features=alefeatures] \definefontsynonym [SansSlanted] [AlegreyaSans-Italic] [features=alefeatures] \definefontsynonym [SansBold] [AlegreyaSans-Bold] [features=alefeatures] \definefontsynonym [SansBoldItalic] [AlegreyaSans-BoldItalic] [features=alefeatures] \definefontsynonym [SansBoldSlanted][AlegreyaSans-BoldItalic] [features=alefeatures] \definefontsynonym [SansCaps] [AlegreyaSans-Caps] [features=alefeatures] \definefontsynonym [SansThin] [AlegreyaSans-Thin] [features=alefeatures] \definefontsynonym [SansThinItalic] [AlegreyaSans-ThinItalic][features=alefeatures] \definefontsynonym [SansThinSlanted] [AlegreyaSans-ThinItalic][features=alefeatures] \definefontsynonym [SansThinCaps] [AlegreyaSans-ThinCaps] [features=alefeatures] \definefontsynonym [SansLight] [AlegreyaSans-Light] [features=alefeatures] \definefontsynonym [SansLightItalic] [AlegreyaSans-LightItalic][features=alefeatures] \definefontsynonym [SansLightSlanted] [AlegreyaSans-LightItalic][features=alefeatures] \definefontsynonym [SansLightCaps] [AlegreyaSans-LightCaps] [features=alefeatures] \definefontsynonym [SansMedium] [AlegreyaSans-Medium] [features=alefeatures] \definefontsynonym [SansMediumItalic] [AlegreyaSans-MediumItalic][features=alefeatures] \definefontsynonym [SansMediumSlanted][AlegreyaSans-MediumItalic][features=alefeatures] \stoptypescript \starttypescript [sans] [alegreya-light] [name] \definefontsynonym [Sans] [AlegreyaSans-Light] [features=alefeatures] \definefontsynonym [SansItalic] [AlegreyaSans-LightItalic] [features=alefeatures] \definefontsynonym [SansSlanted] [AlegreyaSans-LightItalic] [features=alefeatures] \definefontsynonym [SansCaps] [AlegreyaSans-LightCaps] [features=alefeatures] \definefontsynonym [SansBold] [AlegreyaSans-Medium] [features=alefeatures] \definefontsynonym [SansBoldItalic] [AlegreyaSans-MediumItalic] [features=alefeatures] \definefontsynonym [SansBoldSlanted][AlegreyaSans-MediumItalic] [features=alefeatures] \stoptypescript \starttypescript [sans] [alegreya-medium] [name] \definefontsynonym [Sans] [AlegreyaSans-Medium] [features=alefeatures] \definefontsynonym [SansItalic] [AlegreyaSans-MediumItalic] [features=alefeatures] \definefontsynonym [SansSlanted] [AlegreyaSans-MediumItalic] [features=alefeatures] \definefontsynonym [SansCaps] [AlegreyaSans-MediumCaps] [features=alefeatures] \definefontsynonym [SansBold] [AlegreyaSans-ExtraBold] [features=alefeatures] \definefontsynonym [SansBoldItalic] [AlegreyaSans-ExtraBoldItalic] [features=alefeatures] \definefontsynonym [SansBoldSlanted][AlegreyaSans-ExtraBoldItalic] [features=alefeatures] \stoptypescript \starttypescript [serif] [alegreya] [name] \definefontsynonym [Serif] [AlegreyaSerif-Regular] [features=alefeatures] \definefontsynonym [SerifItalic] [AlegreyaSerif-Italic] [features=alefeatures] \definefontsynonym [SerifSlanted] [AlegreyaSerif-Italic] [features=alefeatures] \definefontsynonym [SerifBold] [AlegreyaSerif-Bold] [features=alefeatures] \definefontsynonym [SerifBoldItalic] [AlegreyaSerif-BoldItalic] [features=alefeatures] \definefontsynonym [SerifBoldSlanted][AlegreyaSerif-BoldItalic] [features=alefeatures] \definefontsynonym [SerifCaps] [AlegreyaSerif-Caps] [features=alefeatures] \stoptypescript \starttypescript [alegreya] \definetypeface [alegreya] [rm] [serif] [alegreya] [default] \definetypeface [alegreya] [ss] [sans] [alegreya] [default] \definetypeface [alegreya] [tt] [mono] [modern] [default] \definetypeface [alegreya] [mm] [math] [default] [default] \stoptypescript \starttypescript [alegreya-light] \definetypeface [alegreya] [rm] [serif] [alegreya] [default] \definetypeface [alegreya] [ss] [sans] [alegreya-light] [default] \definetypeface [alegreya] [tt] [mono] [modern] [default] \definetypeface [alegreya] [mm] [math] [default] [default] \stoptypescript \starttypescript [alegreya-medium] \definetypeface [alegreya] [rm] [serif] [alegreya] [default] \definetypeface [alegreya] [ss] [sans] [alegreya-medium] [default] \definetypeface [alegreya] [tt] [mono] [modern] [default] \definetypeface [alegreya] [mm] [math] [default] [default] \stoptypescript [-- Attachment #3: Type: text/plain, Size: 492 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-10-07 11:25 ` Henning Hraban Ramm @ 2017-10-07 19:21 ` Pablo Rodriguez 2017-10-07 20:24 ` Henning Hraban Ramm ` (2 more replies) 0 siblings, 3 replies; 32+ messages in thread From: Pablo Rodriguez @ 2017-10-07 19:21 UTC (permalink / raw) To: ntg-context On 10/07/2017 01:25 PM, Henning Hraban Ramm wrote: > I rejoiced too early: > While the ligature exception handling works with some of the default > fonts (lm, termes, pagella), it fails with the Alegreya fonts that I’m > using. The Brill fonts don’t work either (http://www.brill.com/about/brill-fonts). \definefontfamily[mainfont][rm][Alegreya] \definefontfamily[otherfont][rm][Brill] \setupbodyfont [mainfont,16pt] \starttext \startTEXpage[offset=1em] \startbuffer falsch: Auflage Kampffront richtig: Au\noligature{fl}age Kamp\noligature{ff}ront \setreplacements[eka] richtig: Auflage Kampffront f ft fl fk fb ff f f\/t f\/l f\/k f\/b f\/f \resetreplacements \stopbuffer \getbuffer \setupbodyfont[times]\getbuffer \setupbodyfont[otherfont]\getbuffer \stopTEXpage \stoptext Both Alegreya and Brill don’t replace the ligature with a single glyph, but replace the first glyph (only, as far as I know). I don’t know which is the way to solve it, but this might be the cause. Just in case it helps, Pablo -- http://www.ousia.tk ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-10-07 19:21 ` Pablo Rodriguez @ 2017-10-07 20:24 ` Henning Hraban Ramm 2017-10-07 22:14 ` Hans Hagen 2017-10-07 22:22 ` Hans Hagen 2 siblings, 0 replies; 32+ messages in thread From: Henning Hraban Ramm @ 2017-10-07 20:24 UTC (permalink / raw) To: mailing list for ConTeXt users Am 2017-10-07 um 21:21 schrieb Pablo Rodriguez <oinos@gmx.es>: > Both Alegreya and Brill don’t replace the ligature with a single glyph, > but replace the first glyph (only, as far as I know). > > I don’t know which is the way to solve it, but this might be the cause. Oh, yes. Thanks for the analysis. I get the startligature-f also on hyphenation, like in auf-fällig, so that the arc of the first f (that is supposed to touch the second) reaches over the hyphen. Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-10-07 19:21 ` Pablo Rodriguez 2017-10-07 20:24 ` Henning Hraban Ramm @ 2017-10-07 22:14 ` Hans Hagen 2017-10-07 22:44 ` Pablo Rodriguez 2017-10-08 12:16 ` Henning Hraban Ramm 2017-10-07 22:22 ` Hans Hagen 2 siblings, 2 replies; 32+ messages in thread From: Hans Hagen @ 2017-10-07 22:14 UTC (permalink / raw) To: mailing list for ConTeXt users, Pablo Rodriguez On 10/7/2017 9:21 PM, Pablo Rodriguez wrote: > On 10/07/2017 01:25 PM, Henning Hraban Ramm wrote: >> I rejoiced too early: >> While the ligature exception handling works with some of the default >> fonts (lm, termes, pagella), it fails with the Alegreya fonts that I’m >> using. forget about Algreya as it's a useless font ... it has no kerns, no ligatures, no features at all so the f an whatever follows will always touch or overlap due to the design Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-10-07 22:14 ` Hans Hagen @ 2017-10-07 22:44 ` Pablo Rodriguez 2017-10-08 12:16 ` Henning Hraban Ramm 1 sibling, 0 replies; 32+ messages in thread From: Pablo Rodriguez @ 2017-10-07 22:44 UTC (permalink / raw) To: ntg-context On 10/08/2017 12:14 AM, Hans Hagen wrote: > On 10/7/2017 9:21 PM, Pablo Rodriguez wrote: > [...] > forget about Algreya as it's a useless font ... it has no kerns, no > ligatures, no features at all so the f an whatever follows will always > touch or overlap due to the design In fact, the full version is a commercial typeface: https://www.myfonts.com/fonts/huertatipografica/alegreya-ht-pro/. I wonder whether it makes sense to have a free font that only contains the shapes and just nothing more. Pablo -- http://www.ousia.tk ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-10-07 22:14 ` Hans Hagen 2017-10-07 22:44 ` Pablo Rodriguez @ 2017-10-08 12:16 ` Henning Hraban Ramm 1 sibling, 0 replies; 32+ messages in thread From: Henning Hraban Ramm @ 2017-10-08 12:16 UTC (permalink / raw) To: mailing list for ConTeXt users Am 2017-10-08 um 00:14 schrieb Hans Hagen <pragma@wxs.nl>: > On 10/7/2017 9:21 PM, Pablo Rodriguez wrote: >> On 10/07/2017 01:25 PM, Henning Hraban Ramm wrote: >>> I rejoiced too early: >>> While the ligature exception handling works with some of the default >>> fonts (lm, termes, pagella), it fails with the Alegreya fonts that I’m >>> using. > > forget about Algreya as it's a useless font ... it has no kerns, no ligatures, no features at all so the f an whatever follows will always touch or overlap due to the design I can’t agree - it’s beautifully designed, and I can’t complain about its kerning. It also responds to tlig or liga features, even if they’re implemented as single (i.e. not ligature) glyphs (there are e.g. different f glyphs). Maybe it’s set up in a strange way, but I don’t think it’s that bad. Of course I don’t have your level of insight. My problem with Alegreya’s *design* it just that it’s not very well suited for digital printing, it needs a high resolution to look good. Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-10-07 19:21 ` Pablo Rodriguez 2017-10-07 20:24 ` Henning Hraban Ramm 2017-10-07 22:14 ` Hans Hagen @ 2017-10-07 22:22 ` Hans Hagen 2017-10-08 8:37 ` Pablo Rodriguez 2017-10-08 12:17 ` Henning Hraban Ramm 2 siblings, 2 replies; 32+ messages in thread From: Hans Hagen @ 2017-10-07 22:22 UTC (permalink / raw) To: ntg-context On 10/7/2017 9:21 PM, Pablo Rodriguez wrote: > The Brill fonts don’t work either (http://www.brill.com/about/brill-fonts). > > \definefontfamily[mainfont][rm][Alegreya] > \definefontfamily[otherfont][rm][Brill] > \setupbodyfont [mainfont,16pt] > > \starttext > \startTEXpage[offset=1em] > \startbuffer > falsch: Auflage Kampffront > > richtig: Au\noligature{fl}age Kamp\noligature{ff}ront > > \setreplacements[eka] > richtig: Auflage Kampffront > > f ft fl fk fb ff > > f f\/t f\/l f\/k f\/b f\/f > \resetreplacements > \stopbuffer > > \getbuffer > > \setupbodyfont[times]\getbuffer > > \setupbodyfont[otherfont]\getbuffer > \stopTEXpage > \stoptext You need to define features before fonts get defined because we share font definitions and their features as much as possible \startluacode fonts.handlers.otf.addfeature { name = "kernligatures", type = "kern", data = { f = { i = 50, l = 50 }, } } \stopluacode \blockligatures[u:fl:a] Now we can use them \definefontfamily[mainfont][rm][Brill] \definefontfamily[mainfont][tt][Dejavu] \setupbodyfont[mainfont] \definefontfeature[default:b][default][blockligatures=yes] \definefontfeature[default:k][default][blockligatures=yes,kernligatures=yes] \showfontkerns \starttext {\definedfont[Serif*default @ 11pt]auflage}\par {\definedfont[Serif*default:b @ 11pt]auflage}\par {\definedfont[Serif*default:k @ 11pt]auflage}\par \stoptext so, you need to add a kern too because brill assumes ligatures to be applied as usual with tex .. there's always a way out but not always a trivial one and of course all this gets forgotten and/or lost in the flood of solutions Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-10-07 22:22 ` Hans Hagen @ 2017-10-08 8:37 ` Pablo Rodriguez 2017-10-08 12:54 ` Henning Hraban Ramm 2017-10-08 12:17 ` Henning Hraban Ramm 1 sibling, 1 reply; 32+ messages in thread From: Pablo Rodriguez @ 2017-10-08 8:37 UTC (permalink / raw) To: ntg-context On 10/08/2017 12:22 AM, Hans Hagen wrote: > You need to define features before fonts get defined because we share > font definitions and their features as much as possible > > \startluacode > fonts.handlers.otf.addfeature { > name = "kernligatures", > type = "kern", > data = { > f = { i = 50, l = 50 }, > } > } > \stopluacode Many thanks for your reply, Hans. I almost get it all ;-), but what is the "i" variable? Setting different values or even removing doesn’t make any difference (at least, that I notice). Many thanks for your help again, Pablo -- http://www.ousia.tk ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-10-08 8:37 ` Pablo Rodriguez @ 2017-10-08 12:54 ` Henning Hraban Ramm 2017-10-08 16:19 ` Pablo Rodriguez 0 siblings, 1 reply; 32+ messages in thread From: Henning Hraban Ramm @ 2017-10-08 12:54 UTC (permalink / raw) To: mailing list for ConTeXt users Am 2017-10-08 um 10:37 schrieb Pablo Rodriguez <oinos@gmx.es>: > On 10/08/2017 12:22 AM, Hans Hagen wrote: >> You need to define features before fonts get defined because we share >> font definitions and their features as much as possible >> >> \startluacode >> fonts.handlers.otf.addfeature { >> name = "kernligatures", >> type = "kern", >> data = { >> f = { i = 50, l = 50 }, >> } >> } >> \stopluacode > > Many thanks for your reply, Hans. > > I almost get it all ;-), but what is the "i" variable? It defines the kerning between f and i. I also added "f" and "b". And after playing with the values and setting up exceptions I understand now why Hans hates the Alegreya font(s): While the kerning works, the font still uses the long-arced f (that is meant for creating ligatures). I still like the design, but will consider different fonts for upcoming books. Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-10-08 12:54 ` Henning Hraban Ramm @ 2017-10-08 16:19 ` Pablo Rodriguez 0 siblings, 0 replies; 32+ messages in thread From: Pablo Rodriguez @ 2017-10-08 16:19 UTC (permalink / raw) To: ntg-context On 10/08/2017 02:54 PM, Henning Hraban Ramm wrote: > Am 2017-10-08 um 10:37 schrieb Pablo Rodriguez: >> On 10/08/2017 12:22 AM, Hans Hagen wrote: >> Many thanks for your reply, Hans. >> >> I almost get it all ;-), but what is the "i" variable? > > It defines the kerning between f and i. I also added "f" and "b". Many thanks for the replies, both Hans and Hraban. I didn’t notice any change in my sample because I only tested the fl pair. Many thanks for your help, Pablo -- http://www.ousia.tk ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2017-10-07 22:22 ` Hans Hagen 2017-10-08 8:37 ` Pablo Rodriguez @ 2017-10-08 12:17 ` Henning Hraban Ramm 1 sibling, 0 replies; 32+ messages in thread From: Henning Hraban Ramm @ 2017-10-08 12:17 UTC (permalink / raw) To: mailing list for ConTeXt users Am 2017-10-08 um 00:22 schrieb Hans Hagen <pragma@wxs.nl>: > On 10/7/2017 9:21 PM, Pablo Rodriguez wrote: > You need to define features before fonts get defined because we share font definitions and their features as much as possible > > \startluacode > fonts.handlers.otf.addfeature { > name = "kernligatures", > type = "kern", > data = { > f = { i = 50, l = 50 }, > } > } > \stopluacode > > \blockligatures[u:fl:a] > > Now we can use them > > \definefontfamily[mainfont][rm][Brill] > \definefontfamily[mainfont][tt][Dejavu] > > \setupbodyfont[mainfont] > > \definefontfeature[default:b][default][blockligatures=yes] > \definefontfeature[default:k][default][blockligatures=yes,kernligatures=yes] Thank you very much, that helps! I’m working on a set of exceptions... Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* ligature exceptions @ 2021-07-28 17:24 Thomas A. Schmitz via ntg-context 2021-07-28 21:29 ` Hans Hagen via ntg-context 0 siblings, 1 reply; 32+ messages in thread From: Thomas A. Schmitz via ntg-context @ 2021-07-28 17:24 UTC (permalink / raw) To: ntg-context; +Cc: Thomas A. Schmitz Hi all, just two quick questions: a couple of weeks ago, there was a long discussion on ligature exceptions in, e.g., German. Hans provided an elegant new mechanism (\startlanguageoptions). So my two questions: 1. Is the old mechanism (\replaceword[eg][Auflage][Au{fl}age]) now obsolete? I tried using it, but unwanted ligatures still occurred. If it is indeed deprecated, I'll add a note to the wiki (this would mean that the current texlive version does not have the new mechanism and the latest lmtx doesn't use the old one, so that's somewhat problematic). 2. Both mechanisms only work for complete words, is that right? So I can't just provide a pattern such as "uf|forder," I have to provide a full list with all inflected forms: auf|fordern auf|fordert auf|fordernd Auf|forderung Auf|forderungen and for 1-3 also the forms with a capital letter. Thank you! Thomas ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: ligature exceptions 2021-07-28 17:24 Thomas A. Schmitz via ntg-context @ 2021-07-28 21:29 ` Hans Hagen via ntg-context 0 siblings, 0 replies; 32+ messages in thread From: Hans Hagen via ntg-context @ 2021-07-28 21:29 UTC (permalink / raw) To: Thomas A. Schmitz via ntg-context; +Cc: Hans Hagen [-- Attachment #1: Type: text/plain, Size: 2472 bytes --] On 7/28/2021 7:24 PM, Thomas A. Schmitz via ntg-context wrote: > Hi all, > > just two quick questions: a couple of weeks ago, there was a long > discussion on ligature exceptions in, e.g., German. Hans provided an > elegant new mechanism (\startlanguageoptions). So my two questions: > > 1. Is the old mechanism (\replaceword[eg][Auflage][Au{fl}age]) now > obsolete? I tried using it, but unwanted ligatures still occurred. If it > is indeed deprecated, I'll add a note to the wiki (this would mean that > the current texlive version does not have the new mechanism and the > latest lmtx doesn't use the old one, so that's somewhat problematic). it's not too hard to make it work, see attached, but the new one is nicer because it permits more detailed control in luametatex you can do things like Au{\norightligaturing f}lage that is: each character can have a set of options; ok, one can do that with attributes but that is less efficients options have been introduced for ligatures, kerns, expansion etc (you can diff the attached lmt file with the lua file of the same name to see the difference in approach > 2. Both mechanisms only work for complete words, is that right? So I > can't just provide a pattern such as "uf|forder," I have to provide a > full list with all inflected forms: > > auf|fordern > auf|fordert > auf|fordernd > Auf|forderung > Auf|forderungen > > and for 1-3 also the forms with a capital letter. just lowercase will do if you look at the example files you can see that there are pre/post snippets possibel so basically you can create something pre [a|b|c] post which saves some definitions (make we can have pre/post lists which will nicely explode into huge lists but memory is not the issue here) while the replacement works by running over the node list, the second mechanism is using a callback at the hyphenation level (so per language) where each word is anyway checked against an exception list, so in addition that word can now be fed into a function and depending on outcome be fed back into the machinery (there are trackers that give insight in the process) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- [-- Attachment #2: lang-rep.lmt --] [-- Type: text/plain, Size: 16964 bytes --] if not modules then modules = { } end modules ['lang-rep'] = { version = 1.001, comment = "companion to lang-rep.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } -- A BachoTeX 2013 experiment, probably not that useful. Eventually I used a simpler -- more generic example. I'm sure no one ever notices of even needs this code. -- -- As a follow up on a question by Alan about special treatment of dropped caps I wonder -- if I can make this one more clever (probably in a few more dev steps). For instance -- injecting nodes or replacing nodes. It's a prelude to a kind of lpeg for nodes, -- although (given experiences so far) we don't really need that. After all, each problem -- is somewhat unique. local type, tonumber, next = type, tonumber, next local gmatch, gsub = string.gmatch, string.gsub local utfbyte, utfsplit = utf.byte, utf.split local P, C, U, Cc, Ct, Cs, lpegmatch = lpeg.P, lpeg.C, lpeg.patterns.utf8character, lpeg.Cc, lpeg.Ct, lpeg.Cs, lpeg.match local find = string.find local zwnj = 0x200C local grouped = P("{") * ( Ct((U/utfbyte-P("}"))^1) + Cc(false) ) * P("}")-- grouped local splitter = Ct(( #P("{") * ( P("{}") / function() return zwnj end + Ct(Cc("discretionary") * grouped * grouped * grouped) + Ct(Cc("noligature") * grouped) ) + U/utfbyte )^1) local stripper = P("{") * Cs((1-P(-2))^0) * P("}") * P(-1) local trace_replacements = false trackers.register("languages.replacements", function(v) trace_replacements = v end) local trace_details = false trackers.register("languages.replacements.details", function(v) trace_details = v end) local report_replacement = logs.reporter("languages","replacements") local glyph_code = nodes.nodecodes.glyph local glue_code = nodes.nodecodes.glue local spaceskip_code = nodes.gluecodes.spaceskip local xspaceskip_code = nodes.gluecodes.xspaceskip local nuts = nodes.nuts local getnext = nuts.getnext local getprev = nuts.getprev local getattr = nuts.getattr local getid = nuts.getid local getsubtype = nuts.getsubtype local getchar = nuts.getchar local isglyph = nuts.isglyph local setlink = nuts.setlink local setnext = nuts.setnext local setprev = nuts.setprev local setchar = nuts.setchar local setattrlist = nuts.setattrlist local setoptions = nuts.setoptions local glyphoptioncodes = tex.glyphoptioncodes local norightligature_option = glyphoptioncodes.norightligature local noleftligature_option = glyphoptioncodes.noleftligature local insertbefore = nuts.insertbefore local insertafter = nuts.insertafter local remove_node = nuts.remove local copy_node = nuts.copy local flushlist = nuts.flushlist local nodepool = nuts.pool local new_disc = nodepool.disc local texsetattribute = tex.setattribute local unsetvalue = attributes.unsetvalue local enableaction = nodes.tasks.enableaction local v_reset = interfaces.variables.reset local implement = interfaces.implement local processors = typesetters.processors local splitprocessor = processors.split local replacements = languages.replacements or { } languages.replacements = replacements local a_replacements = attributes.private("replacements") local lists = { } local last = 0 local trees = { } table.setmetatableindex(lists,function(lists,name) last = last + 1 local list = { } local data = { name = name, list = list, attribute = last } lists[last] = data lists[name] = data trees[last] = list return data end) lists[v_reset].attribute = unsetvalue -- so we discard 0 -- todo: glue kern attr local function add(root,word,replacement) local processor, replacement = splitprocessor(replacement,true) -- no check replacement = lpegmatch(stripper,replacement) or replacement local list = utfsplit(word) -- ,true) local size = #list for i=1,size do local l = utfbyte(list[i]) if not root[l] then root[l] = { } end if i == size then local special = find(replacement,"{",1,true) local newlist = lpegmatch(splitter,replacement) root[l].final = { word = word, replacement = replacement, processor = processor, oldlength = size, newcodes = newlist, special = special, } end root = root[l] end end function replacements.add(category,word,replacement) local root = lists[category].list if type(word) == "table" then for word, replacement in next, word do add(root,word,replacement) end else add(root,word,replacement or "") end end -- local strip = lpeg.stripper("{}") function languages.replacements.addlist(category,list) local root = lists[category].list if type(list) == "string" then for new in gmatch(list,"%S+") do local old = gsub(new,"[{}]","") -- local old = lpegmatch(strip,new) add(root,old,new) end else for i=1,#list do local new = list[i] local old = gsub(new,"[{}]","") -- local old = lpegmatch(strip,new) add(root,old,new) end end end local function tonodes(list,template) local head, current for i=1,#list do local new = copy_node(template) setchar(new,list[i]) if head then head, current = insertafter(head,current,new) else head, current = new, new end end return head end local is_punctuation = characters.is_punctuation -- We can try to be clever and use the fact that there is no match to skip -- over to the next word but it is gives fuzzy code so for now I removed -- that optimization (when I really need a high performance version myself -- I will look into it (but so far I never used this mechanism myself). -- -- We used to have the hit checker as function but is got messy when checks -- for punctuation was added. local function replace(head,first,last,final,hasspace,overload) local current = first local prefirst = getprev(first) or head local postlast = getnext(last) local oldlength = final.oldlength local newcodes = final.newcodes local newlength = newcodes and #newcodes or 0 if trace_replacements then report_replacement("replacing word %a by %a",final.word,final.replacement) end if hasspace or final.special then -- It's easier to delete and insert so we do just that. On the todo list is -- turn injected spaces into glue but easier might be to let the char break -- handler do that ... local prev = getprev(current) local next = getnext(last) local list = current setnext(last) setlink(prev,next) current = prev if not current then head = nil end local i = 1 while i <= newlength do local codes = newcodes[i] if type(codes) == "table" then local method = codes[1] if method == "discretionary" then local pre, post, replace = codes[2], codes[3], codes[4] if pre then pre = tonodes(pre,first) end if post then post = tonodes(post,first) end if replace then replace = tonodes(replace,first) end -- todo: also set attr local new = new_disc(pre,post,replace) setattrlist(new,first) head, current = insertafter(head,current,new) elseif method == "noligature" then -- not that efficient to copy but ok for testing local list = codes[2] if list then local n = #list for i=1,n do local new = copy_node(first) setchar(new,list[i]) if i == 1 then setoptions(new,norightligature_option) elseif i == n then setoptions(new,glyphoptioncodes.noleftligature | norightligature_option) else setoptions(new,glyphoptioncodes.noleftligature) end head, current = insertafter(head,current,new) end else -- local new = copy_node(first) -- setchar(new,zwnj) -- head, current = insertafter(head,current,new) setoptions(current,norightligature_option) end else report_replacement("unknown method %a",method or "?") end else local new = copy_node(first) setchar(new,codes) head, current = insertafter(head,current,new) end i = i + 1 end flushlist(list) elseif newlength == 0 then -- we overload elseif oldlength == newlength then if final.word ~= final.replacement then for i=1,newlength do setchar(current,newcodes[i]) current = getnext(current) end end current = getnext(final) elseif oldlength < newlength then for i=1,newlength-oldlength do local n = copy_node(current) setchar(n,newcodes[i]) head, current = insertbefore(head,current,n) current = getnext(current) end for i=newlength-oldlength+1,newlength do setchar(current,newcodes[i]) current = getnext(current) end else for i=1,oldlength-newlength do head, current = remove_node(head,current,true) end for i=1,newlength do setchar(current,newcodes[i]) current = getnext(current) end end if overload then overload(final,getnext(prefirst),getprev(postlast)) end return head, postlast end -- we handle just one space function replacements.handler(head) local current = head local overload = attributes.applyoverloads local mode = false -- we're in word or punctuation mode local wordstart = false local wordend = false local prevend = false local prevfinal = false local tree = false local root = false local hasspace = false while current do local id = getid(current) -- or use the char getter if id == glyph_code then local a = getattr(current,a_replacements) if a then -- we have a run tree = trees[a] if tree then local char = getchar(current) local punc = is_punctuation[char] if mode == "punc" then if not punc then if root then local final = root.final if final then head = replace(head,wordstart,wordend,final,hasspace,overload) elseif prevfinal then head = replace(head,wordstart,prevend,prevfinal,hasspace,overload) end prevfinal = false root = false end mode = "word" end elseif mode == "word" then if punc then if root then local final = root.final if final then head = replace(head,wordstart,wordend,final,hasspace,overload) elseif prevfinal then head = replace(head,wordstart,prevend,prevfinal,hasspace,overload) end prevfinal = false root = false end mode = "punc" end else mode = punc and "punc" or "word" end if root then root = root[char] if root then wordend = current end else if prevfinal then head = replace(head,wordstart,prevend,prevfinal,hasspace,overload) prevfinal = false end root = tree[char] if root then wordstart = current wordend = current prevend = false hasspace = false end end else root= false end else tree = false end current = getnext(current) elseif root then local final = root.final if mode == "word" and id == glue_code then local s = getsubtype(current) if s == spaceskip_code or s == xspaceskip_code then local r = root[32] -- maybe more types if r then if not prevend then local f = root.final if f then prevend = wordend prevfinal = f end end wordend = current root = r hasspace = true goto moveon end end end if final then head, current = replace(head,wordstart,wordend,final,hasspace,overload) elseif prevfinal then head, current = replace(head,wordstart,prevend,prevfinal,hasspace,overload) end prevfinal = false root = false ::moveon:: current = getnext(current) else current = getnext(current) end end if root then local final = root.final if final then head = replace(head,wordstart,wordend,final,hasspace,overload) elseif prevfinal then head = replace(head,wordstart,prevend,prevfinal,hasspace,overload) end end return head end local enabled = false function replacements.set(n) if n == v_reset then n = unsetvalue else n = lists[n].attribute if not enabled then enableaction("processors","languages.replacements.handler") if trace_replacements then report_replacement("enabling replacement handler") end enabled = true end end texsetattribute(a_replacements,n) end -- interface implement { name = "setreplacements", actions = replacements.set, arguments = "string" } implement { name = "addreplacements", actions = replacements.add, arguments = "3 strings", } implement { name = "addreplacementslist", actions = replacements.addlist, arguments = "2 strings", } [-- Attachment #3: lang-rep.mkxl --] [-- Type: text/plain, Size: 2278 bytes --] %D \module %D [ file=lang-rep, %D version=2013.04.28, %D title=\CONTEXT\ Language Macros, %D subtitle=Substitution, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. %D As I needed an example of messing with nodes for the bacho\TEX\ tutorial %D I cooked up this. In the end I decided to stick to a simpler example and %D just finished this off in case someone really needs it. \writestatus{loading}{ConTeXt Language Macros / Replacements} \unprotect \registerctxluafile{lang-rep}{autosuffix} \definesystemattribute[replacements][public,global] %D \startluacode %D %D -- todo: other nodes (prelude to more experiments with auto dropped caps) %D %D languages.replacements.add("basics", { %D ["aap"] = "monkey", %D ["noot"] = "nut", %D ["never"] = "forever", %D ["newer"] = "cooler", %D ["new"] = "cool", %D -- ["special"] = "veryspe{>>>}{<<<}{=}cial", %D }) %D %D \stopluacode %D %D \replaceword[more][this][that] %D \replaceword[more][crap][support] %D \replaceword[more][---][—] %D \replaceword[basics][special][veryspe{>>>}{<<<}{=}cial] %D %D \starttyping %D \start \setreplacements[basics] What the heck, it's now or never, isn't it new? \par \stop %D \start \setreplacements[more] Do we --- {\it really} --- need this kind of crap? \par \stop %D \start \setreplacements[basics] All kinds of special thingies! \par \stop %D \start \setreplacements[basics] \hsize1mm special \par \stop %D \stoptyping \permanent\protected\def\setreplacements[#1]% {\clf_setreplacements{#1}} \permanent\protected\def\resetreplacements {\c_attr_replacements\attributeunsetvalue} \permanent\tolerant\protected\def\replaceword[#1]#*[#2]#*[#3]% {\ifarguments\or\or \clf_addreplacementslist{#1}{#2}% \or \clf_addreplacements{#1}{#2}{#3}% \fi} \appendtoks \resetreplacements \to \everyresettypesetting \appendtoks \resetreplacements \to \everyinitializeverbatim \protect \endinput [-- Attachment #4: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 32+ messages in thread
end of thread, other threads:[~2021-07-28 21:29 UTC | newest] Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-09-27 12:09 ligature exceptions Henning Hraban Ramm 2017-09-27 12:16 ` Thomas Widmann 2017-09-27 13:39 ` Thomas A. Schmitz 2017-09-27 15:02 ` Florian Grammel 2017-09-27 20:25 ` Henning Hraban Ramm 2017-09-27 21:02 ` Herbert Voss 2017-09-28 7:24 ` Henning Hraban Ramm 2017-09-27 21:08 ` Thomas A. Schmitz 2017-09-27 23:16 ` Hans Hagen 2017-09-27 13:10 ` Tomas Hala 2017-09-27 15:53 ` Ulrike Fischer 2017-09-27 16:13 ` Hans Hagen 2017-09-27 20:27 ` Henning Hraban Ramm 2017-09-28 6:40 ` Pablo Rodriguez 2017-09-28 7:17 ` Herbert Voss 2017-09-28 11:51 ` Pablo Rodriguez 2017-09-28 13:54 ` Hans Hagen 2017-09-29 6:30 ` Pablo Rodriguez 2017-09-27 17:26 ` Herbert Voss [not found] <009E164E-926C-4014-94BC-704EFDFF5228@fiee.net> 2017-10-06 15:21 ` Fwd: " Henning Hraban Ramm 2017-10-07 11:25 ` Henning Hraban Ramm 2017-10-07 19:21 ` Pablo Rodriguez 2017-10-07 20:24 ` Henning Hraban Ramm 2017-10-07 22:14 ` Hans Hagen 2017-10-07 22:44 ` Pablo Rodriguez 2017-10-08 12:16 ` Henning Hraban Ramm 2017-10-07 22:22 ` Hans Hagen 2017-10-08 8:37 ` Pablo Rodriguez 2017-10-08 12:54 ` Henning Hraban Ramm 2017-10-08 16:19 ` Pablo Rodriguez 2017-10-08 12:17 ` Henning Hraban Ramm 2021-07-28 17:24 Thomas A. Schmitz via ntg-context 2021-07-28 21:29 ` Hans Hagen via ntg-context
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).