ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Summing up ligature prevention tests
@ 2021-03-24 19:24 denis.maier
  2021-03-24 22:16 ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: denis.maier @ 2021-03-24 19:24 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 2385 bytes --]

Hi,
Trying to sum up what we currently have regarding ligature prevention, it looks like we have three mechanisms available:

1. \replaceword[set][input][output]
Ex.: \replaceword[ligs][Auflage][Au{fl}age]
Replaces a word input with the corresponding output.
Doesn't work at the moment with LMTX.
Can be used for words with multiple wrong ligatures (Auflaufform).
Does not take derived forms into account (e.g., replacements for Auflage and Auflagen must both be defined).

2. \blockligatures
Works as a font feature to block certain ligatures
Works also for derived forms of a given word (e.g., \blockligatures[Au:fl:age] will also block the fl-ligature in "Auflagen").
Currently, can't be used when multiple ligatures should be suppressed. \blockligatures[Au:fl:au:ff:orm] blocks the fl-ligature, but the ff-ligature still shows up. This here seems to works though:
\blockligatures [
Au:fl:auf,
au:ff:orm,
]
Don't know if there are unwanted side-effects to that approach.

3. \startexceptions
Works via hyphenation exceptions. To define exceptions for "Auflage" and "Auflaufform" use:
\startexceptions[de]
au{f-}{l}{fl}(f\zwnj l)age
Au{f-}{l}{fl}(f\zwnj l)au{f-}{f}{ff}(f\zwnj f)orm
\stopexceptions

This does not work automatically for derived forms; you'll have to define plural and other forms as well.
As this works with hyphenation exceptions you'll have to add legal hyphenation points as well, so for "Auflage", you will actually need:
\startexceptions[de]
au{f-}{l}{fl}(f\zwnj l)a-ge
\stopexceptions

IMO, the \blockligatures is the cleanest, both conceptually and syntax wise. Being able to implicitely disable derived forms is a big plus, but of course there may be drawbacks I don't see now. The only downsides I see currently is that you need workarounds to block multiple ligatures in a single words, of which there might not be too many. And, it's kind of an "all or nothing" approach as you cannot define sets of blocked ligatures. (But that may not be a relevant use case anyway.)

Anything, I've missed? Other aspects to think about here? How about performance issues? (The blockligatures-mechanism resulted in this: with a word list of about 2200 words it took a bit more than five seconds to process 23 A5 pages than 2.5 seconds without the blocked ligatures. I'll test with the other methods later or tomorrow.)

Denis




