Re: [NTG-context] Writing to .tuc directly from Lua

2021-03-24 Thread Jairo A. del Rio
El mié, 24 de mar. de 2021 a la(s) 16:47, Hans Hagen (j.ha...@xs4all.nl)
escribió:

> On 3/24/2021 6:33 PM, Jairo A. del Rio wrote:
> > Hi, Hans. Here's my (miserably failing) attempt:
> >
> > \definedataset[nicedata]
> >
> > \starttext
> >
> > \startluacode
> >
> > local name = "nicedata"
> >
> >
> > -- For exposition only
> >
> > local function dofactorial(n)
> >
> > local function inner(c,m)
> >
> > if m<2 then return c end
> >
> > return inner(c*m, m-1)
> >
> > end
> >
> > return inner(1,n)
> >
> > end
> >
> >
> > local function factorial(n)
> >
> > local stringn = tostring(n)
> >
> > if job.datasets.collected[name] then
> >
> > return job.datasets.collected[name].factorial[stringn]
> >
> > else
> >
> > local mydata = {[stringn] = tostring(dofactorial(n))}
> >
> > job.datasets.setdata{
> >
> > name = name,
> >
> > tag = "factorial",
> >
> > data = mydata
> >
> > }
> >
> > return mydata[stringn]
> >
> > end
> >
> > end
> >
> >
> > interfaces.implement{
> >
> > name = "factorial",
> >
> > public = true,
> >
> > arguments = {"string"},
> >
> > actions = {tonumber, factorial, context}
> >
> > }
> >
> >
> > \stopluacode
> >
> > \factorial{7}
> >
> > \stoptext
> >
> >
> > What happens is that, in each run, both the first and the second
> > conditions are met, so the compilation is twice as slow, the opposite
> > result of what I meant to do. How do I fix that?
>
> \definedataset[nicedata]
>
> \starttext
>
> \startluacode
>
> local function dofactorial(n)
> local function inner(c,m)
> if m < 2 then
>  return c
>  else
>  return inner(c*m, m-1)
>  end
> end
> return inner(1,n)
> end
>
> local function factorial(n)
>  local data = job.datasets.getdata("factorials","list")
>  if not data then
>  data = { }
>  end
>  local f = data[n]
>  if not f then
> f = dofactorial(n)
>  data[n] = f
>  end
>  job.datasets.setdata {
>  name = "factorials",
>  tag  = "list",
>  data = data
>  }
>  return f
> end
>
> interfaces.implement{
> name  = "factorial",
> public= true,
> arguments = { "integer" },
> actions   = { factorial, context }
> }
>
> \stopluacode
>
> \dorecurse {20} {
>  \factorial #1 \relax
> }
>
> \stoptext
>
>
It does exactly what I need. It's good to know datasets can be directly
generated, too. Thank you a lot!


> but you probably don't gain much as these factorials are not that slow
> (if you use them many times in a document you can just cache them)
>
>
It was only a toy example. I intend to work with way larger numbers. :)


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

Best regards,

Jairo
___
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
___


Re: [NTG-context] Summing up ligature prevention tests

2021-03-24 Thread denis.maier
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 
> Gesendet: Mittwoch, 24. März 2021 23:16
> An: mailing list for ConTeXt users ; Maier, Denis
> Christian (UB) 
> Betreff: Re: [NTG-context] Summing up ligature prevention tests
> 
> On 3/24/2021 8:24 PM, denis.ma...@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
___


Re: [NTG-context] Summing up ligature prevention tests

2021-03-24 Thread Hans Hagen

On 3/24/2021 8:24 PM, denis.ma...@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
___


Re: [NTG-context] Writing to .tuc directly from Lua

2021-03-24 Thread Hans Hagen

On 3/24/2021 6:33 PM, Jairo A. del Rio wrote:

Hi, Hans. Here's my (miserably failing) attempt:

\definedataset[nicedata]

\starttext

\startluacode

local name = "nicedata"


-- For exposition only

local function dofactorial(n)

local function inner(c,m)

if m<2 then return c end

return inner(c*m, m-1)

end

return inner(1,n)

