[NTG-context] lpdf.registerfontmethod

2023-07-06 Thread Max Chernoff
Hi Hans,

In lpdf-emb.lmt, there's a commented-out definition of
lpdf.registerfontmethod that I'd like to use. I've uncommented this in
my installation and it's worked pretty well for me, so can you please
uncomment/enable this by default in the distribution?

If you want further background, this is how I'm using it:

   lpdf.registerfontmethod("rawpdf", function(filename, details)
   return
   details.properties.indexdata[1],
   0.001,
   function(char)
   return char.code, char.width / t3_to_sp
   end,
   function() end,
   function() end
   end)
   
   local function make_glyph(codepoint, unicode, width, height, code)
   local spec  = {
   width   = width * t3_to_sp,
   height  = height * t3_to_sp,
   depth   = 0,
   unicode = { utf8.codepoint(unicode or "", 1, -1, true) },
   code = width .. " 0 d0 " .. code,
   }
   local tfmdata  = fonts.hashes.identifiers[font.current()]
   tfmdata.characters[codepoint] = spec
   
   fonts.dropins.swapone(
   "rawpdf",
   tfmdata,
   { code = spec },
   codepoint
   )
   
   fonts.constructors.addcharacters(
   font.current(),
   { characters = { [codepoint] = spec } }
   )
   end

I specifically need something that writes out a raw PDF stream. I'm
using this to write a 4000+ page PDF file to be included by pdfTeX, so I
can't have any XObject indirection or similar, otherwise the number of
objects skyrockets and pdfTeX (+qpdf) gets really slow.

If you're curious, the actual code where I'm using this is here:

   
https://github.com/gucci-on-fleek/unnamed-emoji/blob/master/source/svg-to-pdf.cld
   
https://github.com/gucci-on-fleek/unnamed-emoji/blob/master/source/unnamed-emoji.lua

I know that what I'm doing in the .cld file is wildly unsupported, but
I'm the only one who will ever need to run that. I am planning on
distributing the .lua file though, so I'd like to get this change in the
distribution.

I'm also open to using a different interface instead if you don't want
to publicly-expose lpdf.registerfontmethod.

Thanks,
-- Max
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Re: text width shadow background

2023-07-06 Thread Henning Hraban Ramm

Am 06.07.23 um 21:27 schrieb Henning Hraban Ramm:

* I don’t understand why the white fill is not opaque.


Posted too early. I do understand now (overlapping outlines).
Tried to fix it by overwriting the text again in white, but now I don’t 
understand how to calculate the shifting:


"""
\setupbodyfont[ss,24pt]
\definecolor[tshade][t=.05,a=1,k=1]

\starttexdefinition MyCaption #1
\startMPcode{doublefun}
steps := 10 ;
rulesize := BodyFontSize/steps/3;
for step = 1 upto steps:
draw lmt_outline [
text = "\bf #1",
%style = "bold", % doesn’t work
kind = "both",
fillcolor = "white",
drawcolor = "tshade",
rulethickness = (step*rulesize),
] xshifted -193; % why is this shifted at all?
endfor;
draw lmt_text [
text = "#1",
style = "bold",
color = "white",
] yshifted (steps*rulesize);
\stopMPcode
\stoptexdefinition

\starttext

\MyCaption{Eine wunderschöne Bildunterschrift}

\MyCaption{Ein ganz anderer Text}

\stoptext
"""

Hraban
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] text width shadow background

2023-07-06 Thread Henning Hraban Ramm

Hi, maybe you remember that I wanted this since 2017...

I finally managed to get a fuzzy background behind text:

"""
\setupbodyfont[ss,24pt]
\definecolor[tshade][t=.05,a=1,k=1]

\starttexdefinition MyCaption #1
\startMPcode{doublefun}
steps := 10 ;
rulesize := BodyFontSize/steps/3;
for step = 1 upto steps:
draw lmt_outline [
text = "\bf #1",
%style = "bold", % doesn’t work
kind = "both",
fillcolor = "white",
drawcolor = "tshade",
rulethickness = (step*rulesize),
];
endfor;
\stopMPcode
\stoptexdefinition

\starttext

\MyCaption{Eine wunderschöne Bildunterschrift}

\stoptext
"""

