to use pull quotes, I need to use the dimensions of the different elements to be typeset, before typesetting, in order to adapt the shapes of the flow accordingly.

So here is just a basic code to
1/ get the dimensions of an item A that will be typeset, before it is actually typeset 2/ use these dimensions to define a item B that should be typeset before item 1
3/ typeset of item B and finally item A


It is a quick and dirty solution.

Please, could you help me to have a more elegant solution

1/ to replace

         "width=\measure{FTitleW},"

    by something more direct like

         "width=\GetDim{myframes}{FTitle}


2/ to replace

   context("\\definemeasure[#2W][" .. (n.width /65536)  .. "pt]")

   by a more "luametatexish" formulation



Le 28/05/2022 à 20:25, Garulfo a écrit :
some progress... if it can help.

No more issue with nonsymetrical behavior, and \framed are properly aligned with the grid.

Garulfo

Attachment: mesure_framed.pdf
Description: Adobe PDF document

\defineblock[myframes]

\unexpanded\def\GetDim#1#2{
\setbox\scratchbox\hbox\bgroup\useblocks[#1][#2]\egroup%
\directlua{%
local n = tex.getbox('scratchbox')
context("\\definemeasure[#2W][" .. (n.width /65536)  .. "pt]")
context("\\definemeasure[#2H][" .. (n.height /65536)  .. "pt]")
}}


%------------------------------------------------------------------------------

\starttext

\beginmyframes[FTitle]
\framed
  [align=normal]
  {initial framed for a title zone\\
   early in the source code but not yet typeset\\
   with a long sentence to take place horizontaly and for demonstration}
\endmyframes

\GetDim{myframes}{FTitle}

\framed
  [align=normal,
   width=\measure{FTitleW},
   height=\measure{FTitleH}]
  {a second framed, with dimensions equal to the original frame, typeset before the original}

\useblocks[myframes][FTitle]

\stoptext

%------------------------------------------------------------------------------
___________________________________________________________________________________
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 via email to