ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Selectively supressing ligatures
@ 2015-07-30 13:10 juh
  2015-08-11  6:25 ` Jan U. Hasecke
  0 siblings, 1 reply; 8+ messages in thread
From: juh @ 2015-07-30 13:10 UTC (permalink / raw)
  To: ntg-context

Hi,

I use the package "selnoligs.sty" in LuaLaTeX to selectively suppress
ligatures.

From the selnolig package description:

"The selnolig package suppresses typographic ligatures selectively,
i.e., based on predefined search patterns. The search patterns focus on
ligatures deemed inappropriate because they span morpheme boundaries.
For example, the word shelfful, which is mentioned in the TEXbook as a
word for which the ff ligature might be inappropriate, is automatically
typeset as shelfful rather than as shelfful."


This works with LuaLaTeX:

\documentclass{article}
\usepackage{fontspec}
\usepackage[ngerman]{selnolig}

\begin{document}

Auflage (no ligature)

Abfluss (ligature)

Auffahrt (no ligature)

Schiffe (ligature)

\end{document}


How can I achieve the same in ConTeXt?


This does not work:

\mainlanguage[de]

\starttext
\language[de]

Auflage

Abfluss

Auffahrt

Schiffe

\stoptext


TIA
juh
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Selectively supressing ligatures
  2015-07-30 13:10 Selectively supressing ligatures juh
@ 2015-08-11  6:25 ` Jan U. Hasecke
  2015-08-11  8:19   ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Jan U. Hasecke @ 2015-08-11  6:25 UTC (permalink / raw)
  To: ntg-context

Hi,

I want to follow up on my own message below.

I got the hint offlist that it should not be too difficult to convert a
LaTeX package into a ConTeXt module.

So I guess that there is no built-in functionality of semantical
switching between ligatures and normal characters.

I am not a typographer – maybe I am wrong – but I don't like ligatures
in the wrong places. Inserting ligature stoppers by hand is a tedious work.

The latex package selnoligs was beneficial to me when I made a book with
more than 1000 pages, where I would never managed to stop ligatures by
hand.

So what is your opinion about such a feature?

juh

Am 30.07.2015 um 15:10 schrieb juh:
> Hi,
> 
> I use the package "selnoligs.sty" in LuaLaTeX to selectively suppress
> ligatures.
> 
> From the selnolig package description:
> 
> "The selnolig package suppresses typographic ligatures selectively,
> i.e., based on predefined search patterns. The search patterns focus on
> ligatures deemed inappropriate because they span morpheme boundaries.
> For example, the word shelfful, which is mentioned in the TEXbook as a
> word for which the ff ligature might be inappropriate, is automatically
> typeset as shelfful rather than as shelfful."
> 
> 
> This works with LuaLaTeX:
> 
> \documentclass{article}
> \usepackage{fontspec}
> \usepackage[ngerman]{selnolig}
> 
> \begin{document}
> 
> Auflage (no ligature)
> 
> Abfluss (ligature)
> 
> Auffahrt (no ligature)
> 
> Schiffe (ligature)
> 
> \end{document}
> 
> 
> How can I achieve the same in ConTeXt?
> 
> 
> This does not work:
> 
> \mainlanguage[de]
> 
> \starttext
> \language[de]
> 
> Auflage
> 
> Abfluss
> 
> Auffahrt
> 
> Schiffe
> 
> \stoptext
> 
> 
> TIA
> juh
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Selectively supressing ligatures
  2015-08-11  6:25 ` Jan U. Hasecke
@ 2015-08-11  8:19   ` Hans Hagen
  2015-08-11  9:12     ` Jan U. Hasecke
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2015-08-11  8:19 UTC (permalink / raw)
  To: ntg-context

On 8/11/2015 8:25 AM, Jan U. Hasecke wrote:
> Hi,
>
> I want to follow up on my own message below.
>
> I got the hint offlist that it should not be too difficult to convert a
> LaTeX package into a ConTeXt module.

I don't know but it would probably be a bit alien approach in the 
context code base

> So I guess that there is no built-in functionality of semantical
> switching between ligatures and normal characters.

The official way to do this is:

\starttext
     shel\noligature{ff}ul
\stoptext

which also preserves hyphenation and kerning as well as other tricky 
features that a font provides.

The best place to incorporate such a feature is in the hyphenator but I 
have no time now to do that. So, instead I added a few lines to an 
existing (probably unknown) mechanism:

\replaceword[more][shelfful] [shel{ff}ul]
\replaceword[more][shifffahrt][shi{ff}fahrt]

\starttext
shel\noligature{ff}ul

\setreplacements[more]

shelfful
\stoptext

The downside of the 10 line extension is that it's not the most 
efficient implementation but probably still fast enough.

> I am not a typographer – maybe I am wrong – but I don't like ligatures
> in the wrong places. Inserting ligature stoppers by hand is a tedious work.

I don't like ligatures in most places (why only the few famous ones ... 
a bit imposed tradition limited to old constraints)

> The latex package selnoligs was beneficial to me when I made a book with
> more than 1000 pages, where I would never managed to stop ligatures by
> hand.
>
> So what is your opinion about such a feature?

You can probably make a list of special words and adding that to a 
module is no big deal. I have no time to look into what is around and do 
that myself.

I uploaded a beta.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Selectively supressing ligatures
  2015-08-11  8:19   ` Hans Hagen
