Re: [NTG-context] Fuzzy lines

2021-05-14 Thread Henning Hraban Ramm

> Am 14.05.2021 um 00:39 schrieb Aditya Mahajan :
> 
> I am not sure if simply adding random noise to the line give an impression of 
> hand-drawn lines. For a different approach, see:
> 
> https://m.habr.com/en/post/454376/
> 
> which uses the code here:
> 
> https://github.com/jemmybutton/fiziko

Just WOW

HR
___
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] NotoColorEmoji - loca table not found

2021-05-14 Thread Hans Hagen

On 5/14/2021 6:33 PM, Adam Reviczky wrote:

Hi Hans,

Yes, sorry about the error :).

Thanks for the explanation, will use lmtx for that, though probably best 
just using another font (some mentioned on the list 
https://www.mail-archive.com/ntg-context@ntg.nl/msg92800.html 
 and 
https://mailman.ntg.nl/pipermail/ntg-context/2020/098136.html 
) or svg 
or metapost as I do not need it in colour.


I spend quite a bit of time looking into this (it's already a while ago 
when I implemented all this and color stuff in otf is a bit of a mess 
and evolving, so in retrospect it's probably better to wait a few years 
to see how that works out; the same for variable fonts ... hadr to deal 
with when there are not many fonts and fuzzy specs.)


Anyway, the problem is this: these png emoji are using palettes + masks 
and that combinaiton gives:


- with gm (gs) : white background
- with mutool  : black background
- with luatex  : a mess
- with lmtx: what we want

now, testing all this takes a lot of time in mkiv because building the 
cache file takes time, so it's one of these moments i wonder if a modern 
machine would do better than my old but reliable machine. The outcome is 
that in mkiv one can do this:


\enabledirectives[backend.otfpng.method=lmtx]   % the real deal, slow
\enabledirectives[backend.otfpng.method=mutool] % black bg
\enabledirectives[backend.otfpng.method=gm] % white bg, default

So, when you have a fast machine or a coffe break, you can use the lmtx 
method (can be configures in cont-loc.mkiv).


As manetioned, in lmtx it is done differently so no penalties there.

I thought it would be easier via fonts but backtracking on the idea now 
and maybe using something like this instead: 
https://thenounproject.com/term/handshake/153516/ 
.
btw, some emoji fonts have both bw outlines and bitmap color, some use 
png (bloated), and microsoft fonts have efficient outline color (nice 
mechanism).


Hans

(who never uses emoji)


-
  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] NotoColorEmoji - loca table not found

2021-05-14 Thread Adam Reviczky
Hi Hans,

Yes, sorry about the error :).