Remaining problems:

* lmt_outline doesn’t understand "style"; would be nice.

* I don’t understand why the white fill is not opaque.

Hraban___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: \showmakeup adds unwanted space despite accurate readings; \qquad mandatory before \TeX\

2023-07-06 Thread Carlos
On Thu, Jul 06, 2023 at 09:16:58AM -0400, Carlos wrote:
> On Wed, Jul 05, 2023 at 06:52:30PM +0200, Hans Hagen wrote:
> > On 7/5/2023 6:38 PM, Carlos wrote:
> > > On Wed, Jul 05, 2023 at 06:12:32PM +0200, Hans Hagen wrote:
> > > > On 7/5/2023 5:53 PM, Carlos wrote:
> > > > > On Wed, Jul 05, 2023 at 04:43:56PM +0200, Hans Hagen wrote:
> > > > > > On 7/5/2023 3:18 PM, Carlos wrote:
> > > > > > > \showmakeup on \TeX\ shows a
> > > > > > > 
> > > > > > > tSP:3.282
> > > > > > > THK:-1.721
> > > > > > > H__E
> > > > > > > X
> > > > > > > HK:-1.291
> > > > > > > SP:3.282
> > > > > > 
> > > > > > no MWE includes so clueless
> > > > > 
> > > > > \starttypescript[mylucidaserif]
> > > > > \definefontsynonym[LucidaBrightRegular]
> > > > > [file:LucidaBrightRegular]
> > > > > \definefontsynonym[LucidaBrightItalic] 
> > > > > [file:LucidaBrightItalic]
> > > > > \definefontsynonym[LucidaBrightDemiBold]   
> > > > > [file:LucidaBrightDemiBold]
> > > > > \definefontsynonym[LucidaBrightDemiItalic] 
> > > > > [file:LucidaBrightDemiItalic]
> > > > > \stoptypescript
> > > > Hm, isn't that this lucida rip off again? Maybe bad metricks then but 
> > > > I'm
> > > > not going to look into that as the official TUG lucida opentype fonts
> > > > perform okay.
> > > > 
> > > > Hans
> > > 
> > > The first sentence is irrelevant. And a guess. Bad metrics is not the
> > > culprit
> > > 
> > > if it were true, the same problem would be under lualatex, correct?
> > 
> > well, who knows what (me)tricks those fonts have embedded .. are these the
> > official TUG lucida open type fonts? if so,
> > 
> > \setupbodyfont[lucida]
> > 
> > should just work (btw, you also don't set up math)
> > 
> > > But it's not there.
> > I can't (and won't) check that as I don't have (lua)latex installed nor have
> > those fonts. I also don't see where this \qquad is in your example.
> 
> 
> Using the same fonts under lualatex yields \TeX\ without an issue. 
> 
> \documentclass{article}
> 
> \usepackage{unicode-math}
> 
> \defaultfontfeatures{Ligatures=TeX}
> 
> \setmainfont[
>   ItalicFont=LucidaBrightItalic,
> BoldFont=LucidaBrightDemiBold,
>   BoldItalicFont=LucidaBrightDemiItalic,
>   ]{LucidaBrightRegular}
> %
> \setsansfont[
>   ItalicFont=LucidaSansOblique,
> BoldFont=LucidaSansDemiBold,
>   BoldItalicFont=LucidaSansDemiOblique,
>   ]{LucidaSansRegular}
> %
> \setmonofont[
> %  ItalicFont=LucidaTypewriterOblique,
> BoldFont=LucidaTypewriterBold,
> %  BoldItalicFont=LucidaTypewriterBoldOblique,
>   ]{LucidaTypewriterRegular}
> 
> \begin{document}
> 
> {\rm\input{knuth}}
> 
> \textsf{\input{knuth}}
> 
> \end{document}
> 
> > 
> > As for the \showmakup ... it is used extensively and afaiks there are no
> > issues with it.
> 
> After running lualatex the problem dissappears. Or it seems like it. 
> 