@ 2015-08-11  9:12     ` Jan U. Hasecke
  2015-08-11  9:46       ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Jan U. Hasecke @ 2015-08-11  9:12 UTC (permalink / raw)
  To: ntg-context

Hello Hans,

thank you very much for this quick fix.

I'll have to switch to the beta branch to try it out. At least I can now
suppress ligatures with a replacement list, which is enough for now.

As far as I understood selnoligs works with regular expressions (black
magic!). It is very time consuming, but CPU time is cheap. ;-)

Thanks a lot and a nice sunny day.
juh

Am 11.08.15 um 10:19 schrieb Hans Hagen:
> On 8/11/2015 8:25 AM, Jan U. Hasecke wrote:
>> Hi,
>>
>> I want to follow up on my own message below.
>>
>> I got the hint offlist that it should not be too difficult to convert a
>> LaTeX package into a ConTeXt module.
> 
> I don't know but it would probably be a bit alien approach in the
> context code base
> 
>> So I guess that there is no built-in functionality of semantical
>> switching between ligatures and normal characters.
> 
> The official way to do this is:
> 
> \starttext
>     shel\noligature{ff}ul
> \stoptext
> 
> which also preserves hyphenation and kerning as well as other tricky
> features that a font provides.
> 
> The best place to incorporate such a feature is in the hyphenator but I
> have no time now to do that. So, instead I added a few lines to an
> existing (probably unknown) mechanism:
> 
> \replaceword[more][shelfful] [shel{ff}ul]
> \replaceword[more][shifffahrt][shi{ff}fahrt]
> 
> \starttext
> shel\noligature{ff}ul
> 
> \setreplacements[more]
> 
> shelfful
> \stoptext
> 
> The downside of the 10 line extension is that it's not the most
> efficient implementation but probably still fast enough.
> 
>> I am not a typographer – maybe I am wrong – but I don't like ligatures
>> in the wrong places. Inserting ligature stoppers by hand is a tedious
>> work.
> 
> I don't like ligatures in most places (why only the few famous ones ...
> a bit imposed tradition limited to old constraints)
> 
>> The latex package selnoligs was beneficial to me when I made a book with
>> more than 1000 pages, where I would never managed to stop ligatures by
>> hand.
>>
>> So what is your opinion about such a feature?
> 
> You can probably make a list of special words and adding that to a
> module is no big deal. I have no time to look into what is around and do
> that myself.
> 
> I uploaded a beta.
> 
> Hans
> 
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
>                                              | 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Selectively supressing ligatures
  2015-08-11  9:12     ` Jan U. Hasecke
@ 2015-08-11  9:46       ` Hans Hagen
  2015-08-11 10:41         ` Jan U. Hasecke
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2015-08-11  9:46 UTC (permalink / raw)
  To: ntg-context

On 8/11/2015 11:12 AM, Jan U. Hasecke wrote:

> As far as I understood selnoligs works with regular expressions (black
> magic!). It is very time consuming, but CPU time is cheap. ;-)

sure but life is still short so i prefer less runtime over cheap runtime

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Selectively supressing ligatures
  2015-08-11  9:46       ` Hans Hagen
@ 2015-08-11 10:41         ` Jan U. Hasecke
  2015-08-11 11:22           ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Jan U. Hasecke @ 2015-08-11 10:41 UTC (permalink / raw)
  To: ntg-context

