Hi,

I've been trying to use the \starthanging to place a metapost drawn graphic
at the start of a paragraph. Unfortunately, the graphic does not appear to
be aligned with the grid.

I know I can mess with the placement manually by doing something like:
\setuphanging[location=left, n=2,topoffset=1*em,distance=.2*em].

Is there a way to enforce alignment with the grid, so the letter that looks
like an "n" is snapped to the gridlines? In the attached image, the first
example uses \placeinitial which puts the letter on the gridline,
whereas the second and third instances use \starthanging and the letter
does not appear to be on the grid line.

*Minimal example:*
\definefontfeature[minimal][hebrew]

\starttypescript [serif] [hebrew]
  \definefontsynonym [Serif]
[file:/workspaces/context_lmtx/context_2/build_from_cmake_2/context_from_scratch/tex/texmf-fonts/firago/FiraGO-Regular.ttf][features=minimal]
  \definefontsynonym
[SerifBold][file:/workspaces/context_lmtx/context_2/build_from_cmake_2/context_from_scratch/tex/texmf-fonts/firago/FiraGO-Regular.ttf][features=minimal]
\stoptypescript

\definetypeface [hebrew]  [rm]  [serif] [hebrew]
\definetypeface [hebrew]  [ss]  [serif] [hebrew]

\setupbodyfont[hebrew, 20pt]
\setupalign[r2l]
\setupdirections[bidi=global, method=unicode]

\setupinitial[n=2]

\definegridsnapping[tolerant]

\setuplayout
  [grid=normal]

\showgrid
\showstruts

\starttext

\placeinitial
חַי ה' וּבָרוּךְ צוּרִי
בַּה' תִּתְהַלֵּל נַפְשִׁי
כִּי ה' יָאִיר נֵרִי
בְּהִלּוֹ נֵרוֹ עֲלֵי רֹאשִׁי
בַּה' תִּתְהַלֵּל נַפְשִׁי
כִּי ה' יָאִיר נֵרִי
בְּהִלּוֹ נֵרוֹ עֲלֵי רֹאשִׁי
חַי ה' וּבָרוּךְ צוּרִי
בַּה' תִּתְהַלֵּל נַפְשִׁי
כִּי ה' יָאִיר נֵרִי
בְּהִלּוֹ נֵרוֹ עֲלֵי רֹאשִׁי

\blank

\def\hangingCharacter#1{%
\setMPtext{hebrew_letter}{#1}
\startuseMPgraphic{letter_w}
    picture q;
    q := outlinetext(\MPstring{hebrew_letter}) scaled 3;
    for i within q:
        j := j + 1;
        draw pathpart i withpen pencircle scaled 2;
    endfor;
    % draw bbox currentpicture withpen pencircle scaled 1pt;
\stopuseMPgraphic
\useMPgraphic{letter_w}
}

\setuphanging[location=left, n=2]

\startparagraph[align=lohi]
\starthanging{\hangingCharacter{חַ}}
י ה' וּבָרוּךְ צוּרִי
בַּה' תִּתְהַלֵּל נַפְשִׁי
כִּי ה' יָאִיר נֵרִי
בְּהִלּוֹ נֵרוֹ עֲלֵי רֹאשִׁי
 ה' וּבָרוּךְ צוּרִי
בַּה' תִּתְהַלֵּל נַפְשִׁי
כִּי ה' יָאִיר נֵרִי
בְּהִלּוֹ נֵרוֹ עֲלֵי רֹאשִׁי
\stophanging
\stopparagraph

\blank
\starthanging{\hangingCharacter{חַ}}
י ה' וּבָרוּךְ צוּרִי
בַּה' תִּתְהַלֵּל נַפְשִׁי
כִּי ה' יָאִיר נֵרִי
בְּהִלּוֹ נֵרוֹ עֲלֵי רֹאשִׁי
\stophanging

\stoptext

*Context Version:*
ConTeXt  ver: 2025.11.24 17:55 LMTX  fmt: 2026.6.3  int: english/english

Any help would be appreciated.

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

maillist : [email protected] / 
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