I take it back. It doesn't disappear. It's still there.  \showmakeup
yields the right readings but yet the kerning is off on \TeX\.

With \showmakeup everything ‹seems› correct. I guess the readings
output are correct, and also, amazingly, the horizontal kerning,
as you aptly named it, for \TeX\

Not under lualatex. Everytihng seems fine there.

But I perfectly understand that there would not be any support for these
fonts. Thanks though! 

(trying to send this message with an attachment as before but it wouldn't
go through) 


-- 
We are experiencing system trouble -- do not adjust your terminal.

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: Title pages makeup extra blank pages

2023-07-06 Thread Wolfgang Schuster

Alan Braslau schrieb am 06.07.2023 um 17:14:

On 06/07/23 06/07/23, 17:07, Wolfgang Schuster wrote:


Add "doublesided=no" to your makeup settings.

Wolfgang


Thank you.
I have doublesided=no in the makeup, but this makeup is not used by 
\startpagefigure.


The problem is with \startpagefigure that is outside of makeup, that 
is it is using the standard makeup (with doublesided=yes). Is this a 
bug, that is should \startpagefigure use the makeup of the included 
PDF document and ignore the local makeup? Or is this, rather, what is 
intended, requiring one to wrap the included pages in an explicit 
makeup (as I am now doing)?


\pagefigure[...][...] (no need for \startpagefigure .. \stoppagefigure) 
is a combination of \startTeXpage and \externalfigure and you shouldn't 
put the command in a makeup environment.


Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Re: Title pages makeup extra blank pages

2023-07-06 Thread Alan Braslau via ntg-context

On 06/07/23 06/07/23, 17:07, Wolfgang Schuster wrote:


Add "doublesided=no" to your makeup settings.

Wolfgang


Thank you.
I have doublesided=no in the makeup, but this makeup is not used by 
\startpagefigure.


The problem is with \startpagefigure that is outside of makeup, that is 
it is using the standard makeup (with doublesided=yes). Is this a bug, 
that is should \startpagefigure use the makeup of the included PDF 
document and ignore the local makeup? Or is this, rather, what is 
intended, requiring one to wrap the included pages in an explicit makeup 
(as I am now doing)?


Alan
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Re: Title pages makeup extra blank pages

2023-07-06 Thread Wolfgang Schuster

Alan Braslau via ntg-context schrieb am 06.07.2023 um 11:58:

On 06/07/23 06/07/23, 10:14, Henning Hraban Ramm wrote:

Am 06.07.23 um 09:34 schrieb Alan Braslau via ntg-context:
inserts a "blank" page (with header/footer) between the two 
Coverpages and a second "blank" page after the backside title page.


I don’t know if it helps, but did you set
\setupsectionblock[frontpart][page=no]
?


I had \setupsectionblock[frontpart][page=]
and setting page=no does not change anything.

I get the same behavior in my Volume 2 product, which does not have 
any \frontmatter.


I solved the problem by rather using:

 \definemakeup[cover][page][page=no,doublesided=no]
 \definelayout[cover][page]
 \startmakeup [cover]
   \filterpages[Coverpages][1]
 \stoppagemakeup
 \startmakeup [cover]
   \filterpages[Coverpages][2]
 \stoppagemakeup


\startlayout[page]
\filterpages[...]
\stoplayout

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: Title pages makeup extra blank pages

2023-07-06 Thread Wolfgang Schuster

Alan Braslau via ntg-context schrieb am 06.07.2023 um 09:34:

Hello,

Trying to use:

\startdocument

\startpagefigure[Coverpages.pdf][page=1]\stoppagefigure
\startpagefigure[Coverpages.pdf][page=2]\stoppagefigure

% before

\startmakeup [titlepage]
front
\stopmakeup

\startmakeup [titlepage]
back
\stopmakeup

\startfrontmatter
...
\stopfrontmatter

...

\stopdocument


inserts a "blank" page (with header/footer) between the two Coverpages 
and a second "blank" page after the backside title page.


Not including the two \startpagefigure lines eliminates the blank page 
following the back side title page (and the other one between the two 
Coverpages, of course).



