[NTG-context] Variable OTF font resulting in invalid font due to stack overflow

2021-05-12 Thread Marcel Fabian Krüger
Hi,

recently we got an interesting bug report in luaotfload (the original report
is at https://github.com/latex3/luaotfload/issues/184) which relates to the
ConTeXt fontloader. Take the following ConTeXt example:

\starttext
\definefontfeature [default:bold] [default] [axis={weight=500}]
\definedfont[file:NotoSansCJKsc-VF.otf*default:bold @ 10pt]

U+5E2E 帮

\stoptext

The font is available at
https://github.com/googlefonts/noto-cjk/raw/main/Sans/Variable/OTF/NotoSansCJKsc-VF.otf.

This compiles correctly, but the CJK glyph do not appear since
it's Type2 CharString is invalid. The CFF2 CharStrings of this
glyph invokes the rrcurveto operator with 63 arguments, which is
allowed in CFF2 where the argument limit is 513, but not allowed in
Type2 where the limit is at 48.

It would be great if ConTeXt could check for this and insert additional
rrcuveto operators when necessary to avoid this issue.

Additionally we got a report that inkscape 1.0 seems to be incompatible
with the way commmands are passed to it for SVG files. Hendrik Seliger
suggested to set f_convert (defined in font-ocl.lua, otfsvg.topdf, line 435)
to `formatters["file-open:%s; export-%s:%s; export-do\n"]` when a new
inkscape version is detected. (See 
https://github.com/latex3/luaotfload/issues/183)
I wasn't able to reproduce the issue in ConTeXt yet.


Best regards,
Marcel
___
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] Fwd: Fuzzy lines

2021-05-12 Thread Jairo A. del Rio
-- Forwarded message -
De: Jairo A. del Rio 
Date: mié, 12 de may. de 2021 a la(s) 14:08
Subject: Re: [NTG-context] Fuzzy lines
To: mailing list for ConTeXt users 




El mié, 12 de may. de 2021 a la(s) 13:03, Henning Hraban Ramm (
te...@fiee.net) escribió:

> Hi Jairo,
>
> thank you for the suggestion.
>
> > Am 11.05.2021 um 14:56 schrieb Jairo A. del Rio  >:
> >
> > For simple pens, you may define your own (section 9.7 of MetaPost
> manual).
>
> Unfortunately, pens don’t work as patterns but only as outlines.
>
> > For complicated strokes, something along these lines could be useful as
> a starting point (I'm not taking cyclic paths in consideration, btw). I did
> something similar with duck footprints some weeks ago:
> >
> > %Sorry for the ugly code...
> > \starttext
> > \startMPpage
> > %Unit size
> > numeric u; u := 1mm;
> >
> > %In a picture you are able to include everything, kinda
> > picture Pluma;
> > Pluma := image(
> >   for i = 1 upto 5:
> >   for j = 1 upto 5:
> >   draw (i,j) randomized 1;
> >   endfor
> >   endfor
> > );
>
> Unfortunately, that’s the same pattern over and over.
> The randomization is only applied once.
> Good for footprints, bad for fuzzy patterns.
>

You only need to move "randomized" at the drawing stage:

\starttext

\startMPpage

numeric u; u := 1mm;

picture Pluma;

Pluma := image(

for i = 1 upto 5:

for j = 1 upto 5:

draw (i,j);

endfor

endfor

);

path Camino;

Camino := origin for i = 1 upto 30: .. (u*i, u*sind (12i mod 360)) endfor;

for i = 0 step 1/2 until length Camino:

draw Pluma randomized 1 rotated (90 + angle direction i of Camino)

shifted point i of Camino;

endfor

\stopMPpage

\stoptext

But "randomized" will deform paths. Maybe you want something like this?

\starttext

\startMPpage[align=]

begingroup;

save Rnd; let Rnd = uniformdeviate;


numeric u; u := 3mm;

picture Pluma;

Pluma := image(

for i = 1 upto 5:

for j = 1 upto 5:

fill fullcircle shifted (i,j); %try fulltriangle or another shape

endfor

endfor

);

path Camino;

Camino := origin for i = 1 upto 30: .. u*i*left endfor;

for i = 0 step 1/2 until length Camino:

draw image(

for x within Pluma:

fill pathpart x %Assuming our image only contains cyclic paths

scaled (1+Rnd 1)

shifted (1/2dir Rnd 360)

withcolor hsvtorgb(6round(Rnd 60),9/10,1); %Colors just because they look
cute

endfor

) rotated (90 + angle direction i of Camino)

shifted point i of Camino;

endfor

endgroup;

\stopMPpage

\stoptext

> %Simple curve
> > path Camino;
> > Camino := origin for i = 1 upto 30: .. (u*i, u*sind (12i mod 360))
> endfor;
> >
> > %Strokes
> > for i = 0 step 1/2 until length Camino:
> >   draw Pluma rotated (90 + angle direction i of Camino)
> >   shifted point i of Camino;
> > endfor
>
> Since I have more or less straight lines but of different length, the "one
> pattern per 1/n path segment" doesn’t work for me. I could try to construct
> my paths differently.
>

You only need to use fractions, i.e., "for 0 step 1/n until 1: ... endfor"
if you work with straight lines defined using only two points. In the
example above I made one from more than two points just for ease of
manipulation. With examples and feedback from the mailing list, you might
define your own function using the new Metafun interface for LMTX.


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

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] Fuzzy lines

2021-05-12 Thread Henning Hraban Ramm
Hi Aditya,
thanks for the code (that also Mikael pointed to)!

> Am 11.05.2021 um 18:02 schrieb Aditya Mahajan :
> 
> Look at this old code on how hide such code behind a macro to have a clean 
> interface:
> 
> https://github.com/adityam/mp-sketch/blob/master/mp-sketch.mp

I came up with this simple cover layout:


input mp-sketch;

beginfig(1)
  color darkblue ; darkblue := (40/255,67/255,117/255) ;

  pen pillpen ; pillpen := makepen 
((-1bp,-0.5bp)--(1bp,-0.5bp)..(1bp,0.5bp)--(-1bp,0.5bp)..cycle) ;
  pickup pillpen xyscaled 3bp ;

  sketchypaths;
  sketch_amount := 5bp;

  % insert some extra points to add fuzzyness - automate?
  % path one ; one := (-3mm,249mm) -- (185mm,249mm) -- (185mm,300mm) ; % 
links-oben
  path onep ; onep := (-3mm,249mm) .. (25.5mm,249mm) .. (150mm,249mm) -- 
(185mm,249mm) -- (185mm,300mm) ; % links-oben
  % path two ; two := (25.5mm,-3mm) -- (25.5mm,167mm) -- (213mm,167mm) ; % 
unten-rechts
  path twop ; twop := (25.5mm,-3mm) .. (25.5mm,25.5mm) .. (25.5mm,120mm) -- 
(25.5mm,167mm) .. (120mm,167mm) -- (213mm,167mm) ; % unten-rechts

  % draw paths several times - automate?
  numeric max ; max := 5;
  for i=0 upto max :
draw onep withcolor darkblue withtransparency ("multiply", 1/max) ;
draw twop withcolor darkblue withtransparency ("multiply", 1/max) ;
  endfor

  naturalizepaths;

  % draw crop box (paper size)
  pickup pencircle xyscaled 0.5bp;
  draw (0,0)--(0,297mm)--(210mm,297mm)--(210mm,0)--cycle withcolor magenta;

endfig


This begins to look like I imagined, even if I’d like to add some noise 
(pattern, shading).
Jairo’s suggestion looks too regular.
(Finally, I’ll overlay the whole page with a transparent image for structure.)

As you see, both paths use only three points, but I added some more to add 
fuzzyness.
Also they get drawn several times with transparency to get a irregular width 
and some blur.

I’m quite sure this could be added to your macro, but I’m still too 
inexperienced with Metapost.

Hraban
___
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] Fuzzy lines