Am 11.08.2015 um 11:46 schrieb Hans Hagen:
> On 8/11/2015 11:12 AM, Jan U. Hasecke wrote:
> 
>> As far as I understood selnoligs works with regular expressions (black
>> magic!). It is very time consuming, but CPU time is cheap. ;-)
> 
> sure but life is still short so i prefer less runtime over cheap runtime

Absolutely right:

LuaLaTeX run with selnoligs:

real	18m39.101s
user	18m40.335s
sys	  0m1.624s


LuaLaTeX run without selnoligs:

real	11m50.577s
user	11m51.438s
sys	  0m1.783s

But as I used pandoc in this project I had no chance to correct the
ligatures by hand. And if I had I would have needed seven days instead
of seven minutes more runtime.

But I am offtopic.

Thanks again for the solution.

juh

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Selectively supressing ligatures
  2015-08-11 10:41         ` Jan U. Hasecke
@ 2015-08-11 11:22           ` Hans Hagen
  2015-08-11 13:00             ` Jan U. Hasecke
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2015-08-11 11:22 UTC (permalink / raw)
  To: ntg-context

On 8/11/2015 12:41 PM, Jan U. Hasecke wrote:
> Am 11.08.2015 um 11:46 schrieb Hans Hagen:
>> On 8/11/2015 11:12 AM, Jan U. Hasecke wrote:
>>
>>> As far as I understood selnoligs works with regular expressions (black
>>> magic!). It is very time consuming, but CPU time is cheap. ;-)
>>
>> sure but life is still short so i prefer less runtime over cheap runtime
>
> Absolutely right:
>
> LuaLaTeX run with selnoligs:
>
> real	18m39.101s
> user	18m40.335s
> sys	  0m1.624s
>
>
> LuaLaTeX run without selnoligs:
>
> real	11m50.577s
> user	11m51.438s
> sys	  0m1.783s
>
> But as I used pandoc in this project I had no chance to correct the
> ligatures by hand. And if I had I would have needed seven days instead
> of seven minutes more runtime.

a couple of times 7 minutes i guess -)

> But I am offtopic.

Whatever. In Context it's not that slow. In a worst case your 1000 pages 
are text only which takes 17.91 sec without and 18.95 sec with 
suppression enabled (0.14 s loop overhead), so some 5% extra runtime.

\replaceword[more][slffl][sl{ff}l]
\replaceword[more][slfful][sl{ff}ul]
\replaceword[more][shlfful][shl{ff}ul]
\replaceword[more][shelfful][shel{ff}ul]

\startbuffer
     \testfeatureonce{100}{
         \dorecurse{10} {
             test 1 test 2 test 3 test 4 test 5
             shelfful
             test 6 test 7 test 8 test 9 test 0
         }
         \par
     }
\stopbuffer

\starttext
     \getbuffer \page
     \setreplacements[more]
     \getbuffer
\stoptext

Btw, a 11 minutes baseline sounds like a lot to me.

> Thanks again for the solution.
>
> juh
>
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Selectively supressing ligatures
  2015-08-11 11:22           ` Hans Hagen
@ 2015-08-11 13:00             ` Jan U. Hasecke
  0 siblings, 0 replies; 8+ messages in thread
From: Jan U. Hasecke @ 2015-08-11 13:00 UTC (permalink / raw)
  To: ntg-context

Hans,

it works for me, thank you!

Am 11.08.2015 um 13:22 schrieb Hans Hagen:
> Btw, a 11 minutes baseline sounds like a lot to me.

Yes indeed, xelatex and pdflatex from the same distribution are faster.
I only use lualatex because it is needed for selnoligs. Generally I used
pdflatex or xelatex.

But it looks like I am going to skip to ConTeXt anyway. ;-)

juh


-- 
Das ZEN von Pandoc
Bücher und E-Books einfach und professionell produzieren
http://www.amazon.de/Das-ZEN-von-Pandoc-professionell/dp/1505218799/
Paperback (232 Seiten) und E-Book
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-08-11 13:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-30 13:10 Selectively supressing ligatures juh
2015-08-11  6:25 ` Jan U. Hasecke
2015-08-11  8:19   ` Hans Hagen
2015-08-11  9:12     ` Jan U. Hasecke
2015-08-11  9:46       ` Hans Hagen
2015-08-11 10:41         ` Jan U. Hasecke
2015-08-11 11:22           ` Hans Hagen
2015-08-11 13:00             ` Jan U. Hasecke

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