This is not a MWE as it occurs in a complicated project but not in mwe 
snippets.


I suspect that this artifact is somehow related to the page={...} 
settings later in the document. How can I turn OFF all automatic page 
generation settings for the very beginning of my document? Any ideas?

(Title page makeup has always been somewhat of a mystery to me.)


Add "doublesided=no" to your makeup settings.

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: \showmakeup adds unwanted space despite accurate readings; \qquad mandatory before \TeX\

2023-07-06 Thread Carlos
On Wed, Jul 05, 2023 at 07:37:56PM +0200, Hans Hagen via ntg-context wrote:
> On 7/5/2023 7:05 PM, Carlos wrote:
> 
> > And I don't want to stir up anything here either, but if the convention of
> > using non-official vs official fonts is the new de facto under lmtx,
> > I guess my opening question is invalid by all acounts
> Well, the policy wrt font is quite simple:
> 
> (1) one can define a typescript for any font, and one is free to mess around
> in these as much as possible
> 
> (2) a proper font will normally work ok but of course there can be
> exceptions
> 
> (3) if a font behaves bad one can ask on the list but then you need to give
> a mwe + output + indication where something is wrong
> 
> (4) if you're lucky someone else has that font and can try, but keep in mind
> that one cannot assume someone to spend time (it is not everyones hobby to
> solve issues)
> 
> (5) if nothing works out you need to provide an official (properly licenced
> copy, which in the case of a commercial font means that you have to buy an
> extra copy)
> 
> (6) you have to keep in mind that you ask someone to spend time on something
> that is not worth spending time on (in the case of lucida: the ones from tug
> work fine, and we send quite some time on the math too, so we see no reason
> to spend more time on it ... there is only so much you can expect for free)
> 
> (7) you cannot claim someones time and to what extend questions get answered
> also depends on the tone of the email, the way questions are formulates, etc
> etc

I agree with everything. Except (5). 

Last time I checked Oracle, Corporation, one of the greediest money
hungry behemoth eavesdropping corporate shithole to ever set foot on
planet earth, owned or included the Lucida family on every java runtime
environment that there was. This piece of software was also
involuntarily required to run quite a few of programs. 

Anyhow. Heck. Let's check the company's revenue:

Revenue Increase US$49.95 billion (2023)
Operating incomeIncrease US$13.09 billion (2023)
Net income  Increase US$8.503 billion (2023)
Total assetsIncrease US$134.4 billion (2023)
Total equityIncrease US$1.556 billion (2023)

ouch. Billions, right?  

So no. Let's stop the pretty lawyerish talk and rethoric and enough
with licenses too.

When you said ‹ripoff›, I'm not going to take it personally, and I
guess, and rightly so, you must have been referring to these
folks above rather than an end-user of lmtx like myself.  

So no. The metrics are perfectly fine with the Lucida family from jre. 

