[NTG-context] Making ConTeXt stop on all or some errors

Pablo Rodriguez oinos at gmx.es
Wed Feb 6 19:31:06 CET 2019


On 2/5/19 8:07 AM, Jan U. Hasecke wrote:
> Hola Pablo,

Hallo Jan-Ulrich,

> I inserted this in the setupbackend command so that ConTeXt stops with
> the unknown command \colorprofilenotfound I inserted in the else clause.
> 
> But more and more I think that ConTeXt should fail if it does not find
> the color profile, because if you forget to study the log file before
> sending the pdf to the print shop you can loose a lot of money.

But the scenarios in which you could loose a lot of money are many more
than you might think.

Imagine the following:

    \startbuffer
        A Greek sentence:
            χαλεπὰ τὰ καλά
    \stopbuffer
    \definefallbackfamily[mainface][rm][GFS Didoto]
        [preset=range:greek]
    \definefontfamily[mainface][rm][Latin Modern Roman]
    \definefallbackfamily[amainface][rm][GFS Didot]
        [preset=range:greek]
    \definefontfamily[amainface][rm][TeX Gyre Pagella]
    \definefallbackfamily[smainface][rm][GFS Didot]
        [preset=range:greek, force=yes]
    \definefontfamily[smainface][rm][TeX Gyre Pagella]
    \setupbodyfont[mainface]
    \starttext
    \startTEXpage[offset=2em]
        \getbuffer\\
        \amainface\getbuffer\\
        \smainface\getbuffer
    \stopTEXpage
    \stoptext

Not embedding all glyphs for the fallback font (failing to type
"force=yes") could lead to weird results. Not to mention when a font
isn’t embedded at all.

> And as we use ConTeXt in a group where people have different ConTeXt
> knowledge the generation should be bullet proofed.

I totally agree with that. But it mainly relies on how source documents
are written. ConTeXt cannot type the source for us.

> The behaviour of ConTeXt is AFAICS the following.
> If you install icc-profiles in texmf-context they get lost during the
> next update of ConTeXt. But ConTeXt will not stop the complilation only
> warning that there is no profile file.
> 
> ConTeXt only stops to compile if you delete a profile which was present
> during installation/update or which was present during a "mtxrun
> --generate" (Thanks to Mojca for this hint). Then the file is registered
> and ConTeXt wants to access it, failing if it is not there.
> 
> If you install profiles in texmf-local and then do a "mtxrun --generate"
> you are quite safe as long as you do not install ConTeXt from scratch.

No computer can read your mind. Or a brand-new installation cannot guess
whether you are up to some auxiliary files (name them color profiles,
fonts, or whatever you want).

> If you want to compile a ConTeXt project on an other computer you have
> to study the log file to see that it does not find a color profile. And
> this is dangerous, because none expects this to be a problem. I think
> ConTeXt should fail and stop if the profile is not there.

But checking if the file exists is a safe way to know whehter it can be
embedded in the output PDF document.

Another scenario would be attaching files to a PDF document using the
\attachment command. I have done it myself.

With some of my documents, I had to attach a variable number of extra
documents to the final PDF. The only way to secure the attachment was
\doiffileelse{file.pdf}{\attach[file.pdf]}{\ssbf\color[red]{missing
attachment}}.

Just in case it helps,

Pablo
-- 
http://www.ousia.tk


More information about the ntg-context mailing list