2021-05-12 Thread Henning Hraban Ramm
Hi Jairo,

thank you for the suggestion.

> Am 11.05.2021 um 14:56 schrieb Jairo A. del Rio :
> 
> For simple pens, you may define your own (section 9.7 of MetaPost manual).

Unfortunately, pens don’t work as patterns but only as outlines.

> For complicated strokes, something along these lines could be useful as a 
> starting point (I'm not taking cyclic paths in consideration, btw). I did 
> something similar with duck footprints some weeks ago:
> 
> %Sorry for the ugly code...
> \starttext
> \startMPpage
> %Unit size
> numeric u; u := 1mm;
> 
> %In a picture you are able to include everything, kinda
> picture Pluma;
> Pluma := image(
>   for i = 1 upto 5:
>   for j = 1 upto 5:
>   draw (i,j) randomized 1;
>   endfor
>   endfor
> );

Unfortunately, that’s the same pattern over and over.
The randomization is only applied once.
Good for footprints, bad for fuzzy patterns.

> %Simple curve
> path Camino;
> Camino := origin for i = 1 upto 30: .. (u*i, u*sind (12i mod 360)) endfor;
> 
> %Strokes
> for i = 0 step 1/2 until length Camino:
>   draw Pluma rotated (90 + angle direction i of Camino)
>   shifted point i of Camino;
> endfor

Since I have more or less straight lines but of different length, the "one 
pattern per 1/n path segment" doesn’t work for me. I could try to construct my 
paths differently.


Hraban

___
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] \char not working with private unicodes