> 
> that said ... if you think that you can deduce conventions from the fact
> that it is impossible or hard to answer a (somewhat vague) question, some
> introspection is needed ... i get the impressions that you have no clue what
> the de-facto conventions are under lmtx so i'd be careful in drawing
> conclusions
> 
> also said: i do know the difference between input and font encoding and i do
> know what tfm and afm files contain and i also do know how to implement
> font/char handling (unless i have to guess what encoding, fonts, chars,
> engine an dmacro package a user is using in which case I don't - want to -
> know any of this) but when a user complain in certain ways i tend to not
> listen
> 
> (let's see what chat gpt mnakes of that in the future)
> 
> anyway, i don't have these fonts, i have working lucida setup as do other
> users, so i see no problem
> 
> and, as your fonts work fine in lualatex, you have a way out of this
> persistent font issue,
> 
> 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 / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___
> 

-- 
As long as there are ill-defined goals, bizarre bugs, and unrealistic
schedules, there will be Real Programmers willing to jump in and Solve
The Problem, saving the documentation for later.

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/

[NTG-context] Re: \showmakeup adds unwanted space despite accurate readings; \qquad mandatory before \TeX\

2023-07-06 Thread Carlos
On Wed, Jul 05, 2023 at 06:52:30PM +0200, Hans Hagen wrote:
> On 7/5/2023 6:38 PM, Carlos wrote:
> > On Wed, Jul 05, 2023 at 06:12:32PM +0200, Hans Hagen wrote:
> > > On 7/5/2023 5:53 PM, Carlos wrote:
> > > > On Wed, Jul 05, 2023 at 04:43:56PM +0200, Hans Hagen wrote:
> > > > > On 7/5/2023 3:18 PM, Carlos wrote:
> > > > > > \showmakeup on \TeX\ shows a
> > > > > > 
> > > > > > tSP:3.282
> > > > > > THK:-1.721
> > > > > > H__E
> > > > > > X
> > > > > > HK:-1.291
> > > > > > SP:3.282
> > > > > 
> > > > > no MWE includes so clueless
> > > > 
> > > > \starttypescript[mylucidaserif]
> > > > \definefontsynonym[LucidaBrightRegular]
> > > > [file:LucidaBrightRegular]
> > > > \definefontsynonym[LucidaBrightItalic] [file:LucidaBrightItalic]
> > > > \definefontsynonym[LucidaBrightDemiBold]   
> > > > [file:LucidaBrightDemiBold]
> > > > \definefontsynonym[LucidaBrightDemiItalic] 
> > > > [file:LucidaBrightDemiItalic]
> > > > \stoptypescript
> > > Hm, isn't that this lucida rip off again? Maybe bad metricks then but I'm
> > > not going to look into that as the official TUG lucida opentype fonts
> > > perform okay.
> > > 
> > > Hans
> > 
> > The first sentence is irrelevant. And a guess. Bad metrics is not the
> > culprit
> > 
> > if it were true, the same problem would be under lualatex, correct?
> 
> well, who knows what (me)tricks those fonts have embedded .. are these the
> official TUG lucida open type fonts? if so,
> 
> \setupbodyfont[lucida]
> 
> should just work (btw, you also don't set up math)
> 
> > But it's not there.
> I can't (and won't) check that as I don't have (lua)latex installed nor have
> those fonts. I also don't see where this \qquad is in your example.


Using the same fonts under lualatex yields \TeX\ without an issue. 

\documentclass{article}

\usepackage{unicode-math}

\defaultfontfeatures{Ligatures=TeX}

\setmainfont[
  ItalicFont=LucidaBrightItalic,
BoldFont=LucidaBrightDemiBold,
  BoldItalicFont=LucidaBrightDemiItalic,
  ]{LucidaBrightRegular}
%
\setsansfont[
  ItalicFont=LucidaSansOblique,
BoldFont=LucidaSansDemiBold,
  BoldItalicFont=LucidaSansDemiOblique,
  ]{LucidaSansRegular}
%
\setmonofont[
%  ItalicFont=LucidaTypewriterOblique,
BoldFont=LucidaTypewriterBold,
%  BoldItalicFont=LucidaTypewriterBoldOblique,
  ]{LucidaTypewriterRegular}

\begin{document}

{\rm\input{knuth}}

\textsf{\input{knuth}}

\end{document}

> 
> As for the \showmakup ... it is used extensively and afaiks there are no
> issues with it.

After running lualatex the problem dissappears. Or it seems like it. 

> 
> 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 / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___
> 

-- 
You will lose an important disk file.

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Re: Title pages makeup extra blank pages

2023-07-06 Thread Henning Hraban Ramm

Am 06.07.23 um 11:58 schrieb Alan Braslau:

Maybe it’s also a problem of \startdocument – I always get a first 
empty page and don’t understand why.


One gets an empty first page if there is *any* text content anywhere in 
the setups or environment files before the \startdocument.


My problem actually was \startMPcode; had nothing to do with 
\startdocument or your code, sorry.


Also sorry, seems like I can’t help you.

Hraban

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: MPcode inserts page

2023-07-06 Thread Henning Hraban Ramm

Am 06.07.23 um 12:02 schrieb Alan Braslau:

On 06/07/23 06/07/23, 11:23, Henning Hraban Ramm wrote:
Hi, if I use \startMPcode to declare variables etc. that I need in 
several MP graphics, it always inserts an empty page. How can I avoid 
that?
(Actually, I load an external mp file, and for random value reasons I 
must load it only once. But the MWE already shows the problem.)



"""
\startMPcode
numeric something;
something := 1;
\stopMPcode

\starttext
\chapter{Something}

Anything.

\stoptext
"""


\startMPinitializations % used by ALL MP instances
% also called repeatedly
\stopMPinitializations

\startMPdefinitions
\stopMPdefinitions

This is what you want.


Exactly, the latter.
Thank you, these two environments were missing in my book.

Hraban

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] SVG converter bugs