end


local function factorial(n)

local stringn = tostring(n)

if job.datasets.collected[name] then

return job.datasets.collected[name].factorial[stringn]

else

local mydata = {[stringn] = tostring(dofactorial(n))}

job.datasets.setdata{

name = name,

tag = "factorial",

data = mydata

}

return mydata[stringn]

end

end


interfaces.implement{

name = "factorial",

public = true,

arguments = {"string"},

actions = {tonumber, factorial, context}

}


\stopluacode

\factorial{7}

\stoptext


What happens is that, in each run, both the first and the second 
conditions are met, so the compilation is twice as slow, the opposite 
result of what I meant to do. How do I fix that?


\definedataset[nicedata]

\starttext

\startluacode

local function dofactorial(n)
local function inner(c,m)
if m < 2 then
return c
else
return inner(c*m, m-1)
end
end
return inner(1,n)
end

local function factorial(n)
local data = job.datasets.getdata("factorials","list")
if not data then
data = { }
end
local f = data[n]
if not f then
f = dofactorial(n)
data[n] = f
end
job.datasets.setdata {
name = "factorials",
tag  = "list",
data = data
}
return f
end

interfaces.implement{
name  = "factorial",
public= true,
arguments = { "integer" },
actions   = { factorial, context }
}

\stopluacode

\dorecurse {20} {
\factorial #1 \relax
}

\stoptext

but you probably don't gain much as these factorials are not that slow 
(if you use them many times in a document you can just cache them)


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
___


Re: [NTG-context] Another bug with ligature-blocking?

2021-03-24 Thread Hans Hagen

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

-Ursprüngliche Nachricht-
Von: Hans Hagen 
Gesendet: Mittwoch, 24. März 2021 17:42
An: mailing list for ConTeXt users ; Maier, Denis
Christian (UB) 
Betreff: Re: [NTG-context] Another bug with ligature-blocking?

On 3/24/2021 4:48 PM, denis.ma...@ub.unibe.ch wrote:


\definefontfamily[times][rm][Times New Roman]

don't assume beforehand that something that doesn't work as expected is a
bug


Sorry, Hans, I didn't mean to be offensive.


it has more to do with searching for solutions using the subjects of 
mail ... in which case 'bug' is not a good one




the font just has no ligatures defined which you can remedy (in this
cae) with because it does have the glyphs

\startluacode
  fonts.handlers.otf.addfeature {
  name = "moreligatures",
  type = "ligature",
  data = {
  ['ff'] = { "f", "f" },
  ['fi'] = { "f", "i" },
  ['fl'] = { "f", "l" },
  }
  }
\stopluacode


\blockligatures[begrif:fl:ich]
\definefontfeature[default][default][dlig=yes,liga=yes,moreligatures=yes]
\definefontfamily[times][rm][Times New Roman]
\definefontfamily[termes[rm][TeX Gyre Termes]

\definefontfeature[default:block][default][blockligatures=yes]

\starttext

{\switchtobodyfont[times] \definedfont[Serif*default]begrifflich
ff fi fl\blank
\definedfont[Serif*default:block] begrifflich ff fi 
fl\blank}
{\switchtobodyfont[termes]\definedfont[Serif*default]begrifflich
ff fi fl\blank
\definedfont[Serif*default:block] begrifflich ff fi 
fl\blank}

\stoptext



I'm not sure I understand what is going on here. I thought \blockligatures 
simply means that instead of a ligature you'll have the regular glyphs in the 
output. Is that not correct?
sure but times doesn't have these ligatures (it has the shapes but not 
the features)


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
___


Re: [NTG-context] Writing to .tuc directly from Lua

2021-03-24 Thread Jairo A. del Rio
No, no actually. I only put a toy example. What I need to solve is related
with storing data in the .tuc file when processes take a long time.
Memoization doesn't work as data is lost with each new run.

Jairo

El mié, 24 de mar. de 2021 a la(s) 15:36, Aditya Mahajan (adit...@umich.edu)
escribió:

> On Wed, 24 Mar 2021, Jairo A. del Rio wrote:
>
> > Hi, Hans. Here's my (miserably failing) attempt:
> >
> > \definedataset[nicedata]
> >
> > \starttext
> >
> > \startluacode
> >
> > local name = "nicedata"
> >
> >
> > -- For exposition only
> >
> > local function dofactorial(n)
> >
> > local function inner(c,m)
> >
> > if m<2 then return c end
> >
> > return inner(c*m, m-1)
> >
> > end
> >
> > return inner(1,n)
> >
> > end
>
> Is this an example or your actual use case? In case you want to just
> compute the factorial without doing tail recursion:
>
> function factorial(n)
>   local product = 1
>   for i = 1,n do
> product = product * i
>   end
>   return product
> end
>
> is reasonable fast (for values of n for which factorial(n) doesn't
> overflow anyways).
>
> Aditya
>
___
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
___


[NTG-context] Summing up ligature prevention tests

2021-03-24 Thread denis.maier
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



___
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
___


Re: [NTG-context] Another bug with ligature-blocking?

2021-03-24 Thread denis.maier
> -Ursprüngliche Nachricht-
> Von: Hans Hagen 
> Gesendet: Mittwoch, 24. März 2021 17:42
> An: mailing list for ConTeXt users ; Maier, Denis
> Christian (UB) 
> Betreff: Re: [NTG-context] Another bug with ligature-blocking?
> 
> On 3/24/2021 4:48 PM, denis.ma...@ub.unibe.ch wrote:
> 
> > \definefontfamily[times][rm][Times New Roman]
> don't assume beforehand that something that doesn't work as expected is a
> bug

Sorry, Hans, I didn't mean to be offensive.