2021-05-12 Thread Taco Hoekwater


> On 12 May 2021, at 14:03, Taco Hoekwater  wrote:
> 
> But \char”F1538 still shows the wrong icon (though probably a different wrong 
> one). 
> 
> I did a bit of digging, and here is where it starts to goes wrong right now 
> (tma excerpt):
> 
> 
>  [….]


Never mind that, that was wrong of me and not the problem at all! Sorry!

Retry:

  [983943]={
   ["boundingbox"]=58,
   ["index"]=903,
   ["name"]="music-note",
   ["unicode"]=983943,
   ["width"]=512,
  },
  [983944]={
   ["boundingbox"]=187,
   ["index"]=904,
   ["name"]="music-note-half",
   ["unicode"]=983945,
   ["width"]=512,
  },

“music-note” appears twice in the font encoding, at F0387 and F0388. 
The cheat sheet says that the second of those should be “music-note-eight”,
but it has the wrong name, which is probably why ConTeXt removes it.

The next one is “checkbox-blank-circle-outline”, which is at F0766 and F043D.
The latter should have been named “radiobox-blank” according to the cheat sheet.

Etc.

On my earlier note: I still think it is bad to assign unicode code points
in ’this’ case. A logo that is encoded in the PUA and happens to be named 
“minus” is very unlikely to actually be a mathematical minus.


— 
Taco Hoekwater  E: t...@bittext.nl
genderfluid (all pronouns)



___
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] \char not working with private unicodes

2021-05-12 Thread Taco Hoekwater


> On 11 May 2021, at 17:31, Hans Hagen  wrote:
> 
> On 5/11/2021 3:40 PM, Taco Hoekwater wrote:
>>> On 11 May 2021, at 15:16, Hans Hagen  wrote:
>>> 
>>> On 5/11/2021 2:08 PM, Jairo A. del Rio wrote:
 Hi, list! Following this thread: 
 https://tex.stackexchange.com/questions/596610/how-to-use-luatex-with-large-unicode-codepoint
  
 ,
  I tried to replicate it in ConTeXt. Both LMTX and LMTX fail to display 
 the right symbol and, as it's discussed in the linked page, there's an 
 offset by 14. Is this intentional (in ConTeXt)? A bug? Minimal 
 (non-)working example:
 %Font available here: https://materialdesignicons.com/ 
 
 \starttext
 \definedfont[file:materialdesignicons-webfont.ttf]\char"F1372\relax
 \stoptext