2023-07-06 Thread Max Chernoff
Hi Hans,

I've been using the SVG->MP converter and I've found a few bugs. Most of
the bugs are with "weird" SVG input, but I have no control over the
input, and the metadata on most of the files shows that it was exported
from Adobe Illustrator which is (unfortunately) quite popular. I've
tested all of the below with the latest ConTeXt.



If you give Metapost an out-of-order gradient, it produces an invalid
PDF. Both pages in this example:

   \startbuffer[gradient]
   http://www.w3.org/2000/svg;>
   
   
   
   
   
   
   
   
   
   
   
   \stopbuffer
   
   \starttext
   
   \startTEXpage
   \includesvgbuffer[gradient]
   \stopTEXpage
   
   \startMPpage
   fill unitsquare xyscaled (200,100)
   withshademethod "linear"
   withshadecenteronefraction (0,1)
   withshadecentertwofraction (0,0)
   withshadestep (
   withshadefraction 0
   withshadecolors (green, green)
   )
   withshadestep (
   withshadefraction 0.75
   withshadecolors (blue, green)
   )
   withshadestep (
   withshadefraction 0.25
   withshadecolors (green, blue)
   )
   withshadestep (
   withshadefraction 1
   withshadecolors (green, blue)
   )
   ;
   \stopMPpage
   
   \stoptext

write this to the PDF

   /Bounds [
 0
 0.75
 0.25
   ]

which is invalid and renders incorrectly in every PDF reader that I've
tested. This is what the SVG 1.1 spec has to say:

   Each gradient offset value is required to be equal to or greater than
   the previous gradient stop's offset value. If a given gradient stop's
   offset value is not equal to or greater than all previous offset values,
   then the offset value is adjusted to be equal to the largest of all
   previous offset values.



The following SVG renders incorrectly, but replacing the 0% stop with
the commented one fixes it:

   http://www.w3.org/2000/svg;>
   
   
   
   
   
   
   
   
   
   



Using a gradient as the stroke colour outputs an invalid colour to
MetaPost. This example:

   \startbuffer[gradient]
   http://www.w3.org/2000/svg;>
   
   
   
   
   
   
   
   
   
   \stopbuffer
   
   \startluacode
   print(metapost.svgtomp{data = buffers.getcontent("gradient")})
   \stopluacode

gives this output:

   [...]
   withcolor "url(#gradient)"
   [...]



"stop-opacity" seems to be ignored:

   \startbuffer[gradient]
   http://www.w3.org/2000/svg;>
   
   
   
   
   
   
   
   
   
   \stopbuffer
   
   \startTEXpage
   \includesvgbuffer[gradient]
   \stopTEXpage



Finally, "display:none;" doesn't work:

   \startbuffer[gradient]
   http://www.w3.org/2000/svg;>
   
   
   \stopbuffer
   
   \startTEXpage
   \includesvgbuffer[gradient]
   \stopTEXpage


Thanks,
-- Max
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Re: MPcode inserts page

2023-07-06 Thread Alan Braslau via ntg-context

On 06/07/23 06/07/23, 11:23, Henning Hraban Ramm wrote:
Hi, if I use \startMPcode to declare variables etc. that I need in 
several MP graphics, it always inserts an empty page. How can I avoid that?
(Actually, I load an external mp file, and for random value reasons I 
must load it only once. But the MWE already shows the problem.)