> 
> the font just has no ligatures defined which you can remedy (in this
> cae) with because it does have the glyphs
> 
> \startluacode
>  fonts.handlers.otf.addfeature {
>  name = "moreligatures",
>  type = "ligature",
>  data = {
>  ['ff'] = { "f", "f" },
>  ['fi'] = { "f", "i" },
>  ['fl'] = { "f", "l" },
>  }
>  }
> \stopluacode
> 
> 
> \blockligatures[begrif:fl:ich]
> \definefontfeature[default][default][dlig=yes,liga=yes,moreligatures=yes]
> \definefontfamily[times][rm][Times New Roman]
> \definefontfamily[termes[rm][TeX Gyre Termes]
> 
> \definefontfeature[default:block][default][blockligatures=yes]
> 
> \starttext
> 
> {\switchtobodyfont[times] \definedfont[Serif*default]begrifflich
> ff fi fl\blank
>\definedfont[Serif*default:block] begrifflich ff 
> fi fl\blank}
> {\switchtobodyfont[termes]\definedfont[Serif*default]begrifflich
> ff fi fl\blank
>\definedfont[Serif*default:block] begrifflich ff 
> fi fl\blank}
> 
> \stoptext
>

I'm not sure I understand what is going on here. I thought \blockligatures 
simply means that instead of a ligature you'll have the regular glyphs in the 
output. Is that not correct?

Denis
___
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
___


Re: [NTG-context] PDF custom properties

2021-03-24 Thread Pablo Rodriguez
On 3/23/21 10:12 PM, Alan Bowen wrote:
> Hi, Pablo—
>
> My inquiry concerns the possibility of getting *custom* properties that
> I could specify using \setupinteraction in a way that would output in
> the PDF file (under Document Info or Document Properties) as:
>
> Editor (not Author)                   editors names                    
>           
> Title                                         title of work
> Subtitle (not Subject)                the subtitle of the work 
> Subject                                     the subject of the work  
> Keyword                                    keywords
>
> See https://wiki.contextgarden.net/Interaction PDF Header and Custom
> Properties.

Hi Alan,

it seems that the key field cannot contain spaces. So it should read:

  \pdfbackendsetinfo{key}{ Text }

Otherwise, Acrobat Reader (both latest DC in Windows and version 9.5 in
Linux) cannot open the document.

And the information is displayed in the custom tab from document
properties, not in the description tab.

Here is an image of the dialog:

https://community.adobe.com/legacyfs/online/1160244_PDF%20Document%20Properties%20Example.JPG

Acrobat Reader version 9.5 doesn’t contain that tab and it cannot
display the field.

I hope it helps now,

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
___


Re: [NTG-context] Writing to .tuc directly from Lua

2021-03-24 Thread Jairo A. del Rio
Hi, Hans. Here's my (miserably failing) attempt:

\definedataset[nicedata]

\starttext

\startluacode

local name = "nicedata"


-- For exposition only

local function dofactorial(n)

local function inner(c,m)

if m<2 then return c end

return inner(c*m, m-1)

end

return inner(1,n)

end


local function factorial(n)

local stringn = tostring(n)

if job.datasets.collected[name] then

return job.datasets.collected[name].factorial[stringn]

else

local mydata = {[stringn] = tostring(dofactorial(n))}

job.datasets.setdata{

name = name,

tag = "factorial",

data = mydata

}

return mydata[stringn]

end

end


interfaces.implement{

name = "factorial",

public = true,

arguments = {"string"},

actions = {tonumber, factorial, context}

}


\stopluacode

\factorial{7}

\stoptext


What happens is that, in each run, both the first and the second conditions
are met, so the compilation is twice as slow, the opposite result of what I
meant to do. How do I fix that?

Jairo

El mié, 24 de mar. de 2021 a la(s) 01:38, Hans Hagen (j.ha...@xs4all.nl)
escribió:

> On 3/24/2021 5:20 AM, Jairo A. del Rio wrote:
> > Thank you very much. It's useful, indeed. However, what I need is to
> > bypass TeX (Lua > .tuc) if possible, since all the data I need to handle
> > is generated with Lua scripts.
> datasets-001.tex in the test suite
>
>
> -
>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
___


Re: [NTG-context] Another bug with ligature-blocking?

2021-03-24 Thread Hans Hagen

On 3/24/2021 4:48 PM, denis.ma...@ub.unibe.ch wrote:


\definefontfamily[times][rm][Times New Roman]
don't assume beforehand that something that doesn't work as expected is 
a bug


the font just has no ligatures defined which you can remedy (in this 
cae) with because it does have the glyphs


\startluacode
fonts.handlers.otf.addfeature {
name = "moreligatures",
type = "ligature",
data = {
['ff'] = { "f", "f" },
['fi'] = { "f", "i" },
['fl'] = { "f", "l" },
}
}
\stopluacode


\blockligatures[begrif:fl:ich]
\definefontfeature[default][default][dlig=yes,liga=yes,moreligatures=yes]
\definefontfamily[times][rm][Times New Roman]
\definefontfamily[termes[rm][TeX Gyre Termes]

\definefontfeature[default:block][default][blockligatures=yes]

\starttext

{\switchtobodyfont[times] \definedfont[Serif*default]begrifflich 
ff fi fl\blank
  \definedfont[Serif*default:block] 
begrifflich ff fi fl\blank}
{\switchtobodyfont[termes]\definedfont[Serif*default]begrifflich 
ff fi fl\blank
  \definedfont[Serif*default:block] 
begrifflich ff fi fl\blank}


\stoptext



-
  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
___


[NTG-context] Another bug with ligature-blocking?

2021-03-24 Thread denis.maier
Hi,

I just ran into something strange with ligature blocking:

---
\blockligatures[begrif:fl:ich]

\definefontfeature[default][default][dlig=yes,liga=yes,]
\definefontfeature[default:block][default][blockligatures=yes]

\definefontfamily[times][rm][Times New Roman]
\definefontfamily[termes[rm][TeX Gyre Termes]

\starttext
\switchtobodyfont[times]
\definedfont[Serif*default]
begrifflich
\blank

\definedfont[Serif*default:block]
begrifflich


\switchtobodyfont[termes]
\definedfont[Serif*default]
begrifflich
\blank

\definedfont[Serif*default:block]
begrifflich

\stoptext
---

With  I'm getting < begriff|lich> when blockligatures is 
activated. Does anyone know what's going on there?

Best,
Denis
___
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
___


[NTG-context] Replacement mechanism bug in LMTX?

2021-03-24 Thread denis.maier
Ah, I've now realized that the \blockligatures needs to be activated as a font 
feature... So forget about this point.

But, it still looks like ligature prevention with \replaceword is not working 
with lmtx, but it works with --luatex.


% these don't prevent ligatures
\replaceword[eka][auffasse][au{ff}asse]
\replaceword[eka][auffasst][au{ff}asst]
\replaceword[eka][auffasste][au{ff}asste]
\replaceword[eka][asdf][jklö] % this works though

% block as a font feature
\blockligatures[ff]
\definefontfeature[default:nolig][default][blockligatures=yes]


% finally this here works
\startexceptions[de]
au{f-}{f}{ff}(f\zwnj f)asse
au{f-}{f}{ff}(f\zwnj f)asste
\stopexceptions 


\starttext

no replacements\par
asdf
auffasste
auffasse
ff
\blank


with replacements\par
\setreplacements[eka]
asdf
auffasste
auffasse
ff
\blank


disable replacements again\par
\resetreplacements 
asdf
auffasste
auffasse
ff
\blank

disable ligatures via font features\par
\definedfont[Serif*default:nolig]
asdf
auffasste
auffasse
ff
\definedfont[Serif*default] % back to normal font
\blank


now via exceptions\par
\language[de] % this should trigger ligature handling via exceptions
auffasste
auffasse

\stoptext





> -Ursprüngliche Nachricht-
> Von: ntg-context  Im Auftrag von
> denis.ma...@ub.unibe.ch
> Gesendet: Montag, 22. März 2021 10:27
> An: j.ha...@xs4all.nl; ntg-context@ntg.nl
> Betreff: [NTG-context] Replacement mechanism?
> 
> Hi,
> 
> last October I've reported a strange bug with \replaceword
> 
> I know there's the new mechanism for dealing with ligatures, and I still 
> intend
> to convert the word list to the new format, but I'm still wondering whether
> that has been fixed.
> 
> Now, I've been testing with the minimal example below, and it looks there
> might be another bug with the replacement and ligature blocking
> mechanism:
> 
> --
> % these don't prevent ligatures
> \replaceword[eka][auffasse][au{ff}asse]
> \replaceword[eka][auffasst][au{ff}asst]
> \replaceword[eka][auffasste][au{ff}asste]
> \replaceword[eka][asdf][jklö] % this works though \setreplacements[eka]
> 
> % doesn't block the ff ligature
> \blockligatures[ff]
> 
> % finally this here works
> \startexceptions[de]
> au{f-}{f}{ff}(f\zwnj f)asse
> au{f-}{f}{ff}(f\zwnj f)asste
> \stopexceptions
> 
> 
> \starttext
> asdf % replacements work in general
> auffasste
> auffasse
> ff
> 
> % now via exceptions:
> \language[de]
> auffasste
> auffasse
> ff
> \stoptext
> --
> 
> 
> Best
> Denis
> 
> On 10/8/2020 3:15 PM, Denis Maier wrote:
> > Ok,
> > I've commented the whole nolig-german-wordlist out piece by piece, and
> > it looks like it comes down to this:
> >
> > ```
> > \replaceword[eka][auffasse][au{ff}asse]
> > \replaceword[eka][auffasst][au{ff}asst]
> >
> > \setreplacements[eka]
> >
> > \starttext
> > auffasste
> > auffasse
> > \stoptext
> > ```
> >
> > Uncommenting one of the \replacewords makes the wrong replacement
> > disappear.
> > But I don't see why "auffasste" should trigger an replacement. What is
> > happening here?
> 
> i will look into it ... so patience is needed
> 
> -
> 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
> __
> _
___
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
___


Re: [NTG-context] Writing to .tuc directly from Lua

2021-03-24 Thread Hans Hagen

On 3/24/2021 5:20 AM, Jairo A. del Rio wrote:
Thank you very much. It's useful, indeed. However, what I need is to 
bypass TeX (Lua > .tuc) if possible, since all the data I need to handle 
is generated with Lua scripts.

datasets-001.tex in the test suite


-
  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
___