ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	mf <massifr@fastwebnet.it>
Subject: Re: offset for background overlay
Date: Sat, 11 Apr 2020 19:41:17 +0200	[thread overview]
Message-ID: <725aaed5-6a77-86a2-daa8-763232941349@xs4all.nl> (raw)
In-Reply-To: <cc51f10a-21bf-eb4f-c631-08ebd7c64595@fastwebnet.it>

On 4/11/2020 4:15 PM, mf wrote:
> Hello list,
> this MWE is a simplified version of a real case:
> 
> \startuseMPgraphic{cell:triangle}
>    path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth 
> yscaled 2.5 OverlayHeight ;
>    draw p withcolor red ;
> \stopuseMPgraphic
> \defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}]
> \starttext
> \bTABLE[frame=off]
>    \bTR
>      \bTD[nx=2,background=triangle,align=middle] \dontleavehmode a\crlf 
> text \eTD
>    \eTR
>    \bTR[toffset=1mm]
>      \bTD left \eTD
>      \bTD right \eTD
>    \eTR
> \eTABLE
> \stoptext
here's a very ugly solution

\startuseMPgraphic{cell:triangle}
     fill llcorner OverlayBox
         -- lrcorner OverlayBox
         -- (center bottomboundary OverlayBox shifted 
(0,\MPy{foo:2}-\MPh{foo:2}+\MPd{foo:2}-\MPy{foo:1}))
         -- cycle
         withcolor red ;
     setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}]

\starttext

\bTABLE[frame=off]
   \bTR
     \bTD[nx=2,align=middle,height=0pt,background=triangle]\xypos{foo:1}\eTD
   \eTR
   \bTR
     \bTD[nx=2,align=middle] \dontleavehmode a\crlf text \eTD
   \eTR
   \bTR[toffset=1mm]
     \bTD \hpos{foo:2}{\strut} left \eTD
     \bTD right \eTD
   \eTR
\eTABLE

\stoptext

it is probably possible to get some info otherwise (more efficient) if 
really needed (if we add some helpers)

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
___________________________________________________________________________________

  reply	other threads:[~2020-04-11 17:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-11 14:15 mf
2020-04-11 17:41 ` Hans Hagen [this message]
2020-04-11 18:11   ` Wolfgang Schuster
2020-04-11 21:59     ` mf
2020-04-12  5:53       ` Wolfgang Schuster
2020-04-13 15:21         ` mf
2020-04-13 16:14           ` Wolfgang Schuster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=725aaed5-6a77-86a2-daa8-763232941349@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=massifr@fastwebnet.it \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).