[-- Attachment #1.2: Type: text/html, Size: 5869 bytes --]

[-- Attachment #2: 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] 6+ messages in thread

* Re: Summing up ligature prevention tests
  2021-03-24 19:24 Summing up ligature prevention tests denis.maier
@ 2021-03-24 22:16 ` Hans Hagen
  2021-03-24 22:43   ` denis.maier
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2021-03-24 22:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users, denis.maier

On 3/24/2021 8:24 PM, denis.maier@ub.unibe.ch wrote:

> Anything, I've missed? Other aspects to think about here? How about 
> performance issues? (The blockligatures-mechanism resulted in this: with 
> a word list of about 2200 words it took a bit more than five seconds to 
> process 23 A5 pages than 2.5 seconds without the blocked ligatures. I'll 
> test with the other methods later or tomorrow.)
of course there is always more:

\starttext

     {effie}
     {ef{\norightligaturing f}ie}
     {ef{\noleftligaturing f}ie}
     {ef{\noleftligaturing\norightligaturing f}ie}
     {ef{\noligaturing f}ie}
     {\noligaturing effie}

\stoptext

(con)tex(t) is all about control (and secret features),

(and yes: there's also \noleftkerning etc)

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] 6+ messages in thread

* Re: Summing up ligature prevention tests
  2021-03-24 22:16 ` Hans Hagen
@ 2021-03-24 22:43   ` denis.maier
  2021-03-25 10:01     ` Hans Hagen
  2021-03-25 12:09     ` Hans Hagen
  0 siblings, 2 replies; 6+ messages in thread
From: denis.maier @ 2021-03-24 22:43 UTC (permalink / raw)
  To: j.hagen, ntg-context

So, what's the general recommendation? Which approach is the best in your opinion? (In case it's the \replaceword approach: do you think you'll have time to look into this?) 

I've seen in an older thread that the best way to deal with this would be in the hyphenator. What do you think about this now, a couple of years later?

And, while we're at it: how do you deal with words like "begrifflich" where you'll want the ff ligature, but not the ffl ligature.
I've tried this
\replaceword[ligs][begrifflich][begri{ffl}ich]
But this breaks the ligature completely. 
\replaceword[ligs][begrifflich][begrif{fl}ich] is not correct either (doesn't do anything).

Or with exceptions:
\startexceptions[de]
begri{ff-}{l}{ffl}(ff\zwnj l)ich
\stopexceptions

But that also breaks the ligature completely.

Denis

> -----Ursprüngliche Nachricht-----
> Von: Hans Hagen <j.hagen@xs4all.nl>
> Gesendet: Mittwoch, 24. März 2021 23:16
> An: mailing list for ConTeXt users <ntg-context@ntg.nl>; Maier, Denis
> Christian (UB) <denis.maier@ub.unibe.ch>
> Betreff: Re: [NTG-context] Summing up ligature prevention tests
> 
> On 3/24/2021 8:24 PM, denis.maier@ub.unibe.ch wrote:
> 
> > Anything, I've missed? Other aspects to think about here? How about
> > performance issues? (The blockligatures-mechanism resulted in this:
> > with a word list of about 2200 words it took a bit more than five
> > seconds to process 23 A5 pages than 2.5 seconds without the blocked
> > ligatures. I'll test with the other methods later or tomorrow.)
> of course there is always more:
> 
> \starttext
> 
>      {effie}
>      {ef{\norightligaturing f}ie}
>      {ef{\noleftligaturing f}ie}
>      {ef{\noleftligaturing\norightligaturing f}ie}
>      {ef{\noligaturing f}ie}
>      {\noligaturing effie}
> 
> \stoptext
> 
> (con)tex(t) is all about control (and secret features),
> 
> (and yes: there's also \noleftkerning etc)
> 
> 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] 6+ messages in thread

* Re: Summing up ligature prevention tests
  2021-03-24 22:43   ` denis.maier
@ 2021-03-25 10:01     ` Hans Hagen
  2021-03-25 10:57       ` denis.maier
  2021-03-25 12:09     ` Hans Hagen
  1 sibling, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2021-03-25 10:01 UTC (permalink / raw)
  To: denis.maier, ntg-context

On 3/24/2021 11:43 PM, denis.maier@ub.unibe.ch wrote:
> So, what's the general recommendation? Which approach is the best in your opinion? (In case it's the \replaceword approach: do you think you'll have time to look into this?)
> 
> I've seen in an older thread that the best way to deal with this would be in the hyphenator. What do you think about this now, a couple of years later?
> 
> And, while we're at it: how do you deal with words like "begrifflich" where you'll want the ff ligature, but not the ffl ligature.
> I've tried this
> \replaceword[ligs][begrifflich][begri{ffl}ich]
> But this breaks the ligature completely.
> \replaceword[ligs][begrifflich][begrif{fl}ich] is not correct either (doesn't do anything).
> 
> Or with exceptions:
> \startexceptions[de]
> begri{ff-}{l}{ffl}(ff\zwnj l)ich
> \stopexceptions
> 
> But that also breaks the ligature completely.
Todays secret:

\starttext

\registerhyphenationpattern[nl][e1ë/e=e]
\registerhyphenationpattern[nl][a9atje./a=t,1,3]
\registerhyphenationpattern[en][eigh1tee/t=t,5,1]
\registerhyphenationpattern[de][c1k/k=k]
\registerhyphenationpattern[de][schif1f/ff=f,5,2]

\starthyphenation[traditional]
     \starttabulate[|||]
         \NC reëel      \NC \language[nl]\hyphenatedcoloredword{reëel} 
     \NC \NR
         \NC omaatje    \NC \language[nl]\hyphenatedcoloredword{omaatje} 
    \NC \NR
         \NC eighteen   \NC 
\language[en]\hyphenatedcoloredword{eighteen}   \NC \NR
         \NC Zucker     \NC \language[de]\hyphenatedcoloredword{Zucker} 
     \NC \NR
         \NC Schiffahrt \NC 
\language[de]\hyphenatedcoloredword{Schiffahrt} \NC \NR
     \stoptabulate
\stophyphenation

\stoptext

I think only Pablo ever used this variant. And yes, it's actually 
documented in a manual. But it's old code thay I might want to update to 
be more lmtx-ish.

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] 6+ messages in thread

* Re: Summing up ligature prevention tests
  2021-03-25 10:01     ` Hans Hagen
@ 2021-03-25 10:57       ` denis.maier
  0 siblings, 0 replies; 6+ messages in thread
From: denis.maier @ 2021-03-25 10:57 UTC (permalink / raw)
  To: j.hagen, ntg-context

> -----Ursprüngliche Nachricht-----
> Von: Hans Hagen <j.hagen@xs4all.nl>
> Gesendet: Donnerstag, 25. März 2021 11:02
> An: Maier, Denis Christian (UB) <denis.maier@ub.unibe.ch>; ntg-
> context@ntg.nl
> Betreff: Re: AW: [NTG-context] Summing up ligature prevention tests
> 
> On 3/24/2021 11:43 PM, denis.maier@ub.unibe.ch wrote:
> > So, what's the general recommendation? Which approach is the best in
> > your opinion? (In case it's the \replaceword approach: do you think
> > you'll have time to look into this?)
> >
> > I've seen in an older thread that the best way to deal with this would be in
> the hyphenator. What do you think about this now, a couple of years later?
> >
> > And, while we're at it: how do you deal with words like "begrifflich" where
> you'll want the ff ligature, but not the ffl ligature.
> > I've tried this
> > \replaceword[ligs][begrifflich][begri{ffl}ich]
> > But this breaks the ligature completely.
> > \replaceword[ligs][begrifflich][begrif{fl}ich] is not correct either (doesn't do
> anything).
> >
> > Or with exceptions:
> > \startexceptions[de]
> > begri{ff-}{l}{ffl}(ff\zwnj l)ich
> > \stopexceptions
> >
> > But that also breaks the ligature completely.
> Todays secret:
> 
> \starttext
> 
> \registerhyphenationpattern[nl][e1ë/e=e]
> \registerhyphenationpattern[nl][a9atje./a=t,1,3]
> \registerhyphenationpattern[en][eigh1tee/t=t,5,1]
> \registerhyphenationpattern[de][c1k/k=k]
> \registerhyphenationpattern[de][schif1f/ff=f,5,2]
> 
> \starthyphenation[traditional]
>      \starttabulate[|||]
>          \NC reëel      \NC \language[nl]\hyphenatedcoloredword{reëel}
>      \NC \NR
>          \NC omaatje    \NC \language[nl]\hyphenatedcoloredword{omaatje}
>     \NC \NR
>          \NC eighteen   \NC
> \language[en]\hyphenatedcoloredword{eighteen}   \NC \NR
>          \NC Zucker     \NC \language[de]\hyphenatedcoloredword{Zucker}
>      \NC \NR
>          \NC Schiffahrt \NC
> \language[de]\hyphenatedcoloredword{Schiffahrt} \NC \NR
>      \stoptabulate
> \stophyphenation
> 
> \stoptext
> 
> I think only Pablo ever used this variant. And yes, it's actually documented in
> a manual. But it's old code thay I might want to update to be more lmtx-ish.
> 
> Hans

Yes, that's in the "languages" manual. But I don't understand how this will help with the ligatures?

\registerhyphenationpattern[de][.begriff1l/ff=l,6,3] Gives me correct hyphenation of begrifflich, but has no effect on ligatures (see below).

Denis


\starttext

\registerhyphenationpattern[de][.begriff1l/ff=l,6,3]

\starthyphenation[traditional]
\language[de] begrifflich \hyphenatedcoloredword{begrifflich}

\stophyphenation

\language[de] begrifflich \hyphenatedcoloredword{begrifflich}

\stoptext
___________________________________________________________________________________
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] 6+ messages in thread

* Re: Summing up ligature prevention tests
  2021-03-24 22:43   ` denis.maier
  2021-03-25 10:01     ` Hans Hagen
@ 2021-03-25 12:09     ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2021-03-25 12:09 UTC (permalink / raw)
  To: denis.maier, ntg-context

On 3/24/2021 11:43 PM, denis.maier@ub.unibe.ch wrote:
> So, what's the general recommendation? Which approach is the best in your opinion? (In case it's the \replaceword approach: do you think you'll have time to look into this?)
> 
> I've seen in an older thread that the best way to deal with this would be in the hyphenator. What do you think about this now, a couple of years later?
> 
> And, while we're at it: how do you deal with words like "begrifflich" where you'll want the ff ligature, but not the ffl ligature.
> I've tried this
> \replaceword[ligs][begrifflich][begri{ffl}ich]
> But this breaks the ligature completely.
> \replaceword[ligs][begrifflich][begrif{fl}ich] is not correct either (doesn't do anything).
> 
> Or with exceptions:
> \startexceptions[de]
> begri{ff-}{l}{ffl}(ff\zwnj l)ich
> \stopexceptions
> 
> But that also breaks the ligature completely.
only in lmtx ... i'll check it (probably some interference with compact 
fonts mode)

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] 6+ messages in thread

end of thread, other threads:[~2021-03-25 12:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24 19:24 Summing up ligature prevention tests denis.maier
2021-03-24 22:16 ` Hans Hagen
2021-03-24 22:43   ` denis.maier
2021-03-25 10:01     ` Hans Hagen
2021-03-25 10:57       ` denis.maier
2021-03-25 12:09     ` Hans Hagen

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).