>>> You need to employ a sense of humour for that font:
>>> 
>>> \starttext
>>>\definefontfeature[materialicons][default][rlig=yes]
>>>\definedfont[file:materialiconsregular.ttf*materialicons]
>>>baby_changing_station
>>> \stoptext
>> That only works with the regular font, not with the webfont version from the 
>> ‘easy download’
>> link (it is cool, though :)).
>> But that is not the issue. The issue is that you have this super-useful page 
>> online:
>>   https://pictogrammers.github.io/@mdi/font/5.4.55/
>> where you can just copy the code point and/or the encoding hex value. But 
>> those values
>> do not match the ones in ConTeXt because the duplicates are removed while 
>> creating the tma,
>> which condenses the encoding, resulting in an encoding offset, and that in 
>> turns make cut
>> useless. :(
>> Also, it is a bit of a shame that the XXX-webfont.ttf has postscript glyph 
>> names that map to the
>> online cheat sheet, but these names are not preserved in the tma file (at 
>> least not in my lmtx
>> version). Keeping those would make the whole typset-a-specific-glyph 
>> procedure be a lot less
>> error-prone, at least.
> i suppose you noted the message -)
> 
> can you confirm / check that we can safely assume zero length names to be 
> okay?
> 
>local length = readbyte(f)
>if length > 0 then
>glyphs[mapping].name = readstring(f,length)
>else
> -- report("quit post name fetching at %a of %a: 
> %s",i,maxnames,"overflow")
> -- break
>end
> 
> i bet this check is there because of some other font needed it in order to 
> get loaded


With that “break" removed glyph naming works and I can safely do:

 \getnamedglyphdirect{file:materialdesignicons-webfont.ttf}{access-point-check}

which is the font glyph encoded at “F1538. The above line produces the correct 
output now.

But \char”F1538 still shows the wrong icon (though probably a different wrong 
one). 

I did a bit of digging, and here is where it starts to goes wrong right now 
(tma excerpt):


  [983923]={
   ["boundingbox"]=1,
   ["index"]=883,
   ["name"]="minecraft",
   ["unicode"]=983923,
   ["width"]=512,
  },
  [983924]={
   ["boundingbox"]={ 0, 0, 406, 214 },
   ["index"]=884,
   ["name"]="minus",
   ["unicode"]=8722,
   ["width"]=512,
  },
  [983925]={
   ["boundingbox"]=6,
   ["index"]=885,
   ["name"]="minus-box",
   ["unicode"]=983925,
   ["width"]=512,
  },

That “minus" is moved back to the spot for Unicode MINUS SIGN, and then the 
rest 
of the encoding shifts down by one. That happens a few dozen times in total, for
various glyphs with “standard” names. So probably the name-based remapping of
glyphs is a bad idea for glyphs that are explicitly PUA-encoded in the font ...

Best wishes,
Taco


— 
Taco Hoekwater  E: t...@bittext.nl
genderfluid (all pronouns)



___
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] Language goodies -- hard line break the algorithm?

2021-05-12 Thread denis.maier
Hi,
testing the new language goodies feature for ligature prevention, I found that 
hard line breaks seem to interfere somehow with the ligature prevention 
mechanism:

==
\setuplanguage[de][ goodies={lang-de.llg}]
\startlanguageoptions[de]
auf|jubeln
\stoplanguageoptions
\mainlanguage[de]

\definefontfeature[default][default][dlig=yes,liga=yes]
\definefontfamily[times][rm][Times New Roman]
\setupbodyfont[times]

\starttext

aufjubeln
aufjubeln\\
auffliegen
auffliegen\\
begrifflich
begrifflich\\

\stoptext
==

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] Ligatures blocking -- why block unspecified ligatures?

2021-05-12 Thread denis.maier
Hi,