"""
\startMPcode
numeric something;
something := 1;
\stopMPcode

\starttext
\chapter{Something}

Anything.

\stoptext
"""


\startMPinitializations % used by ALL MP instances
% also called repeatedly
\stopMPinitializations

\startMPdefinitions
\stopMPdefinitions

This is what you want.

--
Alan

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Re: Title pages makeup extra blank pages

2023-07-06 Thread Alan Braslau via ntg-context

On 06/07/23 06/07/23, 10:14, Henning Hraban Ramm wrote:

Am 06.07.23 um 09:34 schrieb Alan Braslau via ntg-context:
inserts a "blank" page (with header/footer) between the two Coverpages 
and a second "blank" page after the backside title page.


I don’t know if it helps, but did you set
\setupsectionblock[frontpart][page=no]
?


I had \setupsectionblock[frontpart][page=]
and setting page=no does not change anything.

I get the same behavior in my Volume 2 product, which does not have any 
\frontmatter.


I solved the problem by rather using:

 \definemakeup[cover][page][page=no,doublesided=no]
 \definelayout[cover][page]
 \startmakeup [cover]
   \filterpages[Coverpages][1]
 \stoppagemakeup
 \startmakeup [cover]
   \filterpages[Coverpages][2]
 \stoppagemakeup

Thank you for your suggestion!


Maybe it’s also a problem of \startdocument – I always get a first empty 
page and don’t understand why.


One gets an empty first page if there is *any* text content anywhere in 
the setups or environment files before the \startdocument.


--
Alan
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] MPcode inserts page

2023-07-06 Thread Henning Hraban Ramm
Hi, if I use \startMPcode to declare variables etc. that I need in 
several MP graphics, it always inserts an empty page. How can I avoid that?
(Actually, I load an external mp file, and for random value reasons I 
must load it only once. But the MWE already shows the problem.)



"""
\startMPcode
numeric something;
something := 1;
\stopMPcode

\starttext
\chapter{Something}

Anything.

\stoptext
"""


Hraban
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] definedocument, begin & closing

2023-07-06 Thread Henning Hraban Ramm

Hi,
if I use \startdocument, the setups "document:start" and "document:stop" 
get inserted at the beginning and end. But if I define my own document, 
it doesn’t work. What’s wrong?


"""
\definedocument[presentation]

\startsetups[presentation:start]
{\bfd\documentvariable{title}}
\stopsetups

\startsetups[presentation:stop]
Thanks for all the fish.

\stopsetups


\startpresentation[title=Something]

anything

\stoppresentation
"""

Hraban
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: Title pages makeup extra blank pages

2023-07-06 Thread Henning Hraban Ramm

Am 06.07.23 um 09:34 schrieb Alan Braslau via ntg-context:
inserts a "blank" page (with header/footer) between the two Coverpages 
and a second "blank" page after the backside title page.


I don’t know if it helps, but did you set
\setupsectionblock[frontpart][page=no]
?

Maybe it’s also a problem of \startdocument – I always get a first empty 
page and don’t understand why.


Hraban
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Title pages makeup extra blank pages

2023-07-06 Thread Alan Braslau via ntg-context

Hello,

Trying to use:

\startdocument

\startpagefigure[Coverpages.pdf][page=1]\stoppagefigure
\startpagefigure[Coverpages.pdf][page=2]\stoppagefigure

% before

\startmakeup [titlepage]
front
\stopmakeup

\startmakeup [titlepage]
back
\stopmakeup

\startfrontmatter
...
\stopfrontmatter

...

\stopdocument


inserts a "blank" page (with header/footer) between the two Coverpages 
and a second "blank" page after the backside title page.


Not including the two \startpagefigure lines eliminates the blank page 
following the back side title page (and the other one between the two 
Coverpages, of course).



This is not a MWE as it occurs in a complicated project but not in mwe 
snippets.


I suspect that this artifact is somehow related to the page={...} 
settings later in the document. How can I turn OFF all automatic page 
generation settings for the very beginning of my document? Any ideas?

(Title page makeup has always been somewhat of a mystery to me.)

Alan
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___