Thanks for the explanation, will use lmtx for that, though probably best
just using another font (some mentioned on the list
https://www.mail-archive.com/ntg-context@ntg.nl/msg92800.html and
https://mailman.ntg.nl/pipermail/ntg-context/2020/098136.html) or svg or
metapost as I do not need it in colour.

I thought it would be easier via fonts but backtracking on the idea now and
maybe using something like this instead:
https://thenounproject.com/term/handshake/153516/.

Thank you,
Adam

On Fri, May 14, 2021 at 4:33 PM Hans Hagen  wrote:

> On 5/14/2021 3:21 AM, Jairo A. del Rio wrote:
> >
> >
> > El jue, 13 de may. de 2021 a la(s) 19:52, Adam Reviczky
> > (revic...@gmail.com ) escribió:
> >
> > Thanks Jairo,
> >
> > That indeed works, should've read that it is bitmap only.
> >
> > I do get a white background though (MKIV), is that how the bitmap is
> > stored?
> >
> >
> > In LuaLaTeX with Harfbuzz shaper as well as ConTeXt LMTX, transparency
> > is properly handled, so I suppose ConTeXt MkIV is to blame in this case.
> > In case you understand how does ConTeXt handle with bitmap fonts,
> > relevant files are under
> >
> /home/coragyps/lmtx/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/fonts/
> >
> > \definefontfeature[Emoji][default][sbix=yes]
> >
> > \starttext
> >
> >
>  
> \framed[background=color,background=black]{\definedfont[file:NotoColorEmoji.ttf*Emoji]\char"1F91D}
>
> took me quite a while to realize that there is an error in that line
>
> > \stoptext
> >
> >
> > In Hans' example for applecoloremoji there is no white background
> > (page 5, bachotex-2017-emoji.pdf).
> >
> > I also do not get a white background with LibreOfiice.
> >
> >
> >
> > I'd wait for Hans to fix it, as I don't really understand font
> > management in ConTeXt...
> in lmtx we use a different method
>
> in mkiv we can actually switch to a variant that was on hold till
> texlive release (i.e. luatex 1.13, i forgot about that)
>
> even then, because we cache the problem in mkiv is more with the
> conversion tools that drop masks ..
>
> 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
>
> ___
>
___
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] NotoColorEmoji - loca table not found

2021-05-14 Thread Hans Hagen

On 5/14/2021 3:21 AM, Jairo A. del Rio wrote:



El jue, 13 de may. de 2021 a la(s) 19:52, Adam Reviczky 
(revic...@gmail.com ) escribió:


Thanks Jairo,

That indeed works, should've read that it is bitmap only.

I do get a white background though (MKIV), is that how the bitmap is
stored?


In LuaLaTeX with Harfbuzz shaper as well as ConTeXt LMTX, transparency 
is properly handled, so I suppose ConTeXt MkIV is to blame in this case. 
In case you understand how does ConTeXt handle with bitmap fonts, 
relevant files are under 
/home/coragyps/lmtx/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/fonts/


\definefontfeature[Emoji][default][sbix=yes]

\starttext


\framed[background=color,background=black]{\definedfont[file:NotoColorEmoji.ttf*Emoji]\char"1F91D}


took me quite a while to realize that there is an error in that line


\stoptext


In Hans' example for applecoloremoji there is no white background
(page 5, bachotex-2017-emoji.pdf).

I also do not get a white background with LibreOfiice.



I'd wait for Hans to fix it, as I don't really understand font 
management in ConTeXt...

in lmtx we use a different method

in mkiv we can actually switch to a variant that was on hold till 
texlive release (i.e. luatex 1.13, i forgot about that)


even then, because we cache the problem in mkiv is more with the 
conversion tools that drop masks ..


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

2021-05-14 Thread Thomas A. Schmitz

> On 13. May 2021, at 21:42, Henning Hraban Ramm  wrote:
> 
> Hi Thomas,
> 
> for my test files you only also need Aditya’s latest mp-sketch.mp, now 
> attached.
> 
> Find also attached my (somewhat simplified) attempt on a cover for a new 
> workbook series.
> In the original I’m using the commercial "Supernett Cn" font family that also 
> looks quite sketchy.
> 
> Hraban

Perfect, thank you, that allowed me to play a bit with it. Would be interested 
to see what you really want to achieve one day…

All best

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
___


Re: [NTG-context] Fuzzy lines

2021-05-14 Thread Hans Hagen

On 5/13/2021 6:36 PM, Aditya Mahajan wrote:

On Thu, 13 May 2021, Henning Hraban Ramm wrote:




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


Hi Aditya,
I’m trying to include my additions into your code, but it doesn’t work.


numeric sketch_amount; sketch_amount := 3bp;
numeric sketch_passes; sketch_passes := 5;

def sketchdraw expr p =
   do_sketchdraw(p if (path p): randomized sketch_amount fi)
enddef;

def do_sketchdraw(expr p) text t =
 normaldraw p t ;
enddef;


Now I want to draw that path several times.

If I understand it right, I can’t put that into "sketchdraw" because that leaves the end 
open for path additions like "withcolor".

But it also doesn’t work in "do_sketchdraw"; I thought it might like this:


A slightly different approach is needed. See attached. I also added a bit a 
error protection in case someone sets sketch_passes to be negative by mistake.

It may be interesting to rewrite these macros using the new key-value interface 
for metapost, so that something like this works:

\sketchdraw[amount=3bp, passes=5, transparency=yes] fullsquare scaled 1cm 
withcolor red;
one resembles present-weird-001.pdf (in the doc tree) ... it was from 
the times one could rely on acrobat to jump around a large page ... i 
used that one for a presentation about mathml (decades ago) ... in times 
that the main question one got was "why use something else than latex 
for math" or "why use tex if you don't do math" which put context in a 
weird spot (but also permitted to come up with weird presentation styles 
that didn't look too tex)


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

2021-05-14 Thread Hans Hagen

On 5/14/2021 12:39 AM, Aditya Mahajan wrote:


https://github.com/jemmybutton/fiziko

That's amazing mp code, right?

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

2021-05-14 Thread Hans Hagen

On 5/14/2021 6:30 AM, Benny Schurig wrote:

Hi Julian,

for me first reply ever with a suggestion:

You have to set a caption

https://wiki.contextgarden.net/Command/startcombination

That worked fine for me:

\startplacefigure[location=here]
   \setupcombination[distance=0mm,after=]
   {\startcombination[2*1]
     {\externalfigure[res1.jpg][width=.4\textwidth]} {pic 1}
     {\externalfigure[res2.jpg][width=.4\textwidth]} {pic 2}
   \stopcombination}
\stopplacefigure

Best, Benny

Am 14.05.21 um 05:27 schrieb jbf:

Hi list,

The following MWE is giving me two photos under each other, not beside 
each. What am I doing wrong?


Julian


\startplacefigure[location=here]
\setupcombination[distance=0mm,after=]
{\startcombination[2*1]
{\externalfigure[res1.jpg][width=.4\textwidth]}
{\externalfigure[res2.jpg][width=.4\textwidth]} \stopcombination}
\stopplacefigure

You can also do this:

\startplacefigure[location=here]
\startcombination[distance=2mm,after=,nx=2,ny=1,location=middle]
\startcontent
\externalfigure[mill.png]  [width=.4\textwidth]
\stopcontent
\startcaption
pic 1
\stopcaption
\startcontent
\externalfigure[hacker.jpg][width=.4\textwidth]
\stopcontent
\startcaption
pic 2
\stopcaption
\stopcombination
\stopplacefigure


-
  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] NotoColorEmoji - loca table not found

2021-05-14 Thread Hans Hagen

On 5/14/2021 1:49 AM, Jairo A. del Rio wrote:
In ConTeXt LMTX this works just fine (try mtxrun --generate and context 
--make first):


\definefontfeature[Emoji][default][sbix=yes]

\starttext

\definedfont[file:NotoColorEmoji.ttf*Emoji]\char"1F91D

\stoptext

However, when one tries to convert it with ImageMagick the following 
happens:


     Error reading a content stream. The page may be incomplete.
                Output may be incorrect.
     Error: Ignoring spurious ET operator.
                Output may be incorrect.
     Error: File did not complete the page properly and may be damaged.
                Output may be incorrect.


Only SVG fonts don't trigger this error in LMTX.


I confirm ConTeXt MkIV is having issues with emoji fonts. It seems that 
GraphicsMagick is not properly generating images as it complains about 
an improper header.
my experiences with graphicmagick and such conversions are bad, one can 
also get pdf with missing objects and so ... when you have a version 
that works, best stick to that before updating (or keep it around)


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] NotoColorEmoji - loca table not found

2021-05-14 Thread Hans Hagen

On 5/14/2021 1:26 AM, Adam Reviczky wrote:

Hi,

I am trying to use the 'handshake' character 
(https://www.fileformat.info/info/unicode/char/1f91d/fontsupport.htm 
) 
from the Noto Color Emoji font 
(https://github.com/googlefonts/noto-emoji/blob/main/fonts/NotoColorEmoji.ttf 
).


The following MWE gives an error:

\starttext

\definedfont[file:NotoColorEmoji.ttf] \char"1F91D

\stoptext


works here (lmtx):

\starttext
\definedfont[file:NotoColorEmoji.ttf*color]

\emoji{handshake}
\char"1F91D
\stoptext

two handhakes ... (you need to use the color feature, this font doesn't 
have non colored ones btw)


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