I just ran into an issue with the \blockligatures mechanism. For some reason, 
the following examples replaces ffi with f|fi and ffl with f|fl although I have 
not specified them in \blockligatures:

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

% block certain ligatures globally, but not f|fl, f|fi
\blockligatures [ft,fft,fj,ffj,fk]

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

\startbuffer[test]
fj\\
ffi\\
ffl\\
ff\\
fi
\stopbuffer

\starttext

\getbuffer[test]

\definedfont[Serif*default:block]
\getbuffer[test]

\switchtobodyfont[times]
\getbuffer[test]

% With Times New Roman, we can even see the bars in the output
\definedfont[Serif*default:block]
\getbuffer[test]

\stoptext
==

What am I missing?

(I am trying to block certain ligatures globally, ie. ft,fft,fj,ffj,fk, but fi, 
ffi, fl, fll are being dealt with in the language goodies file.)

Thanks for your help,
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] \char not working with private unicodes

2021-05-12 Thread luigi scarso
On Tue, May 11, 2021 at 3:41 PM Taco Hoekwater  wrote:

>
>
> > On 11 May 2021, at 15:16, Hans Hagen  wrote:
> >
> > On 5/11/2021 2:08 PM, Jairo A. del Rio wrote:
> >> Hi, list! Following this thread:
> https://tex.stackexchange.com/questions/596610/how-to-use-luatex-with-large-unicode-codepoint
> <
> https://tex.stackexchange.com/questions/596610/how-to-use-luatex-with-large-unicode-codepoint>,
> I tried to replicate it in ConTeXt. Both LMTX and LMTX fail to display the
> right symbol and, as it's discussed in the linked page, there's an offset
> by 14. Is this intentional (in ConTeXt)? A bug? Minimal (non-)working
> example:
> >> %Font available here: https://materialdesignicons.com/ <
> https://materialdesignicons.com/>
> >> \starttext
> >> \definedfont[file:materialdesignicons-webfont.ttf]\char"F1372\relax
> >> \stoptext
> > You need to employ a sense of humour for that font:
> >
> > \starttext
> >\definefontfeature[materialicons][default][rlig=yes]
> >\definedfont[file:materialiconsregular.ttf*materialicons]
> >baby_changing_station
> > \stoptext
>
> That only works with the regular font, not with the webfont version from
> the ‘easy download’
> link (it is cool, though :)).
>
> But that is not the issue. The issue is that you have this super-useful
> page online:
>
>   https://pictogrammers.github.io/@mdi/font/5.4.55/
>
>
another link for the records, just in case
https://www.nerdfonts.com


-- 
luigi
___
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] Include PDF pages

2021-05-12 Thread MANUEL GONZALEZ SUAREZ
Thank you very much, Aditya.

-Mensaje original-
De: ntg-context [mailto:ntg-context-boun...@ntg.nl] En nombre de Aditya Mahajan
Enviado el: martes, 11 de mayo de 2021 17:50
Para: mailing list for ConTeXt users 
Asunto: Re: [NTG-context] Include PDF pages

On Tue, 11 May 2021, denis.ma...@ub.unibe.ch wrote:

> > Von: ntg-context  Im Auftrag von MANUEL 
> > GONZALEZ SUAREZ
> > Gesendet: Dienstag, 11. Mai 2021 09:30
> > An: Context 
> > Betreff: [NTG-context] Include PDF pages
> > 
> > Hello everybody:
> > 
> > 
> > My query is as follows: in LaTeX there is the package "pdfpages" 
> > (https://www.ctan.org/pkg/pdfpages) that allows pages from a PDF file to be 
> > included in a TeX document. Is there a similar procedure that works in 
> > ConTeXt?
>
> https://wiki.contextgarden.net/Including_pages_from_PDF_documents

If these don't meet your needs, it is also relatively easy to roll your own 
macro:

https://adityam.github.io/context-blog/post/include-multi-page-pdf/

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