On 5/19/2024 2:29 PM, garu...@azules.eu wrote:
I still get some difficulties with build_parshape, \getshapetex and sectionning.

I though I find a solution by removing \blank with
   \setuphead  [subsection]  [before=,  after=, style=, 
command=\MySubSectionCommand, alternative=text ]

But actually it's not enough : when I add text before the first section, new 
issues appear.

I tried to build a MVE by refactoring and tidying as much as I could.
It build 3 comparative pages (i) basic issue, (ii) solution, (iii) remaining 
issue.

Your guidance are most welcome :-)

you have to fight several issues:

- parshapes being reset at the end paragraph (handled here by luametatex context) - parshapes operate on lines, not dimension (i might add an aletnative one day)
- you use a bit old mechanism (checkout the luametafun-paragraphs chapter)

Now, is there a solution? It really depends on the circumstances, so here is one.

\setupbodyfont[11pt]

\definemeasure [mywidth]      [7cm]
\definemeasure [mywidtha]     [5cm]
\definemeasure [myheight] [{\the\dimexpr\baselineskip*37+\lineskip\relax}] \definemeasure [myheighta] [{\the\dimexpr\baselineskip*18+\lineskip*1\relax}] \definemeasure [myheightb] [{\the\dimexpr\baselineskip*25-\lineskip*1\relax}]

\startuseMPgraphic{shape:1}
  path p ;
  numeric mywidth   ; mywidth   := \measure{mywidth};
  numeric mywidtha  ; mywidtha  := \measure{mywidtha};
  numeric myheight  ; myheight  := \measure{myheight};
  numeric myheighta ; myheighta := \measure{myheighta};
  numeric myheightb ; myheightb := \measure{myheightb};
  p := (0,0)                -- (mywidth,0) --
       (mywidth,myheighta)  -- (mywidtha,myheighta) --
       (mywidtha,myheightb) -- (mywidth,myheightb) --
       (mywidth,myheight)   -- (0cm,myheight) -- cycle;

build_parshape(p,0,0,0,\baselinedistance,\strutheight,\strutdepth,\topskip) ;
  path SavedShape ; SavedShape := p ;
\stopuseMPgraphic

\startuseMPgraphic{shape:2}
  SavedShape := SavedShape shifted (0,-ypart urcorner OverlayBox) ;
  SavedShape := SavedShape shifted (0,positiony("test")) ;
  fill SavedShape withcolor red;
 setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\showframe

\defineoverlay[myoverlay][\useMPgraphic{shape:2}]

\setupbackgrounds[text][text][background=myoverlay]

\startsection[title={test}]

\startshapedparagraph[mp=shape:1]%
    \setupalign[verytolerant,stretch]%
    \hpos{test}{!}\samplefile{tufte}
    \samplefile{tufte}
\stopshapedparagraph

\stopsection

The "test" position is hard coded but should be namespaced, the ! can be a \strut instead.

So, more thinking from the end of the text flow.

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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to